[D3D12] DXBC: In getWeights, apply the offset for unnormalized coordinates only when needed

This commit is contained in:
Triang3l 2018-10-07 21:51:18 +03:00
parent 685d3074f4
commit 16dc6e4100
1 changed files with 23 additions and 18 deletions

View File

@ -4137,6 +4137,7 @@ void DxbcShaderTranslator::ProcessTextureFetchInstruction(
// unnormalized coordinates. // unnormalized coordinates.
if (instr.attributes.unnormalized_coordinates) { if (instr.attributes.unnormalized_coordinates) {
if (has_offset) {
// Apply the offset. // Apply the offset.
shader_code_.push_back( shader_code_.push_back(
ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_ADD) | ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_ADD) |
@ -4149,12 +4150,16 @@ void DxbcShaderTranslator::ProcessTextureFetchInstruction(
shader_code_.push_back(system_temp_pv_); shader_code_.push_back(system_temp_pv_);
shader_code_.push_back(EncodeVectorSwizzledOperand( shader_code_.push_back(EncodeVectorSwizzledOperand(
D3D10_SB_OPERAND_TYPE_IMMEDIATE32, kSwizzleXYZW, 0)); D3D10_SB_OPERAND_TYPE_IMMEDIATE32, kSwizzleXYZW, 0));
shader_code_.push_back(*reinterpret_cast<const uint32_t*>(&offset_x)); shader_code_.push_back(
shader_code_.push_back(*reinterpret_cast<const uint32_t*>(&offset_y)); *reinterpret_cast<const uint32_t*>(&offset_x));
shader_code_.push_back(*reinterpret_cast<const uint32_t*>(&offset_z)); shader_code_.push_back(
*reinterpret_cast<const uint32_t*>(&offset_y));
shader_code_.push_back(
*reinterpret_cast<const uint32_t*>(&offset_z));
shader_code_.push_back(0); shader_code_.push_back(0);
++stat_.instruction_count; ++stat_.instruction_count;
++stat_.float_instruction_count; ++stat_.float_instruction_count;
}
} else { } else {
// Unnormalize the coordinates and apply the offset. // Unnormalize the coordinates and apply the offset.
shader_code_.push_back( shader_code_.push_back(