[D3D12] Don't add .xyzw swizzle to stores

This commit is contained in:
Triang3l 2018-08-01 16:17:48 +03:00
parent 2b482352d0
commit 1ae30e5775
1 changed files with 21 additions and 13 deletions

View File

@ -742,7 +742,11 @@ void HlslShaderTranslator::EmitStoreResult(const InstructionResult& result,
} }
} else { } else {
bool has_const_writes = false; bool has_const_writes = false;
uint32_t component_write_count = 0; uint32_t component_write_count;
if (result.is_standard_swizzle()) {
component_write_count = 4;
} else {
component_write_count = 0;
EmitSource("."); EmitSource(".");
for (uint32_t i = 0; i < 4; ++i) { for (uint32_t i = 0; i < 4; ++i) {
if (result.write_mask[i]) { if (result.write_mask[i]) {
@ -754,6 +758,7 @@ void HlslShaderTranslator::EmitStoreResult(const InstructionResult& result,
EmitSource("%c", GetCharForSwizzle(GetSwizzleFromComponentIndex(i))); EmitSource("%c", GetCharForSwizzle(GetSwizzleFromComponentIndex(i)));
} }
} }
}
EmitSource(" = "); EmitSource(" = ");
if (result.is_clamped) { if (result.is_clamped) {
EmitSource("saturate("); EmitSource("saturate(");
@ -802,7 +807,9 @@ void HlslShaderTranslator::EmitStoreResult(const InstructionResult& result,
} }
} }
} else { } else {
EmitSource("xe_pv."); EmitSource("xe_pv");
if (!result.is_standard_swizzle()) {
EmitSource(".");
for (uint32_t i = 0; i < 4; ++i) { for (uint32_t i = 0; i < 4; ++i) {
if (result.write_mask[i]) { if (result.write_mask[i]) {
EmitSource("%c", GetCharForSwizzle(result.components[i])); EmitSource("%c", GetCharForSwizzle(result.components[i]));
@ -810,6 +817,7 @@ void HlslShaderTranslator::EmitStoreResult(const InstructionResult& result,
} }
} }
} }
}
if (result.is_clamped) { if (result.is_clamped) {
EmitSource(")"); EmitSource(")");
} }