diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2018-02-05 13:01:09 +0000 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2018-02-05 15:42:29 +0000 |
commit | 0403ee45736241aa621eb3d38880a4fff571fd96 (patch) | |
tree | 94650145a3b7e2517dfcf29d33f97859933b518d /src/render/graphicshelpers/graphicscontext.cpp | |
parent | 04afcf1cb9e79697360baa01a97a26815237eba1 (diff) | |
parent | ceae743678d41a58154612781e896c04c87a8c4f (diff) |
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
.qmake.conf
src/render/backend/trianglesvisitor.cpp
src/render/backend/uniform.cpp
src/render/jobs/calcboundingvolumejob.cpp
src/render/jobs/pickboundingvolumejob.cpp
src/render/jobs/pickboundingvolumeutils.cpp
Change-Id: Ib8305011c51710a3538c0b29f7022388f5244a38
Diffstat (limited to 'src/render/graphicshelpers/graphicscontext.cpp')
-rw-r--r-- | src/render/graphicshelpers/graphicscontext.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp index 298f6bf91..5c3128f30 100644 --- a/src/render/graphicshelpers/graphicscontext.cpp +++ b/src/render/graphicshelpers/graphicscontext.cpp @@ -499,14 +499,14 @@ void GraphicsContext::introspectShaderInterface(Shader *shader, QOpenGLShaderPro void GraphicsContext::loadShader(Shader *shader, ShaderManager *manager) { - QOpenGLShaderProgram *shaderProgram = m_shaderCache.getShaderProgramAndAddRef(shader->dna(), shader->peerId()); - if (!shaderProgram) { + bool wasPresent = false; + QOpenGLShaderProgram *shaderProgram = m_shaderCache.getShaderProgramAndAddRef(shader->dna(), shader->peerId(), &wasPresent); + if (!shaderProgram && !wasPresent) { // No matching QOpenGLShader in the cache so create one shaderProgram = createShaderProgram(shader); - // Store in cache - if (shaderProgram) - m_shaderCache.insert(shader->dna(), shader->peerId(), shaderProgram); + // Store in cache (even when failed and shaderProgram is null) + m_shaderCache.insert(shader->dna(), shader->peerId(), shaderProgram); } // Ensure the Shader node knows about the program interface @@ -1213,7 +1213,7 @@ bool GraphicsContext::setParameters(ShaderParameterPack ¶meterPack) 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) @@ -1263,11 +1263,10 @@ bool GraphicsContext::setParameters(ShaderParameterPack ¶meterPack) 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); |