summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2017-08-22 10:08:36 -0700
committerIan Romanick <ian.d.romanick@intel.com>2018-03-29 14:16:11 -0700
commit5d5b8f53a3c3661a752f62f928c56484f3428031 (patch)
treec6e6d4d2296348539b9075e73e528a62e9da6ee9
parent42b68011330ec3dcfc59d4cacd5388acf8c493d2 (diff)
glsl/spirv: Emit GLSL geometry shader special input variables in SPIR-V
-rw-r--r--src/compiler/glsl/glsl_to_spirv.cpp3
-rw-r--r--src/compiler/glsl/tests/emit_spirv_variables_test.cpp11
2 files changed, 13 insertions, 1 deletions
diff --git a/src/compiler/glsl/glsl_to_spirv.cpp b/src/compiler/glsl/glsl_to_spirv.cpp
index 7234e17a61b..32e55d58fd8 100644
--- a/src/compiler/glsl/glsl_to_spirv.cpp
+++ b/src/compiler/glsl/glsl_to_spirv.cpp
@@ -511,7 +511,8 @@ _mesa_spirv_program::emit_variable(const ir_variable *var,
break;
case VARYING_SLOT_PRIMITIVE_ID:
- assert(stage == MESA_SHADER_FRAGMENT);
+ assert(stage == MESA_SHADER_FRAGMENT ||
+ stage == MESA_SHADER_GEOMETRY);
builtin = SpvBuiltInPrimitiveId;
break;
diff --git a/src/compiler/glsl/tests/emit_spirv_variables_test.cpp b/src/compiler/glsl/tests/emit_spirv_variables_test.cpp
index cda4acbfea1..b2aba3a1a06 100644
--- a/src/compiler/glsl/tests/emit_spirv_variables_test.cpp
+++ b/src/compiler/glsl/tests/emit_spirv_variables_test.cpp
@@ -185,6 +185,9 @@ validate_emit_variable::SetUp()
case MESA_SHADER_TESS_EVAL:
spv->capabilities.enable(SpvCapabilityTessellation);
break;
+ case MESA_SHADER_GEOMETRY:
+ spv->capabilities.enable(SpvCapabilityGeometry);
+ break;
default:
break;
}
@@ -638,6 +641,14 @@ validate_emit_fragment_variable::check_FragCoord(bool use_system_value,
}
}
+TEST_F(validate_emit_geometry_variable, input_gl_PrimitiveIDIn)
+{
+ check_builtin_input(shader_input(VARYING_SLOT_PRIMITIVE_ID,
+ glsl_type::int_type,
+ "gl_PrimitiveIDIn"),
+ 0x00000007);
+}
+
TEST_F(validate_emit_fragment_variable, input_gl_PrimitiveID)
{
spv->capabilities.enable(SpvCapabilityGeometry);