diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-09-12 22:02:05 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-09-14 20:41:42 +0200 |
commit | d7d0f4d5a09d23488d4905bd5ae6b3e0f04d17a9 (patch) | |
tree | 684cded7f3fdcffd46b8ba1a0d42b78b7fff6462 /src/gui/rhi/qrhigles2_p_p.h | |
parent | 02d5566d681697844206c6f035d8fecc9c31e748 (diff) |
rhi: gl: Eliminate duplicate glUniform calls
This can happen when there is a uniform block in the Vulkan
shader with an instance name, both in the vertex and fragment
shader. The members are mapped to members of a struct uniform
in GLSL since we do not use uniform buffers there.
Now if there is, for example, "ubuf.opacity" both in the vertex and
fragment shader reflection info, then it's still just one single
uniform in the GL program, using one location. Registering it twice
in our 'uniforms' list is harmless, but wasteful, since it means the
uniform value will be set twice upon each setShaderResources().
Change-Id: Ib646eaec333522560d631b3b81800ef610f09319
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhigles2_p_p.h')
-rw-r--r-- | src/gui/rhi/qrhigles2_p_p.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/rhi/qrhigles2_p_p.h b/src/gui/rhi/qrhigles2_p_p.h index 93c8f82f8d..9392254a78 100644 --- a/src/gui/rhi/qrhigles2_p_p.h +++ b/src/gui/rhi/qrhigles2_p_p.h @@ -813,9 +813,11 @@ public: bool linkProgram(GLuint program); void registerUniformIfActive(const QShaderDescription::BlockVariable &var, const QByteArray &namePrefix, int binding, int baseOffset, - GLuint program, QGles2UniformDescriptionVector *dst); + GLuint program, + QSet<int> *activeUniformLocations, + QGles2UniformDescriptionVector *dst); void gatherUniforms(GLuint program, const QShaderDescription::UniformBlock &ub, - QGles2UniformDescriptionVector *dst); + QSet<int> *activeUniformLocations, QGles2UniformDescriptionVector *dst); void gatherSamplers(GLuint program, const QShaderDescription::InOutVariable &v, QGles2SamplerDescriptionVector *dst); bool isProgramBinaryDiskCacheEnabled() const; |