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 <andy.nichols@qt.io>
bb10
Laszlo Agocs 2024-04-30 10:44:13 +02:00
parent 124e7d896b
commit f8786a8673
2 changed files with 9 additions and 3 deletions

View File

@ -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;
};

View File

@ -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<GLint> supportedCompressedFormats;