compiler/nir: introduce a new helper to get varying name
As we now reuse the enums to remain within 64 values, we need to get the proper name using the stage. v2: Use enum type for parameter (Jason) Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7795>
This commit is contained in:

committed by
Marge Bot

parent
1c9488e0d1
commit
244514addd
@@ -538,18 +538,23 @@ print_var_decl(nir_variable *var, print_state *state)
|
|||||||
if (var->data.mode == nir_var_shader_in)
|
if (var->data.mode == nir_var_shader_in)
|
||||||
loc = gl_vert_attrib_name(var->data.location);
|
loc = gl_vert_attrib_name(var->data.location);
|
||||||
else if (var->data.mode == nir_var_shader_out)
|
else if (var->data.mode == nir_var_shader_out)
|
||||||
loc = gl_varying_slot_name(var->data.location);
|
loc = gl_varying_slot_name_for_stage(var->data.location,
|
||||||
|
state->shader->info.stage);
|
||||||
break;
|
break;
|
||||||
case MESA_SHADER_GEOMETRY:
|
case MESA_SHADER_GEOMETRY:
|
||||||
if ((var->data.mode == nir_var_shader_in) ||
|
if ((var->data.mode == nir_var_shader_in) ||
|
||||||
(var->data.mode == nir_var_shader_out))
|
(var->data.mode == nir_var_shader_out)) {
|
||||||
loc = gl_varying_slot_name(var->data.location);
|
loc = gl_varying_slot_name_for_stage(var->data.location,
|
||||||
|
state->shader->info.stage);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MESA_SHADER_FRAGMENT:
|
case MESA_SHADER_FRAGMENT:
|
||||||
if (var->data.mode == nir_var_shader_in)
|
if (var->data.mode == nir_var_shader_in) {
|
||||||
loc = gl_varying_slot_name(var->data.location);
|
loc = gl_varying_slot_name_for_stage(var->data.location,
|
||||||
else if (var->data.mode == nir_var_shader_out)
|
state->shader->info.stage);
|
||||||
|
} else if (var->data.mode == nir_var_shader_out) {
|
||||||
loc = gl_frag_result_name(var->data.location);
|
loc = gl_frag_result_name(var->data.location);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MESA_SHADER_TESS_CTRL:
|
case MESA_SHADER_TESS_CTRL:
|
||||||
case MESA_SHADER_TESS_EVAL:
|
case MESA_SHADER_TESS_EVAL:
|
||||||
|
@@ -227,6 +227,14 @@ gl_varying_slot_name(gl_varying_slot slot)
|
|||||||
return NAME(slot);
|
return NAME(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
gl_varying_slot_name_for_stage(gl_varying_slot slot, gl_shader_stage stage)
|
||||||
|
{
|
||||||
|
if (stage != MESA_SHADER_FRAGMENT && slot == VARYING_SLOT_PRIMITIVE_SHADING_RATE)
|
||||||
|
return "VARYING_SLOT_PRIMITIVE_SHADING_RATE";
|
||||||
|
return gl_varying_slot_name(slot);
|
||||||
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
gl_system_value_name(gl_system_value sysval)
|
gl_system_value_name(gl_system_value sysval)
|
||||||
{
|
{
|
||||||
|
@@ -333,6 +333,9 @@ typedef enum
|
|||||||
#define MAX_VARYINGS_INCL_PATCH (VARYING_SLOT_TESS_MAX - VARYING_SLOT_VAR0)
|
#define MAX_VARYINGS_INCL_PATCH (VARYING_SLOT_TESS_MAX - VARYING_SLOT_VAR0)
|
||||||
|
|
||||||
const char *gl_varying_slot_name(gl_varying_slot slot);
|
const char *gl_varying_slot_name(gl_varying_slot slot);
|
||||||
|
const char *gl_varying_slot_name_for_stage(gl_varying_slot slot,
|
||||||
|
gl_shader_stage stage);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bitflags for varying slots.
|
* Bitflags for varying slots.
|
||||||
|
Reference in New Issue
Block a user