[D3D12] DXBC: Fix UAV and sampler operands
This commit is contained in:
parent
6025599d3b
commit
645f450321
|
@ -4024,7 +4024,7 @@ void DxbcShaderTranslator::WriteShaderCode() {
|
||||||
D3D11_SB_RASTERIZER_ORDERED_ACCESS |
|
D3D11_SB_RASTERIZER_ORDERED_ACCESS |
|
||||||
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(7));
|
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(7));
|
||||||
shader_object_.push_back(EncodeVectorSwizzledOperand(
|
shader_object_.push_back(EncodeVectorSwizzledOperand(
|
||||||
D3D10_SB_OPERAND_TYPE_RESOURCE, kSwizzleXYZW, 3));
|
D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW, kSwizzleXYZW, 3));
|
||||||
shader_object_.push_back(0);
|
shader_object_.push_back(0);
|
||||||
shader_object_.push_back(0);
|
shader_object_.push_back(0);
|
||||||
shader_object_.push_back(0);
|
shader_object_.push_back(0);
|
||||||
|
|
|
@ -727,6 +727,15 @@ class DxbcShaderTranslator : public ShaderTranslator {
|
||||||
|
|
||||||
// Operand encoding, with 32-bit immediate indices by default. None of the
|
// Operand encoding, with 32-bit immediate indices by default. None of the
|
||||||
// arguments must be shifted when calling.
|
// arguments must be shifted when calling.
|
||||||
|
static constexpr uint32_t EncodeZeroComponentOperand(
|
||||||
|
uint32_t type, uint32_t index_dimension,
|
||||||
|
uint32_t index_representation_0 = 0, uint32_t index_representation_1 = 0,
|
||||||
|
uint32_t index_representation_2 = 0) {
|
||||||
|
// D3D10_SB_OPERAND_0_COMPONENT.
|
||||||
|
return 0 | (type << 12) | (index_dimension << 20) |
|
||||||
|
(index_representation_0 << 22) | (index_representation_1 << 25) |
|
||||||
|
(index_representation_0 << 28);
|
||||||
|
}
|
||||||
static constexpr uint32_t EncodeScalarOperand(
|
static constexpr uint32_t EncodeScalarOperand(
|
||||||
uint32_t type, uint32_t index_dimension,
|
uint32_t type, uint32_t index_dimension,
|
||||||
uint32_t index_representation_0 = 0, uint32_t index_representation_1 = 0,
|
uint32_t index_representation_0 = 0, uint32_t index_representation_1 = 0,
|
||||||
|
|
|
@ -2387,18 +2387,16 @@ void DxbcShaderTranslator::ProcessScalarAluInstruction(
|
||||||
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(4 + operand_lengths[0]));
|
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(4 + operand_lengths[0]));
|
||||||
// sincos ps, null, src0.x for sin
|
// sincos ps, null, src0.x for sin
|
||||||
// sincos null, ps, src0.x for cos
|
// sincos null, ps, src0.x for cos
|
||||||
const uint32_t null_operand_token =
|
|
||||||
ENCODE_D3D10_SB_OPERAND_NUM_COMPONENTS(D3D10_SB_OPERAND_0_COMPONENT) |
|
|
||||||
ENCODE_D3D10_SB_OPERAND_TYPE(D3D10_SB_OPERAND_TYPE_NULL) |
|
|
||||||
ENCODE_D3D10_SB_OPERAND_INDEX_DIMENSION(D3D10_SB_OPERAND_INDEX_0D);
|
|
||||||
if (instr.scalar_opcode != AluScalarOpcode::kSin) {
|
if (instr.scalar_opcode != AluScalarOpcode::kSin) {
|
||||||
shader_code_.push_back(null_operand_token);
|
shader_code_.push_back(
|
||||||
|
EncodeZeroComponentOperand(D3D10_SB_OPERAND_TYPE_NULL, 0));
|
||||||
}
|
}
|
||||||
shader_code_.push_back(
|
shader_code_.push_back(
|
||||||
EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b0001, 1));
|
EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b0001, 1));
|
||||||
shader_code_.push_back(system_temp_ps_pc_p0_a0_);
|
shader_code_.push_back(system_temp_ps_pc_p0_a0_);
|
||||||
if (instr.scalar_opcode != AluScalarOpcode::kCos) {
|
if (instr.scalar_opcode != AluScalarOpcode::kCos) {
|
||||||
shader_code_.push_back(null_operand_token);
|
shader_code_.push_back(
|
||||||
|
EncodeZeroComponentOperand(D3D10_SB_OPERAND_TYPE_NULL, 0));
|
||||||
}
|
}
|
||||||
UseDxbcSourceOperand(dxbc_operands[0], kSwizzleXYZW, 0);
|
UseDxbcSourceOperand(dxbc_operands[0], kSwizzleXYZW, 0);
|
||||||
++stat_.instruction_count;
|
++stat_.instruction_count;
|
||||||
|
|
|
@ -1807,8 +1807,8 @@ void DxbcShaderTranslator::ProcessTextureFetchInstruction(
|
||||||
D3D10_SB_OPERAND_TYPE_RESOURCE, kSwizzleXYZW, 2));
|
D3D10_SB_OPERAND_TYPE_RESOURCE, kSwizzleXYZW, 2));
|
||||||
shader_code_.push_back(srv_register_current);
|
shader_code_.push_back(srv_register_current);
|
||||||
shader_code_.push_back(srv_register_current);
|
shader_code_.push_back(srv_register_current);
|
||||||
shader_code_.push_back(EncodeVectorSwizzledOperand(
|
shader_code_.push_back(
|
||||||
D3D10_SB_OPERAND_TYPE_SAMPLER, kSwizzleXYZW, 2));
|
EncodeZeroComponentOperand(D3D10_SB_OPERAND_TYPE_SAMPLER, 2));
|
||||||
shader_code_.push_back(sampler_register);
|
shader_code_.push_back(sampler_register);
|
||||||
shader_code_.push_back(sampler_register);
|
shader_code_.push_back(sampler_register);
|
||||||
++stat_.instruction_count;
|
++stat_.instruction_count;
|
||||||
|
@ -1848,8 +1848,8 @@ void DxbcShaderTranslator::ProcessTextureFetchInstruction(
|
||||||
D3D10_SB_OPERAND_TYPE_RESOURCE, kSwizzleXYZW, 2));
|
D3D10_SB_OPERAND_TYPE_RESOURCE, kSwizzleXYZW, 2));
|
||||||
shader_code_.push_back(srv_register_current);
|
shader_code_.push_back(srv_register_current);
|
||||||
shader_code_.push_back(srv_register_current);
|
shader_code_.push_back(srv_register_current);
|
||||||
shader_code_.push_back(EncodeVectorSwizzledOperand(
|
shader_code_.push_back(
|
||||||
D3D10_SB_OPERAND_TYPE_SAMPLER, kSwizzleXYZW, 2));
|
EncodeZeroComponentOperand(D3D10_SB_OPERAND_TYPE_SAMPLER, 2));
|
||||||
shader_code_.push_back(sampler_register);
|
shader_code_.push_back(sampler_register);
|
||||||
shader_code_.push_back(sampler_register);
|
shader_code_.push_back(sampler_register);
|
||||||
shader_code_.push_back(EncodeVectorSelectOperand(
|
shader_code_.push_back(EncodeVectorSelectOperand(
|
||||||
|
@ -1874,8 +1874,8 @@ void DxbcShaderTranslator::ProcessTextureFetchInstruction(
|
||||||
D3D10_SB_OPERAND_TYPE_RESOURCE, kSwizzleXYZW, 2));
|
D3D10_SB_OPERAND_TYPE_RESOURCE, kSwizzleXYZW, 2));
|
||||||
shader_code_.push_back(srv_register_current);
|
shader_code_.push_back(srv_register_current);
|
||||||
shader_code_.push_back(srv_register_current);
|
shader_code_.push_back(srv_register_current);
|
||||||
shader_code_.push_back(EncodeVectorSwizzledOperand(
|
shader_code_.push_back(
|
||||||
D3D10_SB_OPERAND_TYPE_SAMPLER, kSwizzleXYZW, 2));
|
EncodeZeroComponentOperand(D3D10_SB_OPERAND_TYPE_SAMPLER, 2));
|
||||||
shader_code_.push_back(sampler_register);
|
shader_code_.push_back(sampler_register);
|
||||||
shader_code_.push_back(sampler_register);
|
shader_code_.push_back(sampler_register);
|
||||||
shader_code_.push_back(EncodeVectorSwizzledOperand(
|
shader_code_.push_back(EncodeVectorSwizzledOperand(
|
||||||
|
@ -1921,8 +1921,8 @@ void DxbcShaderTranslator::ProcessTextureFetchInstruction(
|
||||||
D3D10_SB_OPERAND_TYPE_RESOURCE, kSwizzleXYZW, 2));
|
D3D10_SB_OPERAND_TYPE_RESOURCE, kSwizzleXYZW, 2));
|
||||||
shader_code_.push_back(srv_register_current);
|
shader_code_.push_back(srv_register_current);
|
||||||
shader_code_.push_back(srv_register_current);
|
shader_code_.push_back(srv_register_current);
|
||||||
shader_code_.push_back(EncodeVectorSwizzledOperand(
|
shader_code_.push_back(
|
||||||
D3D10_SB_OPERAND_TYPE_SAMPLER, kSwizzleXYZW, 2));
|
EncodeZeroComponentOperand(D3D10_SB_OPERAND_TYPE_SAMPLER, 2));
|
||||||
shader_code_.push_back(sampler_register);
|
shader_code_.push_back(sampler_register);
|
||||||
shader_code_.push_back(sampler_register);
|
shader_code_.push_back(sampler_register);
|
||||||
if (explicit_lod || instr.attributes.lod_bias != 0.0f) {
|
if (explicit_lod || instr.attributes.lod_bias != 0.0f) {
|
||||||
|
|
|
@ -4208,9 +4208,7 @@ void DxbcShaderTranslator::CompletePixelShader_WriteToROV() {
|
||||||
EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b0100, 1));
|
EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b0100, 1));
|
||||||
shader_code_.push_back(edram_coord_pixel_temp);
|
shader_code_.push_back(edram_coord_pixel_temp);
|
||||||
shader_code_.push_back(
|
shader_code_.push_back(
|
||||||
ENCODE_D3D10_SB_OPERAND_NUM_COMPONENTS(D3D10_SB_OPERAND_0_COMPONENT) |
|
EncodeZeroComponentOperand(D3D10_SB_OPERAND_TYPE_NULL, 0));
|
||||||
ENCODE_D3D10_SB_OPERAND_TYPE(D3D10_SB_OPERAND_TYPE_NULL) |
|
|
||||||
ENCODE_D3D10_SB_OPERAND_INDEX_DIMENSION(D3D10_SB_OPERAND_INDEX_0D));
|
|
||||||
shader_code_.push_back(
|
shader_code_.push_back(
|
||||||
EncodeVectorSelectOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0, 1));
|
EncodeVectorSelectOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0, 1));
|
||||||
shader_code_.push_back(edram_coord_pixel_temp);
|
shader_code_.push_back(edram_coord_pixel_temp);
|
||||||
|
|
Loading…
Reference in New Issue