summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-03-21 15:22:10 -0700
committerJason Ekstrand <[email protected]>2017-05-03 11:25:46 -0700
commitbb41d9a1d30c243b8690165cd465c53517c6a35d (patch)
tree0eb82dba200451d632bdd273b76f97b115c5f8d4 /src
parentfcf941068e67ca0483dc453dd27992e2cd27ea21 (diff)
compiler: Add a system value and varying for ViewIndex
Reviewed-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir.c4
-rw-r--r--src/compiler/nir/nir_intrinsics.h1
-rw-r--r--src/compiler/shader_enums.c2
-rw-r--r--src/compiler/shader_enums.h4
-rw-r--r--src/mesa/program/prog_print.c2
5 files changed, 13 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 0abf9b6212e..8f7ed8a50f6 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -1905,6 +1905,8 @@ 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_VIEW_INDEX:
+ return nir_intrinsic_load_view_index;
default:
unreachable("system value does not directly correspond to intrinsic");
}
@@ -1956,6 +1958,8 @@ 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_view_index:
+ return SYSTEM_VALUE_VIEW_INDEX;
default:
unreachable("intrinsic doesn't produce a system value");
}
diff --git a/src/compiler/nir/nir_intrinsics.h b/src/compiler/nir/nir_intrinsics.h
index 3a519a73ddd..21e7d904b78 100644
--- a/src/compiler/nir/nir_intrinsics.h
+++ b/src/compiler/nir/nir_intrinsics.h
@@ -329,6 +329,7 @@ SYSTEM_VALUE(helper_invocation, 1, 0, xx, xx, xx)
SYSTEM_VALUE(channel_num, 1, 0, xx, xx, xx)
SYSTEM_VALUE(alpha_ref_float, 1, 0, xx, xx, xx)
SYSTEM_VALUE(layer_id, 1, 0, xx, xx, xx)
+SYSTEM_VALUE(view_index, 1, 0, xx, xx, xx)
/* Blend constant color values. Float values are clamped. */
SYSTEM_VALUE(blend_const_color_r_float, 1, 0, xx, xx, xx)
diff --git a/src/compiler/shader_enums.c b/src/compiler/shader_enums.c
index ca62cdaf500..b2ca80b49c2 100644
--- a/src/compiler/shader_enums.c
+++ b/src/compiler/shader_enums.c
@@ -162,6 +162,7 @@ gl_varying_slot_name(gl_varying_slot slot)
ENUM(VARYING_SLOT_TESS_LEVEL_INNER),
ENUM(VARYING_SLOT_BOUNDING_BOX0),
ENUM(VARYING_SLOT_BOUNDING_BOX1),
+ ENUM(VARYING_SLOT_VIEW_INDEX),
ENUM(VARYING_SLOT_VAR0),
ENUM(VARYING_SLOT_VAR1),
ENUM(VARYING_SLOT_VAR2),
@@ -232,6 +233,7 @@ gl_system_value_name(gl_system_value sysval)
ENUM(SYSTEM_VALUE_GLOBAL_INVOCATION_ID),
ENUM(SYSTEM_VALUE_WORK_GROUP_ID),
ENUM(SYSTEM_VALUE_NUM_WORK_GROUPS),
+ ENUM(SYSTEM_VALUE_VIEW_INDEX),
ENUM(SYSTEM_VALUE_VERTEX_CNT),
};
STATIC_ASSERT(ARRAY_SIZE(names) == SYSTEM_VALUE_MAX);
diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h
index 930d99748e7..07db4767f86 100644
--- a/src/compiler/shader_enums.h
+++ b/src/compiler/shader_enums.h
@@ -217,6 +217,7 @@ typedef enum
VARYING_SLOT_TESS_LEVEL_INNER, /* Only appears as TCS output. */
VARYING_SLOT_BOUNDING_BOX0, /* Only appears as TCS output. */
VARYING_SLOT_BOUNDING_BOX1, /* Only appears as TCS output. */
+ VARYING_SLOT_VIEW_INDEX,
VARYING_SLOT_VAR0, /* First generic varying slot */
/* the remaining are simply for the benefit of gl_varying_slot_name()
* and not to be construed as an upper bound:
@@ -535,6 +536,9 @@ typedef enum
SYSTEM_VALUE_LOCAL_GROUP_SIZE,
/*@}*/
+ /** Required for VK_KHX_multiview */
+ SYSTEM_VALUE_VIEW_INDEX,
+
/**
* Driver internal vertex-count, used (for example) for drivers to
* calculate stride for stream-out outputs. Not externally visible.
diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c
index 6d04a382865..b32ce150da3 100644
--- a/src/mesa/program/prog_print.c
+++ b/src/mesa/program/prog_print.c
@@ -153,6 +153,7 @@ arb_input_attrib_string(GLuint index, GLenum progType)
"fragment.(twenty-seven)", /* VARYING_SLOT_CULL_DIST1 */
"fragment.(twenty-eight)", /* VARYING_SLOT_BOUNDING_BOX0 */
"fragment.(twenty-nine)", /* VARYING_SLOT_BOUNDING_BOX1 */
+ "fragment.(thirty)", /* VARYING_SLOT_VIEW_INDEX */
"fragment.varying[0]",
"fragment.varying[1]",
"fragment.varying[2]",
@@ -284,6 +285,7 @@ arb_output_attrib_string(GLuint index, GLenum progType)
"result.(twenty-seven)", /* VARYING_SLOT_CULL_DIST1 */
"result.(twenty-eight)", /* VARYING_SLOT_BOUNDING_BOX0 */
"result.(twenty-nine)", /* VARYING_SLOT_BOUNDING_BOX1 */
+ "result.(thirty)", /* VARYING_SLOT_VIEW_INDEX */
"result.varying[0]",
"result.varying[1]",
"result.varying[2]",