Fix backing store compositor transform with Vulkan

The problem does not become apparent until a QQuickWidget or QRhiWidget
using Vulkan is put into a QScrollArea and then attempted to be scrolled
vertically.

Fixes: QTBUG-116338
Change-Id: I55367b51aaf2bb8d039bf5e313a0d8c3d7908327
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 750d00aba7e49b6093bc273924ba688cb433b505)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Laszlo Agocs 2023-08-28 17:30:37 +02:00 committed by Qt Cherry-pick Bot
parent b984680021
commit faee1c1640

View File

@ -173,7 +173,7 @@ static QMatrix4x4 targetTransform(const QRectF &target, const QRect &viewport, b
matrix(1,3) = y_translate;
matrix(0,0) = x_scale;
matrix(1,1) = y_scale;
matrix(1,1) = (invertY ? -1.0 : 1.0) * y_scale;
return matrix;
}
@ -543,8 +543,9 @@ QPlatformBackingStore::FlushResult QBackingStoreDefaultCompositor::flush(QPlatfo
const qreal dpr = window->devicePixelRatio();
const QRect deviceWindowRect = scaledRect(QRect(QPoint(), window->size()), dpr);
const bool invertTargetY = rhi->clipSpaceCorrMatrix().data()[5] < 0.0f;
const bool invertSource = rhi->isYUpInFramebuffer() != rhi->isYUpInNDC();
const bool invertTargetY = !rhi->isYUpInNDC();
const bool invertSource = !rhi->isYUpInFramebuffer();
if (m_texture) {
// The backingstore is for the entire tlw. In case of native children, offset tells the position
// relative to the tlw. The window rect is scaled by the source device pixel ratio to get