From f9920b285767bceb7b771df000742c277ac9da91 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Thu, 27 Aug 2020 11:07:31 +0200 Subject: 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 --- .../renderers/opengl/graphicshelpers/submissioncontext.cpp | 12 ++++++++---- 1 file 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 ¶meterPack, 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 ¶meterPack, GLShad texUniform.data()[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; } } -- cgit v1.2.3