summaryrefslogtreecommitdiffstats
path: root/src/render/renderers
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2018-12-20 15:25:13 +0000
committerMike Krus <mike.krus@kdab.com>2019-01-09 14:30:14 +0000
commit82eb8b44e0a3d1dc586acc52132be2b05102900c (patch)
tree7bec340b449352c43ae604322c0631dd2b59b426 /src/render/renderers
parent9d61881e4bcaebd6f98e647163f1df6b5082a6a8 (diff)
Fix env-map less rendering
Assign texture units to env map samplers even if they are not used. Remove previous work around from pbr material. Change-Id: I5060bfb61c4658339d2b74df71574c39cddfeb18 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/render/renderers')
-rw-r--r--src/render/renderers/opengl/renderer/renderview.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/render/renderers/opengl/renderer/renderview.cpp b/src/render/renderers/opengl/renderer/renderview.cpp
index 66299e430..8e0c16938 100644
--- a/src/render/renderers/opengl/renderer/renderview.cpp
+++ b/src/render/renderers/opengl/renderer/renderview.cpp
@@ -1060,6 +1060,13 @@ void RenderView::setShaderAndUniforms(RenderCommand *command,
setDefaultUniformBlockShaderDataValue(command->m_parameterPack, shader, shaderData, QStringLiteral("envLight"));
envLightCount = 1;
}
+ } else {
+ // with some drivers, samplers (like the envbox sampler) need to be bound even though
+ // they may not be actually used, otherwise draw calls can fail
+ static const int irradianceId = StringToInt::lookupId(QLatin1String("envLight.irradiance"));
+ static const int specularId = StringToInt::lookupId(QLatin1String("envLight.specular"));
+ setUniformValue(command->m_parameterPack, irradianceId, m_renderer->submissionContext()->maxTextureUnitsCount());
+ setUniformValue(command->m_parameterPack, specularId, m_renderer->submissionContext()->maxTextureUnitsCount());
}
setUniformValue(command->m_parameterPack, StringToInt::lookupId(QStringLiteral("envLightCount")), envLightCount);
}