summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2020-08-27 11:07:31 +0200
committerPaul Lemire <paul.lemire@kdab.com>2020-08-27 11:27:56 +0200
commitf9920b285767bceb7b771df000742c277ac9da91 (patch)
treeaab77e5fcf3a736db81cc5b205505a7733c1308c
parent07f6f8c835447088217b360a622126c516b485bf (diff)
opengl: add envlight texture alias to texture unit check
Since those uniforms are injected by Qt3D, them not being used by a shader is valid and shouldn't result in the function return false. This could otherwise prevent valid draw calls from being made Change-Id: I562cc40d758a174bf9d315a9ab0919ae55a0b04f Pick-to: 5.15 Pick-to: 5.12 Reviewed-by: Mike Krus <mike.krus@kdab.com>
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp
index 7e133ec5c..b7f59741c 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp
@@ -1218,8 +1218,10 @@ void SubmissionContext::setUpdatedTexture(const Qt3DCore::QNodeIdVector &updated
// than the other way around
bool SubmissionContext::setParameters(ShaderParameterPack &parameterPack, GLShader *shader)
{
- static const int irradianceId = StringToInt::lookupId(QLatin1String("envLight.irradiance"));
- static const int specularId = StringToInt::lookupId(QLatin1String("envLight.specular"));
+ static const int irradianceStructId = StringToInt::lookupId(QLatin1String("envLight.irradiance"));
+ static const int specularStructId = StringToInt::lookupId(QLatin1String("envLight.specular"));
+ static const int irradianceId = StringToInt::lookupId(QLatin1String("envLightIrradiance"));
+ static const int specularId = StringToInt::lookupId(QLatin1String("envLightSpecular"));
// Activate textures and update TextureUniform in the pack
// with the correct textureUnit
@@ -1243,9 +1245,11 @@ bool SubmissionContext::setParameters(ShaderParameterPack &parameterPack, GLShad
texUniform.data<int>()[namedTex.uniformArrayIndex] = texUnit;
if (texUnit == -1) {
if (namedTex.glslNameId != irradianceId &&
- namedTex.glslNameId != specularId) {
+ namedTex.glslNameId != specularId &&
+ namedTex.glslNameId != irradianceStructId &&
+ namedTex.glslNameId != specularStructId) {
// Only return false if we are not dealing with env light textures
- qCWarning(Backend) << "Unable to find suitable Texture Unit";
+ qCWarning(Backend) << "Unable to find suitable Texture Unit for" << StringToInt::lookupString(namedTex.glslNameId);
return false;
}
}