summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Kristian Arntzen <post@arntzen-software.no>2023-08-17 13:50:22 +0200
committerGitHub <noreply@github.com>2023-08-17 13:50:22 +0200
commite7e2e8cef023d2667e58e32a8adfe58e050fe822 (patch)
tree43b7bf04c0a1d5b7d2b74239f3fe18d1ed54976b
parent62664e421bbaff7c04f8f9aa1a882c2d21eefa5c (diff)
parent5ffc813dc424e338c295363a79ca5711874bacf6 (diff)
downloadSPIRV-Cross-e7e2e8cef023d2667e58e32a8adfe58e050fe822.tar.gz
SPIRV-Cross-e7e2e8cef023d2667e58e32a8adfe58e050fe822.tar.bz2
SPIRV-Cross-e7e2e8cef023d2667e58e32a8adfe58e050fe822.zip
Merge pull request #2185 from KhronosGroup/perprimitive-fix
GLSL: Require mesh shader when using perprimitiveEXT in frag shader.
-rw-r--r--reference/shaders-no-opt/frag/mesh-shader-perprimitive.spv14.nocompat.vk.frag.vk11
-rw-r--r--shaders-no-opt/frag/mesh-shader-perprimitive.spv14.nocompat.vk.frag10
-rw-r--r--spirv_glsl.cpp5
3 files changed, 25 insertions, 1 deletions
diff --git a/reference/shaders-no-opt/frag/mesh-shader-perprimitive.spv14.nocompat.vk.frag.vk b/reference/shaders-no-opt/frag/mesh-shader-perprimitive.spv14.nocompat.vk.frag.vk
new file mode 100644
index 00000000..7ab0e950
--- /dev/null
+++ b/reference/shaders-no-opt/frag/mesh-shader-perprimitive.spv14.nocompat.vk.frag.vk
@@ -0,0 +1,11 @@
+#version 450
+#extension GL_EXT_mesh_shader : require
+
+layout(location = 0) out vec4 FragColor;
+layout(location = 0) flat perprimitiveEXT in uvec4 v;
+
+void main()
+{
+ FragColor = vec4(v);
+}
+
diff --git a/shaders-no-opt/frag/mesh-shader-perprimitive.spv14.nocompat.vk.frag b/shaders-no-opt/frag/mesh-shader-perprimitive.spv14.nocompat.vk.frag
new file mode 100644
index 00000000..8dffccc2
--- /dev/null
+++ b/shaders-no-opt/frag/mesh-shader-perprimitive.spv14.nocompat.vk.frag
@@ -0,0 +1,10 @@
+#version 450
+#extension GL_EXT_mesh_shader : require
+
+layout(location = 0) perprimitiveEXT flat in uvec4 v;
+layout(location = 0) out vec4 FragColor;
+
+void main()
+{
+ FragColor = vec4(v);
+}
diff --git a/spirv_glsl.cpp b/spirv_glsl.cpp
index 690bc9d3..09d019bd 100644
--- a/spirv_glsl.cpp
+++ b/spirv_glsl.cpp
@@ -1295,7 +1295,10 @@ string CompilerGLSL::to_interpolation_qualifiers(const Bitset &flags)
if (flags.get(DecorationInvariant) && (options.es || options.version >= 120))
res += "invariant ";
if (flags.get(DecorationPerPrimitiveEXT))
- res += "perprimitiveEXT ";
+ {
+ res += "perprimitiveEXT ";
+ require_extension_internal("GL_EXT_mesh_shader");
+ }
if (flags.get(DecorationExplicitInterpAMD))
{