aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/uniforms.c
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-04-21 17:04:10 +1000
committerTimothy Arceri <[email protected]>2017-04-22 10:01:15 +1000
commitd682f8aa8e0edd166166f87fcd774dd2d57b4180 (patch)
tree741869caba61db7d6d55f7ab9baa5b10cd86a955 /src/mesa/main/uniforms.c
parent918cec8cbeeac58b8d9092d6fc4aacb8490eb50c (diff)
mesa: validate sampler type across the whole program
Currently we were only making sure types were the same within a single stage. This looks to have regressed with 953a0af8e3f73. Fixes: 953a0af8e3f73 ("mesa: validate sampler uniforms during gluniform calls") Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> https://bugs.freedesktop.org/show_bug.cgi?id=97524
Diffstat (limited to 'src/mesa/main/uniforms.c')
-rw-r--r--src/mesa/main/uniforms.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index 59ae4c5dce2..8869b6eb22d 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -67,11 +67,15 @@ void
_mesa_update_shader_textures_used(struct gl_shader_program *shProg,
struct gl_program *prog)
{
- memset(prog->TexturesUsed, 0, sizeof(prog->TexturesUsed));
+ GLbitfield mask = prog->SamplersUsed;
+ gl_shader_stage prog_stage =
+ _mesa_program_enum_to_shader_stage(prog->Target);
+ struct gl_linked_shader *shader = shProg->_LinkedShaders[prog_stage];
- shProg->SamplersValidated = GL_TRUE;
+ assert(shader);
+
+ memset(prog->TexturesUsed, 0, sizeof(prog->TexturesUsed));
- GLbitfield mask = prog->SamplersUsed;
while (mask) {
const int s = u_bit_scan(&mask);
GLuint unit = prog->SamplerUnits[s];
@@ -87,8 +91,20 @@ _mesa_update_shader_textures_used(struct gl_shader_program *shProg,
* types pointing to the same texture image unit within a program
* object."
*/
- if (prog->TexturesUsed[unit] & ~(1 << tgt))
- shProg->SamplersValidated = GL_FALSE;
+ unsigned stages_mask = shProg->data->linked_stages;
+ while (stages_mask) {
+ const int stage = u_bit_scan(&stages_mask);
+
+ /* Skip validation if we are yet to update textures used in this
+ * stage.
+ */
+ if (prog_stage < stage)
+ break;
+
+ struct gl_program *glprog = shProg->_LinkedShaders[stage]->Program;
+ if (glprog->TexturesUsed[unit] & ~(1 << tgt))
+ shProg->SamplersValidated = GL_FALSE;
+ }
prog->TexturesUsed[unit] |= (1 << tgt);
}