From 0ce9fba0775ce82a0deecc68f3b9febdc57983e5 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 Reviewed-by: Mike Krus (cherry picked from commit f9920b285767bceb7b771df000742c277ac9da91) Reviewed-by: Qt Cherry-pick Bot --- .../renderers/opengl/graphicshelpers/submissioncontext.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp') diff --git a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp index cdd1cfeef..3ca0d6191 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp @@ -1186,8 +1186,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 @@ -1211,9 +1213,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