compiler: Add color system value

This is nice to have with radeonsi, where color varyings are handled
specially to avoid recompiles.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Connor Abbott
2019-05-27 17:48:42 +02:00
parent 118a66df99
commit e5536aa584
4 changed files with 18 additions and 0 deletions

View File

@@ -1848,6 +1848,10 @@ nir_intrinsic_from_system_value(gl_system_value val)
return nir_intrinsic_load_patch_vertices_in; return nir_intrinsic_load_patch_vertices_in;
case SYSTEM_VALUE_HELPER_INVOCATION: case SYSTEM_VALUE_HELPER_INVOCATION:
return nir_intrinsic_load_helper_invocation; return nir_intrinsic_load_helper_invocation;
case SYSTEM_VALUE_COLOR0:
return nir_intrinsic_load_color0;
case SYSTEM_VALUE_COLOR1:
return nir_intrinsic_load_color1;
case SYSTEM_VALUE_VIEW_INDEX: case SYSTEM_VALUE_VIEW_INDEX:
return nir_intrinsic_load_view_index; return nir_intrinsic_load_view_index;
case SYSTEM_VALUE_SUBGROUP_SIZE: case SYSTEM_VALUE_SUBGROUP_SIZE:
@@ -1933,6 +1937,10 @@ nir_system_value_from_intrinsic(nir_intrinsic_op intrin)
return SYSTEM_VALUE_VERTICES_IN; return SYSTEM_VALUE_VERTICES_IN;
case nir_intrinsic_load_helper_invocation: case nir_intrinsic_load_helper_invocation:
return SYSTEM_VALUE_HELPER_INVOCATION; return SYSTEM_VALUE_HELPER_INVOCATION;
case nir_intrinsic_load_color0:
return SYSTEM_VALUE_COLOR0;
case nir_intrinsic_load_color1:
return SYSTEM_VALUE_COLOR1;
case nir_intrinsic_load_view_index: case nir_intrinsic_load_view_index:
return SYSTEM_VALUE_VIEW_INDEX; return SYSTEM_VALUE_VIEW_INDEX;
case nir_intrinsic_load_subgroup_size: case nir_intrinsic_load_subgroup_size:

View File

@@ -594,6 +594,12 @@ system_value("blend_const_color_rgba", 4)
system_value("blend_const_color_rgba8888_unorm", 1) system_value("blend_const_color_rgba8888_unorm", 1)
system_value("blend_const_color_aaaa8888_unorm", 1) system_value("blend_const_color_aaaa8888_unorm", 1)
# System values for gl_Color, for radeonsi which interpolates these in the
# shader prolog to handle two-sided color without recompiles and therefore
# doesn't handle these in the main shader part like normal varyings.
system_value("color0", 4)
system_value("color1", 4)
# Barycentric coordinate intrinsics. # Barycentric coordinate intrinsics.
# #
# These set up the barycentric coordinates for a particular interpolation. # These set up the barycentric coordinates for a particular interpolation.

View File

@@ -231,6 +231,8 @@ gl_system_value_name(gl_system_value sysval)
ENUM(SYSTEM_VALUE_SAMPLE_POS), ENUM(SYSTEM_VALUE_SAMPLE_POS),
ENUM(SYSTEM_VALUE_SAMPLE_MASK_IN), ENUM(SYSTEM_VALUE_SAMPLE_MASK_IN),
ENUM(SYSTEM_VALUE_HELPER_INVOCATION), ENUM(SYSTEM_VALUE_HELPER_INVOCATION),
ENUM(SYSTEM_VALUE_COLOR0),
ENUM(SYSTEM_VALUE_COLOR1),
ENUM(SYSTEM_VALUE_TESS_COORD), ENUM(SYSTEM_VALUE_TESS_COORD),
ENUM(SYSTEM_VALUE_VERTICES_IN), ENUM(SYSTEM_VALUE_VERTICES_IN),
ENUM(SYSTEM_VALUE_PRIMITIVE_ID), ENUM(SYSTEM_VALUE_PRIMITIVE_ID),

View File

@@ -580,6 +580,8 @@ typedef enum
SYSTEM_VALUE_SAMPLE_POS, SYSTEM_VALUE_SAMPLE_POS,
SYSTEM_VALUE_SAMPLE_MASK_IN, SYSTEM_VALUE_SAMPLE_MASK_IN,
SYSTEM_VALUE_HELPER_INVOCATION, SYSTEM_VALUE_HELPER_INVOCATION,
SYSTEM_VALUE_COLOR0,
SYSTEM_VALUE_COLOR1,
/*@}*/ /*@}*/
/** /**