On Tue, Nov 10, 2015 at 5:02 PM, Connor Abbott <[email protected]> wrote: > On Tue, Nov 10, 2015 at 7:49 PM, Jason Ekstrand <[email protected]> wrote: >> On Tue, Nov 10, 2015 at 4:18 PM, Connor Abbott <[email protected]> wrote: >>> Since subroutine types are really just integers, should we just make >>> glsl_type_is_vector_or_scalar() return true for them? >> >> That's an interesting question. It entirely depends on whether >> glsl_type_is_vector_or_scalar is a NIR thing or not. If it's a NIR >> thing, then sure, makes perfect sense. If it's C API for glsl_type, >> then no, that doesn't make sense. I'd tend to go with C API >> personally. >> --Jason > > Well, it's not just a NIR thing -- GLSL IR also effectively treats > subroutines as integers. Actually, I wonder why the > glsl_type::is_vector_or_scalar() doesn't return true for subroutine > types in the first place.
For that matter, why do we have a special subroutine type at all? Why doesn't the GLSL lowering pass create regular uint uniforms? I don't know. --Jason >> >>> On Tue, Nov 10, 2015 at 5:18 PM, Jason Ekstrand <[email protected]> >>> wrote: >>>> The shader-subroutine code creates uniforms of type SUBROUTINE for >>>> subroutines that are then read as integers in the backends. If we ever >>>> want to do any optimizations on these, we'll need to come up with a better >>>> plan where they are actual scalars or something, but this works for now. >>>> >>>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92859 >>>> Cc: Mark Janes <[email protected]> >>>> --- >>>> src/glsl/nir/nir_validate.c | 8 ++++++-- >>>> 1 file changed, 6 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/src/glsl/nir/nir_validate.c b/src/glsl/nir/nir_validate.c >>>> index a42e830..51c2529 100644 >>>> --- a/src/glsl/nir/nir_validate.c >>>> +++ b/src/glsl/nir/nir_validate.c >>>> @@ -401,7 +401,9 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, >>>> validate_state *state) >>>> case nir_intrinsic_load_var: { >>>> const struct glsl_type *type = >>>> nir_deref_tail(&instr->variables[0]->deref)->type; >>>> - assert(glsl_type_is_vector_or_scalar(type)); >>>> + assert(glsl_type_is_vector_or_scalar(type) || >>>> + (instr->variables[0]->var->data.mode == nir_var_uniform && >>>> + glsl_get_base_type(type) == GLSL_TYPE_SUBROUTINE)); >>>> assert(instr->num_components == glsl_get_vector_elements(type)); >>>> assert(instr->variables[0]->var->data.mode != nir_var_shader_out); >>>> break; >>>> @@ -409,7 +411,9 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, >>>> validate_state *state) >>>> case nir_intrinsic_store_var: { >>>> const struct glsl_type *type = >>>> nir_deref_tail(&instr->variables[0]->deref)->type; >>>> - assert(glsl_type_is_vector_or_scalar(type)); >>>> + assert(glsl_type_is_vector_or_scalar(type) || >>>> + (instr->variables[0]->var->data.mode == nir_var_uniform && >>>> + glsl_get_base_type(type) == GLSL_TYPE_SUBROUTINE)); >>>> assert(instr->num_components == glsl_get_vector_elements(type)); >>>> assert(instr->variables[0]->var->data.mode != nir_var_shader_in && >>>> instr->variables[0]->var->data.mode != nir_var_uniform && >>>> -- >>>> 2.5.0.400.gff86faf >>>> >>>> _______________________________________________ >>>> mesa-dev mailing list >>>> [email protected] >>>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
