[D3D12] DXBC indexable temps

This commit is contained in:
Triang3l 2018-08-31 14:04:57 +03:00
parent 4c812da3f2
commit 37001993c5
1 changed files with 23 additions and 1 deletions

View File

@ -836,7 +836,7 @@ void DxbcShaderTranslator::WriteShaderCode() {
shader_object_.push_back(ENCODE_D3D10_SB_NAME(D3D10_SB_NAME_POSITION)); shader_object_.push_back(ENCODE_D3D10_SB_NAME(D3D10_SB_NAME_POSITION));
++stat_.dcl_count; ++stat_.dcl_count;
// Color output. // Color output.
for (uint32_t i = 0; i < kInterpolatorCount; ++i) { for (uint32_t i = 0; i < 4; ++i) {
shader_object_.push_back( shader_object_.push_back(
ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_DCL_OUTPUT) | ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_DCL_OUTPUT) |
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(3)); ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(3));
@ -858,6 +858,28 @@ void DxbcShaderTranslator::WriteShaderCode() {
} }
} }
// General-purpose registers (x0).
shader_object_.push_back(
ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_DCL_INDEXABLE_TEMP) |
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(4));
// x0.
shader_object_.push_back(0);
shader_object_.push_back(register_count());
// 4 components in each.
shader_object_.push_back(4);
stat_.temp_array_count += register_count();
// Color outputs on the Xbox 360 side (x1), for remapping to D3D12 bindings.
if (is_pixel_shader()) {
shader_object_.push_back(
ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_DCL_INDEXABLE_TEMP) |
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(4));
shader_object_.push_back(1);
shader_object_.push_back(4);
shader_object_.push_back(4);
stat_.temp_array_count += 4;
}
// Write the translated shader code. // Write the translated shader code.
size_t code_size_dwords = shader_code_.size(); size_t code_size_dwords = shader_code_.size();
// So [] won't crash in case the size is zero somehow. // So [] won't crash in case the size is zero somehow.