From b56ff6e3255fb4753b5a30ed45c9c07442e5eea4 Mon Sep 17 00:00:00 2001 From: Triang3l Date: Sat, 8 Sep 2018 20:16:00 +0300 Subject: [PATCH] [D3D12] DXBC: Use the same code for dp4/dp3 as add/mul/max/min --- src/xenia/gpu/dxbc_shader_translator.cc | 31 +++---------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/src/xenia/gpu/dxbc_shader_translator.cc b/src/xenia/gpu/dxbc_shader_translator.cc index 0384a43e2..bce876ce4 100644 --- a/src/xenia/gpu/dxbc_shader_translator.cc +++ b/src/xenia/gpu/dxbc_shader_translator.cc @@ -2311,6 +2311,9 @@ void DxbcShaderTranslator::ProcessVectorAluInstruction( // max is commonly used as mov, but probably better not to convert it to // make sure things like flusing denormals aren't affected. case AluVectorOpcode::kMin: + case AluVectorOpcode::kDp4: + case AluVectorOpcode::kDp3: + // dp4 and dp3 replicate the result implicitly. shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE( kCoreOpcodes[uint32_t(instr.vector_opcode)]) | ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH( @@ -2438,34 +2441,6 @@ void DxbcShaderTranslator::ProcessVectorAluInstruction( ++stat_.movc_instruction_count; break; - case AluVectorOpcode::kDp4: - // Replicated implicitly. - shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_DP4) | - ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH( - 3 + operand_length_sums[1])); - shader_code_.push_back( - EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b1111, 1)); - shader_code_.push_back(system_temp_pv_); - UseDxbcSourceOperand(dxbc_operands[0]); - UseDxbcSourceOperand(dxbc_operands[1]); - ++stat_.instruction_count; - ++stat_.float_instruction_count; - break; - - case AluVectorOpcode::kDp3: - // Replicated implicitly. - shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_DP3) | - ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH( - 3 + operand_length_sums[1])); - shader_code_.push_back( - EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b1111, 1)); - shader_code_.push_back(system_temp_pv_); - UseDxbcSourceOperand(dxbc_operands[0]); - UseDxbcSourceOperand(dxbc_operands[1]); - ++stat_.instruction_count; - ++stat_.float_instruction_count; - break; - case AluVectorOpcode::kDp2Add: // (dot(src0.xy, src1.xy) + src2.x).xxxx replicate_result = true;