nir: Add new variable modes for ray-tracing

If we were desperate to reduce bits, we could probably also use
shader_in/out for hit attributes as they really are an output from
intersection shaders and read-only in any-hit and closest-hit shaders.
However, other passes such as nir_gether_info like to assume that
anything with nir_var_shader_in/out is indexed using vec4 locations for
interface matching.  It's easier to just add a new variable mode.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6479>
This commit is contained in:
Jason Ekstrand
2020-07-29 14:00:29 -05:00
committed by Marge Bot
parent aa4ea9c7ea
commit 84a8ca1db8
6 changed files with 33 additions and 5 deletions

View File

@@ -1551,6 +1551,14 @@ nir_validate_shader(nir_shader *shader, const char *when)
nir_var_mem_push_const |
nir_var_mem_constant;
if (gl_shader_stage_is_callable(shader->info.stage))
valid_modes |= nir_var_shader_call_data;
if (shader->info.stage == MESA_SHADER_ANY_HIT ||
shader->info.stage == MESA_SHADER_CLOSEST_HIT ||
shader->info.stage == MESA_SHADER_INTERSECTION)
valid_modes |= nir_var_ray_hit_attrib;
exec_list_validate(&shader->variables);
nir_foreach_variable_in_shader(var, shader)
validate_var_decl(var, valid_modes, &state);