diff options
author | Kevin Ottens <kevin.ottens@kdab.com> | 2017-09-06 15:58:12 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-09-06 14:00:00 +0000 |
commit | e9e3208dd7c2e2f755948b1838faa94c2802cc30 (patch) | |
tree | 7fe2c79b872bac364e567308ec2fa27bb78d16ef /src/render/graphicshelpers | |
parent | 2e4acacfa3a062b8585226500f6cbc65597b8b67 (diff) |
GraphicsHelperGL2: Remember to set raw byte size
If one ended up with this helper then the applyUniform would lead to a
divide by zero for any type.
As a side-effect, the support for more matrix types needed to be done
for unit tests to keep passing.
Change-Id: I66c8a2eb7e5617f2fed96c689cb4ebc024ef9853
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/graphicshelpers')
-rw-r--r-- | src/render/graphicshelpers/graphicshelpergl2.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/render/graphicshelpers/graphicshelpergl2.cpp b/src/render/graphicshelpers/graphicshelpergl2.cpp index a4f5dd856..001176cd4 100644 --- a/src/render/graphicshelpers/graphicshelpergl2.cpp +++ b/src/render/graphicshelpers/graphicshelpergl2.cpp @@ -178,6 +178,7 @@ QVector<ShaderUniform> GraphicsHelperGL2::programUniformsAndLocations(GLuint pro uniformName[sizeof(uniformName) - 1] = '\0'; uniform.m_location = m_funcs->glGetUniformLocation(programId, uniformName); uniform.m_name = QString::fromUtf8(uniformName, uniformNameLength); + uniform.m_rawByteSize = uniformByteSize(uniform); uniforms.append(uniform); } return uniforms; @@ -460,14 +461,38 @@ uint GraphicsHelperGL2::uniformByteSize(const ShaderUniform &description) rawByteSize = matrixStride ? 2 * matrixStride : 16; break; + case GL_FLOAT_MAT2x4: + rawByteSize = matrixStride ? 2 * matrixStride : 32; + break; + + case GL_FLOAT_MAT4x2: + rawByteSize = matrixStride ? 4 * matrixStride : 32; + break; + case GL_FLOAT_MAT3: rawByteSize = matrixStride ? 3 * matrixStride : 36; break; + case GL_FLOAT_MAT2x3: + rawByteSize = matrixStride ? 2 * matrixStride : 24; + break; + + case GL_FLOAT_MAT3x2: + rawByteSize = matrixStride ? 3 * matrixStride : 24; + break; + case GL_FLOAT_MAT4: rawByteSize = matrixStride ? 4 * matrixStride : 64; break; + case GL_FLOAT_MAT4x3: + rawByteSize = matrixStride ? 4 * matrixStride : 48; + break; + + case GL_FLOAT_MAT3x4: + rawByteSize = matrixStride ? 3 * matrixStride : 48; + break; + case GL_BOOL: rawByteSize = 1; break; |