summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorConnor Abbott <[email protected]>2019-05-27 17:48:42 +0200
committerConnor Abbott <[email protected]>2019-07-08 14:18:34 +0200
commite5536aa584e91d2a859c2f905d9ce40fc410470b (patch)
treeda23a47a2f5c32c565f1e6dbe9acb34c0c988819 /src
parent118a66df9907772bb9e5503b736c95d7bb62d52c (diff)
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 <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir.c8
-rw-r--r--src/compiler/nir/nir_intrinsics.py6
-rw-r--r--src/compiler/shader_enums.c2
-rw-r--r--src/compiler/shader_enums.h2
4 files changed, 18 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 81f569b4c2b..4f2da2d431f 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -1848,6 +1848,10 @@ nir_intrinsic_from_system_value(gl_system_value val)
return nir_intrinsic_load_patch_vertices_in;
case SYSTEM_VALUE_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:
return nir_intrinsic_load_view_index;
case SYSTEM_VALUE_SUBGROUP_SIZE:
@@ -1933,6 +1937,10 @@ nir_system_value_from_intrinsic(nir_intrinsic_op intrin)
return SYSTEM_VALUE_VERTICES_IN;
case nir_intrinsic_load_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:
return SYSTEM_VALUE_VIEW_INDEX;
case nir_intrinsic_load_subgroup_size:
diff --git a/src/compiler/nir/nir_intrinsics.py b/src/compiler/nir/nir_intrinsics.py
index 24bb0990805..70ff1b99de0 100644
--- a/src/compiler/nir/nir_intrinsics.py
+++ b/src/compiler/nir/nir_intrinsics.py
@@ -594,6 +594,12 @@ system_value("blend_const_color_rgba", 4)
system_value("blend_const_color_rgba8888_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.
#
# These set up the barycentric coordinates for a particular interpolation.
diff --git a/src/compiler/shader_enums.c b/src/compiler/shader_enums.c
index 451f1b758de..f7613cf01a2 100644
--- a/src/compiler/shader_enums.c
+++ b/src/compiler/shader_enums.c
@@ -231,6 +231,8 @@ gl_system_value_name(gl_system_value sysval)
ENUM(SYSTEM_VALUE_SAMPLE_POS),
ENUM(SYSTEM_VALUE_SAMPLE_MASK_IN),
ENUM(SYSTEM_VALUE_HELPER_INVOCATION),
+ ENUM(SYSTEM_VALUE_COLOR0),
+ ENUM(SYSTEM_VALUE_COLOR1),
ENUM(SYSTEM_VALUE_TESS_COORD),
ENUM(SYSTEM_VALUE_VERTICES_IN),
ENUM(SYSTEM_VALUE_PRIMITIVE_ID),
diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h
index cf753df3791..4d5af8a815b 100644
--- a/src/compiler/shader_enums.h
+++ b/src/compiler/shader_enums.h
@@ -580,6 +580,8 @@ typedef enum
SYSTEM_VALUE_SAMPLE_POS,
SYSTEM_VALUE_SAMPLE_MASK_IN,
SYSTEM_VALUE_HELPER_INVOCATION,
+ SYSTEM_VALUE_COLOR0,
+ SYSTEM_VALUE_COLOR1,
/*@}*/
/**