From f3267db1d82a68306bb40724c738a55c44df3b83 Mon Sep 17 00:00:00 2001 From: Chip Davis Date: Fri, 22 Feb 2019 15:26:00 -0600 Subject: [PATCH] MSL: Make sure we fix up the output position. If a stage takes the position as both an input and an output (i.e. a tessellation shader or a geometry shader), then we could wind up fixing up the input position by mistake. Ensure that doesn't happen, by only setting the `qual_pos_var_name` variable from the output position. --- spirv_msl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spirv_msl.cpp b/spirv_msl.cpp index 5489f7d3..b1ba9e1d 100644 --- a/spirv_msl.cpp +++ b/spirv_msl.cpp @@ -1165,7 +1165,7 @@ void CompilerMSL::add_plain_variable_to_interface_block(StorageClass storage, co if (is_builtin) { set_member_decoration(ib_type.self, ib_mbr_idx, DecorationBuiltIn, builtin); - if (builtin == BuiltInPosition) + if (builtin == BuiltInPosition && storage == StorageClassOutput) qual_pos_var_name = qual_var_name; } @@ -1572,7 +1572,7 @@ void CompilerMSL::add_plain_member_variable_to_interface_block(StorageClass stor if (is_builtin) { set_member_decoration(ib_type.self, ib_mbr_idx, DecorationBuiltIn, builtin); - if (builtin == BuiltInPosition) + if (builtin == BuiltInPosition && storage == StorageClassOutput) qual_pos_var_name = qual_var_name; }