mesa: Add a new function for getting the nonconst sampler array index
If the array index is not a constant expression, the existing support will assume a zero offset (giving us the sampler index of the base of the array). For dynamically uniform indexing of sampler arrays, we need both that and the indexing expression. Signed-off-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
This commit is contained in:
parent
1b4761bc27
commit
3b48f6a4c0
|
@ -134,3 +134,14 @@ _mesa_get_sampler_uniform_value(class ir_dereference *sampler,
|
|||
return shader_program->UniformStorage[location].sampler[shader].index +
|
||||
getname.offset;
|
||||
}
|
||||
|
||||
|
||||
extern "C" class ir_rvalue *
|
||||
_mesa_get_sampler_array_nonconst_index(class ir_dereference *sampler)
|
||||
{
|
||||
ir_dereference_array *deref_arr = sampler->as_dereference_array();
|
||||
if (!deref_arr || deref_arr->array_index->as_constant())
|
||||
return NULL;
|
||||
|
||||
return deref_arr->array_index;
|
||||
}
|
||||
|
|
|
@ -27,3 +27,6 @@ int
|
|||
_mesa_get_sampler_uniform_value(class ir_dereference *sampler,
|
||||
struct gl_shader_program *shader_program,
|
||||
const struct gl_program *prog);
|
||||
|
||||
class ir_rvalue *
|
||||
_mesa_get_sampler_array_nonconst_index(class ir_dereference *sampler);
|
||||
|
|
Loading…
Reference in New Issue