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>2020-08-20 17:22:48 +0300
committerHans-Kristian Arntzen <post@arntzen-software.no>2020-08-20 17:22:48 +0300
commitfdbc80d13158e88b33a6765ae57b661a813b4a2c (patch)
tree7240fc10cbe7da26ac41536a425687aae5ef0dcf /spirv_hlsl.cpp
parent4c7944bb4260ab0466817c932a9673b6cf59438e (diff)
HLSL: Fix FragCoord.w.
Need to invert it, SM 4.0+ uses W, not 1/W (like Vulkan/GL).
Diffstat (limited to 'spirv_hlsl.cpp')
-rw-r--r--spirv_hlsl.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/spirv_hlsl.cpp b/spirv_hlsl.cpp
index 7a33559a..51b3dd48 100644
--- a/spirv_hlsl.cpp
+++ b/spirv_hlsl.cpp
@@ -2396,7 +2396,11 @@ void CompilerHLSL::emit_hlsl_entry_point()
if (legacy)
statement(builtin, " = stage_input.", builtin, " + float4(0.5f, 0.5f, 0.0f, 0.0f);");
else
+ {
statement(builtin, " = stage_input.", builtin, ";");
+ // ZW are undefined in D3D9, only do this fixup here.
+ statement(builtin, ".w = 1.0 / ", builtin, ".w;");
+ }
break;
case BuiltInVertexId: