rhi: gl: Destructure mat3 correctly
As per std140 packing rules. Change-Id: I85663d36a9fa617ea387e8f201677471b2ebd948 Fixes: QTBUG-80655 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
This commit is contained in:
parent
979b9335e5
commit
53804f553d
@ -2428,7 +2428,15 @@ void QRhiGles2::bindShaderResources(QRhiGraphicsPipeline *maybeGraphicsPs, QRhiC
|
||||
f->glUniformMatrix2fv(uniform.glslLocation, 1, GL_FALSE, reinterpret_cast<const float *>(src));
|
||||
break;
|
||||
case QShaderDescription::Mat3:
|
||||
f->glUniformMatrix3fv(uniform.glslLocation, 1, GL_FALSE, reinterpret_cast<const float *>(src));
|
||||
{
|
||||
// 4 floats per column (or row, if row-major)
|
||||
float mat[9];
|
||||
const float *srcMat = reinterpret_cast<const float *>(src);
|
||||
memcpy(mat, srcMat, 3 * sizeof(float));
|
||||
memcpy(mat + 3, srcMat + 4, 3 * sizeof(float));
|
||||
memcpy(mat + 6, srcMat + 8, 3 * sizeof(float));
|
||||
f->glUniformMatrix3fv(uniform.glslLocation, 1, GL_FALSE, mat);
|
||||
}
|
||||
break;
|
||||
case QShaderDescription::Mat4:
|
||||
f->glUniformMatrix4fv(uniform.glslLocation, 1, GL_FALSE, reinterpret_cast<const float *>(src));
|
||||
|
Loading…
x
Reference in New Issue
Block a user