[D3D12] DXBC: Convert vertex index to float
This commit is contained in:
parent
2b2d7e71c6
commit
e2d60a4708
|
@ -315,20 +315,18 @@ void DxbcShaderTranslator::StartVertexShader_LoadVertexIndex() {
|
||||||
++stat_.instruction_count;
|
++stat_.instruction_count;
|
||||||
++stat_.movc_instruction_count;
|
++stat_.movc_instruction_count;
|
||||||
|
|
||||||
// Add the base vertex index and replicate the swapped value in the
|
// Add the base vertex index.
|
||||||
// destination register (what should be in YZW is unknown, but just to make it
|
|
||||||
// a bit cleaner).
|
|
||||||
shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_IADD) |
|
shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_IADD) |
|
||||||
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(9));
|
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(9));
|
||||||
shader_code_.push_back(
|
shader_code_.push_back(
|
||||||
EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b1111, 1));
|
EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b0001, 1));
|
||||||
shader_code_.push_back(reg);
|
shader_code_.push_back(reg);
|
||||||
shader_code_.push_back(
|
shader_code_.push_back(
|
||||||
EncodeVectorSwizzledOperand(D3D10_SB_OPERAND_TYPE_TEMP, kSwizzleXXXX, 1));
|
EncodeVectorSelectOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0, 1));
|
||||||
shader_code_.push_back(reg);
|
shader_code_.push_back(reg);
|
||||||
rdef_constants_used_ |= 1ull
|
rdef_constants_used_ |= 1ull
|
||||||
<< uint32_t(RdefConstantIndex::kSysVertexBaseIndex);
|
<< uint32_t(RdefConstantIndex::kSysVertexBaseIndex);
|
||||||
shader_code_.push_back(EncodeVectorReplicatedOperand(
|
shader_code_.push_back(EncodeVectorSelectOperand(
|
||||||
D3D10_SB_OPERAND_TYPE_CONSTANT_BUFFER, kSysConst_VertexBaseIndex_Comp,
|
D3D10_SB_OPERAND_TYPE_CONSTANT_BUFFER, kSysConst_VertexBaseIndex_Comp,
|
||||||
3));
|
3));
|
||||||
shader_code_.push_back(uint32_t(RdefConstantBufferIndex::kSystemConstants));
|
shader_code_.push_back(uint32_t(RdefConstantBufferIndex::kSystemConstants));
|
||||||
|
@ -337,6 +335,20 @@ void DxbcShaderTranslator::StartVertexShader_LoadVertexIndex() {
|
||||||
++stat_.instruction_count;
|
++stat_.instruction_count;
|
||||||
++stat_.int_instruction_count;
|
++stat_.int_instruction_count;
|
||||||
|
|
||||||
|
// Convert to float and replicate the swapped value in the destination
|
||||||
|
// register (what should be in YZW is unknown, but just to make it a bit
|
||||||
|
// cleaner).
|
||||||
|
shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_ITOF) |
|
||||||
|
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(5));
|
||||||
|
shader_code_.push_back(
|
||||||
|
EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b1111, 1));
|
||||||
|
shader_code_.push_back(reg);
|
||||||
|
shader_code_.push_back(
|
||||||
|
EncodeVectorReplicatedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0, 1));
|
||||||
|
shader_code_.push_back(reg);
|
||||||
|
++stat_.instruction_count;
|
||||||
|
++stat_.conversion_instruction_count;
|
||||||
|
|
||||||
if (uses_register_dynamic_addressing()) {
|
if (uses_register_dynamic_addressing()) {
|
||||||
// Store to indexed GPR 0 in x0[0].
|
// Store to indexed GPR 0 in x0[0].
|
||||||
shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_MOV) |
|
shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_MOV) |
|
||||||
|
@ -391,7 +403,7 @@ void DxbcShaderTranslator::StartVertexShader() {
|
||||||
++stat_.instruction_count;
|
++stat_.instruction_count;
|
||||||
++stat_.mov_instruction_count;
|
++stat_.mov_instruction_count;
|
||||||
|
|
||||||
// Byte swap and write the vertex index to GPR 0.
|
// Write the vertex index to GPR 0.
|
||||||
StartVertexShader_LoadVertexIndex();
|
StartVertexShader_LoadVertexIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue