mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 18:08:40 +02:00
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 <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 8acce5d53a)
This commit is contained in:
parent
cd6ff70856
commit
3b238aa08f
1 changed files with 4 additions and 6 deletions
|
|
@ -976,13 +976,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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue