From f8786a867340f4fce964f4444f4a747f5d991d7d Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 30 Apr 2024 10:44:13 +0200 Subject: rhi: gl: Clean up UNPACK_ROW_LENGTH handling Be consistent and do not attempt to set GL_UNPACK_ROW_LENGTH on GLES 2.0. Have an appropriate flag in caps. Task-number: QTBUG-120565 Change-Id: I7b4db49480c2225b11807681d9bc77d2f2615e30 Reviewed-by: Andy Nichols --- src/gui/rhi/qrhigles2.cpp | 6 ++++-- src/gui/rhi/qrhigles2_p.h | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src/gui/rhi') diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index 62830c291d..f54371da66 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -1096,6 +1096,8 @@ bool QRhiGles2::create(QRhi::Flags flags) caps.glesMultiviewMultisampleRenderToTexture = false; } + caps.unpackRowLength = !caps.gles || caps.ctxMajor >= 3; + nativeHandlesStruct.context = ctx; contextLost = false; @@ -1426,7 +1428,7 @@ bool QRhiGles2::isFeatureSupported(QRhi::Feature feature) const case QRhi::PipelineCacheDataLoadSave: return caps.programBinary; case QRhi::ImageDataStride: - return !caps.gles || caps.ctxMajor >= 3; + return caps.unpackRowLength; case QRhi::RenderBufferImport: return true; case QRhi::ThreeDimensionalTextures: @@ -2363,7 +2365,7 @@ void QRhiGles2::enqueueSubresUpload(QGles2Texture *texD, QGles2CommandBuffer *cb dataStride = bytesPerLine; cmd.args.subImage.rowStartAlign = (dataStride & 3) ? 1 : 4; - cmd.args.subImage.rowLength = bytesPerPixel ? dataStride / bytesPerPixel : 0; + cmd.args.subImage.rowLength = caps.unpackRowLength ? (bytesPerPixel ? dataStride / bytesPerPixel : 0) : 0; cmd.args.subImage.data = data; }; diff --git a/src/gui/rhi/qrhigles2_p.h b/src/gui/rhi/qrhigles2_p.h index 4305186c02..4139579864 100644 --- a/src/gui/rhi/qrhigles2_p.h +++ b/src/gui/rhi/qrhigles2_p.h @@ -1014,7 +1014,10 @@ public: halfAttributes(false), multiView(false), timestamps(false), - objectLabel(false) + objectLabel(false), + glesMultisampleRenderToTexture(false), + glesMultiviewMultisampleRenderToTexture(false), + unpackRowLength(false) { } int ctxMajor; int ctxMinor; @@ -1073,6 +1076,7 @@ public: uint objectLabel : 1; uint glesMultisampleRenderToTexture : 1; uint glesMultiviewMultisampleRenderToTexture : 1; + uint unpackRowLength : 1; } caps; QGles2SwapChain *currentSwapChain = nullptr; QSet supportedCompressedFormats; -- cgit v1.2.3