summaryrefslogtreecommitdiffstats
path: root/src/render/graphicshelpers/graphicscontext.cpp
diff options
context:
space:
mode:
authorMauro Persano <mauro.persano@kdab.com>2017-10-18 08:23:19 -0200
committerMauro Persano <mauro.persano@kdab.com>2018-02-02 10:30:33 +0000
commit96ce1288ba0bbc4682637712122da6adb1ee6eaf (patch)
treeaac1ed5f748400df64a2cc2fb88db42daf09de5e /src/render/graphicshelpers/graphicscontext.cpp
parent8fa23602cff47de6d19d05a8428a8e753bf73d61 (diff)
Fix array of textures in shader parameter
Task-number: QTBUG-61759 Change-Id: I2c61f9cf41124816d10da90783c7fb9ff6088fc4 Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src/render/graphicshelpers/graphicscontext.cpp')
-rw-r--r--src/render/graphicshelpers/graphicscontext.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp
index 0b6870c3a..64e7cffa4 100644
--- a/src/render/graphicshelpers/graphicscontext.cpp
+++ b/src/render/graphicshelpers/graphicscontext.cpp
@@ -1185,7 +1185,7 @@ bool GraphicsContext::setParameters(ShaderParameterPack &parameterPack)
UniformValue &texUniform = uniformValues[namedTex.glslNameId];
Q_ASSERT(texUniform.valueType() == UniformValue::TextureValue);
const int texUnit = activateTexture(TextureScopeMaterial, t);
- texUniform.data<UniformValue::Texture>()->textureId = texUnit;
+ texUniform.data<int>()[namedTex.uniformArrayIndex] = texUnit;
// if the texture data from generators may not be available yet,
// make sure that the next frame is rendered
if (texUnit == -1)
@@ -1235,11 +1235,10 @@ bool GraphicsContext::setParameters(ShaderParameterPack &parameterPack)
for (const ShaderUniform &uniform : activeUniforms) {
// We can use [] as we are sure the the uniform wouldn't
// be un activeUniforms if there wasn't a matching value
- const auto &v = values[uniform.m_nameId];
+ const UniformValue &v = values[uniform.m_nameId];
// skip invalid textures
- if (v.valueType() == UniformValue::TextureValue &&
- v.constData<UniformValue::Texture>()->textureId == -1)
+ if (v.valueType() == UniformValue::TextureValue && *v.constData<int>() == -1)
continue;
applyUniform(uniform, v);