aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/ff_fragment_shader.cpp
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2015-10-08 11:13:00 -0700
committerIan Romanick <[email protected]>2015-10-12 10:15:13 -0700
commit8acce5d53af44a3d1d05a26e69559fd35f835de4 (patch)
treeeb4644073a2e1e938a34a74efc07527ec529b11a /src/mesa/main/ff_fragment_shader.cpp
parent43b07eb60faba1c65fc6f7a99087d051b00e9c0f (diff)
ff_fragment_shader: Use binding to set the sampler unit
This is the way layout(binding=xxx) works from GLSL. The old method just happened to work (and significantly predated support for layout(binding=xxx)), but future changes will break this. v2: Remove some stale comments. Suggested by Matt and Chris Forbes. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Cc: "10.6 11.0" <[email protected]>
Diffstat (limited to 'src/mesa/main/ff_fragment_shader.cpp')
-rw-r--r--src/mesa/main/ff_fragment_shader.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index e4e2a18c1da..aad726689cc 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -975,13 +975,11 @@ static void load_texture( texenv_fragment_program *p, GLuint unit )
ir_var_uniform);
p->top_instructions->push_head(sampler);
- /* Set the texture unit for this sampler. The linker will pick this value
- * up and do-the-right-thing.
- *
- * NOTE: The cast to int is important. Without it, the constant will have
- * type uint, and things later on may get confused.
+ /* Set the texture unit for this sampler in the same way that
+ * layout(binding=X) would.
*/
- sampler->constant_value = new(p->mem_ctx) ir_constant(int(unit));
+ sampler->data.explicit_binding = true;
+ sampler->data.binding = unit;
deref = new(p->mem_ctx) ir_dereference_variable(sampler);
tex->set_sampler(deref, glsl_type::vec4_type);