From 8ecedbb20a1f10665b4e96db07898fb683df0577 Mon Sep 17 00:00:00 2001 From: Triang3l Date: Fri, 7 Sep 2018 09:17:36 +0300 Subject: [PATCH] [D3D12] DXBC: Vfetch exponent bias --- src/xenia/gpu/dxbc_shader_translator.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/xenia/gpu/dxbc_shader_translator.cc b/src/xenia/gpu/dxbc_shader_translator.cc index 774b2151e..8b1e997ff 100644 --- a/src/xenia/gpu/dxbc_shader_translator.cc +++ b/src/xenia/gpu/dxbc_shader_translator.cc @@ -2106,6 +2106,28 @@ void DxbcShaderTranslator::ProcessVertexFetchInstruction( ++stat_.mov_instruction_count; } + // Apply the exponent bias. + if (instr.attributes.exp_adjust != 0) { + shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_MUL) | + ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(10)); + shader_code_.push_back(EncodeVectorMaskedOperand( + D3D10_SB_OPERAND_TYPE_TEMP, result_write_mask, 1)); + shader_code_.push_back(system_temp_pv_); + shader_code_.push_back(EncodeVectorSwizzledOperand( + D3D10_SB_OPERAND_TYPE_TEMP, kSwizzleXYZW, 1)); + shader_code_.push_back(system_temp_pv_); + shader_code_.push_back(EncodeVectorSwizzledOperand( + D3D10_SB_OPERAND_TYPE_IMMEDIATE32, kSwizzleXYZW, 0)); + uint32_t exp_adjust_scale = + uint32_t(0x3F800000 + (instr.attributes.exp_adjust << 23)); + shader_code_.push_back(exp_adjust_scale); + shader_code_.push_back(exp_adjust_scale); + shader_code_.push_back(exp_adjust_scale); + shader_code_.push_back(exp_adjust_scale); + ++stat_.instruction_count; + ++stat_.float_instruction_count; + } + StoreResult(instr.result, system_temp_pv_, false); }