From 1ae30e5775ba2eb611ac5445a75409d852e91c2e Mon Sep 17 00:00:00 2001 From: Triang3l Date: Wed, 1 Aug 2018 16:17:48 +0300 Subject: [PATCH] [D3D12] Don't add .xyzw swizzle to stores --- src/xenia/gpu/hlsl_shader_translator.cc | 34 +++++++++++++++---------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/xenia/gpu/hlsl_shader_translator.cc b/src/xenia/gpu/hlsl_shader_translator.cc index 4850686d8..8e51a7b21 100644 --- a/src/xenia/gpu/hlsl_shader_translator.cc +++ b/src/xenia/gpu/hlsl_shader_translator.cc @@ -742,16 +742,21 @@ void HlslShaderTranslator::EmitStoreResult(const InstructionResult& result, } } else { bool has_const_writes = false; - uint32_t component_write_count = 0; - EmitSource("."); - for (uint32_t i = 0; i < 4; ++i) { - if (result.write_mask[i]) { - if (result.components[i] == SwizzleSource::k0 || - result.components[i] == SwizzleSource::k1) { - has_const_writes = true; + uint32_t component_write_count; + if (result.is_standard_swizzle()) { + component_write_count = 4; + } else { + component_write_count = 0; + EmitSource("."); + for (uint32_t i = 0; i < 4; ++i) { + if (result.write_mask[i]) { + if (result.components[i] == SwizzleSource::k0 || + result.components[i] == SwizzleSource::k1) { + has_const_writes = true; + } + ++component_write_count; + EmitSource("%c", GetCharForSwizzle(GetSwizzleFromComponentIndex(i))); } - ++component_write_count; - EmitSource("%c", GetCharForSwizzle(GetSwizzleFromComponentIndex(i))); } } EmitSource(" = "); @@ -802,10 +807,13 @@ void HlslShaderTranslator::EmitStoreResult(const InstructionResult& result, } } } else { - EmitSource("xe_pv."); - for (uint32_t i = 0; i < 4; ++i) { - if (result.write_mask[i]) { - EmitSource("%c", GetCharForSwizzle(result.components[i])); + EmitSource("xe_pv"); + if (!result.is_standard_swizzle()) { + EmitSource("."); + for (uint32_t i = 0; i < 4; ++i) { + if (result.write_mask[i]) { + EmitSource("%c", GetCharForSwizzle(result.components[i])); + } } } }