Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Cross.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Kristian Arntzen <post@arntzen-software.no>2022-02-28 14:58:07 +0300
committerGitHub <noreply@github.com>2022-02-28 14:58:07 +0300
commitd16183d1d2ac7265c2a070b5a662e679169fc7de (patch)
tree46ce7ef89a59fff63febaf94a467c053686cf84d
parent02440e85cf751cea07cd92e4acf2bdd49d66443e (diff)
parent7af0a5f8202039c69acf6a4cf9e5850f4fe87eb1 (diff)
Merge pull request #1873 from KhronosGroup/fix-1861
HLSL: Do not emit VPOS fixup unless position is active.
-rw-r--r--reference/shaders-hlsl-no-opt/vert/empty-shader.sm30.vert8
-rw-r--r--shaders-hlsl-no-opt/vert/empty-shader.sm30.vert5
-rw-r--r--spirv_hlsl.cpp5
3 files changed, 16 insertions, 2 deletions
diff --git a/reference/shaders-hlsl-no-opt/vert/empty-shader.sm30.vert b/reference/shaders-hlsl-no-opt/vert/empty-shader.sm30.vert
new file mode 100644
index 00000000..103ff46a
--- /dev/null
+++ b/reference/shaders-hlsl-no-opt/vert/empty-shader.sm30.vert
@@ -0,0 +1,8 @@
+void vert_main()
+{
+}
+
+void main()
+{
+ vert_main();
+}
diff --git a/shaders-hlsl-no-opt/vert/empty-shader.sm30.vert b/shaders-hlsl-no-opt/vert/empty-shader.sm30.vert
new file mode 100644
index 00000000..0b8dbb5a
--- /dev/null
+++ b/shaders-hlsl-no-opt/vert/empty-shader.sm30.vert
@@ -0,0 +1,5 @@
+#version 450
+
+void main()
+{
+}
diff --git a/spirv_hlsl.cpp b/spirv_hlsl.cpp
index 51d4a1ca..6a7504cd 100644
--- a/spirv_hlsl.cpp
+++ b/spirv_hlsl.cpp
@@ -1335,7 +1335,8 @@ void CompilerHLSL::emit_resources()
}
});
- if (execution.model == ExecutionModelVertex && hlsl_options.shader_model <= 30)
+ if (execution.model == ExecutionModelVertex && hlsl_options.shader_model <= 30 &&
+ active_output_builtins.get(BuiltInPosition))
{
statement("uniform float4 gl_HalfPixel;");
emitted = true;
@@ -2739,7 +2740,7 @@ void CompilerHLSL::emit_hlsl_entry_point()
void CompilerHLSL::emit_fixup()
{
- if (is_vertex_like_shader())
+ if (is_vertex_like_shader() && active_output_builtins.get(BuiltInPosition))
{
// Do various mangling on the gl_Position.
if (hlsl_options.shader_model <= 30)