From a0a582dd04cc643619eb7d071e4f310b6e96d490 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Mon, 20 Mar 2017 09:52:18 +0100 Subject: [PATCH] Do not emit interpolation qualifiers to static globals. --- reference/shaders-hlsl/vert/qualifiers.vert | 8 ++++---- spirv_hlsl.cpp | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/reference/shaders-hlsl/vert/qualifiers.vert b/reference/shaders-hlsl/vert/qualifiers.vert index 43d49b1b..16dcbc80 100644 --- a/reference/shaders-hlsl/vert/qualifiers.vert +++ b/reference/shaders-hlsl/vert/qualifiers.vert @@ -1,8 +1,8 @@ static float4 gl_Position; -static nointerpolation float vFlat; -static centroid float vCentroid; -static sample float vSample; -static noperspective float vNoperspective; +static float vFlat; +static float vCentroid; +static float vSample; +static float vNoperspective; struct Block { diff --git a/spirv_hlsl.cpp b/spirv_hlsl.cpp index ad61e97b..0016bd33 100644 --- a/spirv_hlsl.cpp +++ b/spirv_hlsl.cpp @@ -131,7 +131,14 @@ void CompilerHLSL::emit_header() void CompilerHLSL::emit_interface_block_globally(const SPIRVariable &var) { add_resource_name(var.self); + + // The global copies of I/O variables should not contain interpolation qualifiers. + // These are emitted inside the interface structs. + auto &flags = meta[var.self].decoration.decoration_flags; + auto old_flags = flags; + flags = 0; statement("static ", variable_decl(var), ";"); + flags = old_flags; } const char *CompilerHLSL::to_storage_qualifiers_glsl(const SPIRVariable &var)