[DXBC] SRV binding enum
This commit is contained in:
parent
a95326321c
commit
58c104e0cc
|
@ -312,8 +312,10 @@ ID3D12RootSignature* D3D12CommandProcessor::GetRootSignature(
|
||||||
shared_memory_and_edram_ranges[0].RangeType =
|
shared_memory_and_edram_ranges[0].RangeType =
|
||||||
D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
|
D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
|
||||||
shared_memory_and_edram_ranges[0].NumDescriptors = 1;
|
shared_memory_and_edram_ranges[0].NumDescriptors = 1;
|
||||||
shared_memory_and_edram_ranges[0].BaseShaderRegister = 0;
|
shared_memory_and_edram_ranges[0].BaseShaderRegister =
|
||||||
shared_memory_and_edram_ranges[0].RegisterSpace = 0;
|
uint32_t(DxbcShaderTranslator::SRVMainRegister::kSharedMemory);
|
||||||
|
shared_memory_and_edram_ranges[0].RegisterSpace =
|
||||||
|
uint32_t(DxbcShaderTranslator::SRVSpace::kMain);
|
||||||
shared_memory_and_edram_ranges[0].OffsetInDescriptorsFromTableStart = 0;
|
shared_memory_and_edram_ranges[0].OffsetInDescriptorsFromTableStart = 0;
|
||||||
shared_memory_and_edram_ranges[1].RangeType =
|
shared_memory_and_edram_ranges[1].RangeType =
|
||||||
D3D12_DESCRIPTOR_RANGE_TYPE_UAV;
|
D3D12_DESCRIPTOR_RANGE_TYPE_UAV;
|
||||||
|
@ -346,8 +348,9 @@ ID3D12RootSignature* D3D12CommandProcessor::GetRootSignature(
|
||||||
parameter.ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
|
parameter.ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
|
||||||
range.RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
|
range.RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
|
||||||
range.NumDescriptors = texture_count_pixel;
|
range.NumDescriptors = texture_count_pixel;
|
||||||
range.BaseShaderRegister = 1;
|
range.BaseShaderRegister =
|
||||||
range.RegisterSpace = 0;
|
uint32_t(DxbcShaderTranslator::SRVMainRegister::kBoundTexturesStart);
|
||||||
|
range.RegisterSpace = uint32_t(DxbcShaderTranslator::SRVSpace::kMain);
|
||||||
range.OffsetInDescriptorsFromTableStart = 0;
|
range.OffsetInDescriptorsFromTableStart = 0;
|
||||||
++desc.NumParameters;
|
++desc.NumParameters;
|
||||||
}
|
}
|
||||||
|
@ -378,8 +381,9 @@ ID3D12RootSignature* D3D12CommandProcessor::GetRootSignature(
|
||||||
parameter.ShaderVisibility = vertex_visibility;
|
parameter.ShaderVisibility = vertex_visibility;
|
||||||
range.RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
|
range.RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
|
||||||
range.NumDescriptors = texture_count_vertex;
|
range.NumDescriptors = texture_count_vertex;
|
||||||
range.BaseShaderRegister = 1;
|
range.BaseShaderRegister =
|
||||||
range.RegisterSpace = 0;
|
uint32_t(DxbcShaderTranslator::SRVMainRegister::kBoundTexturesStart);
|
||||||
|
range.RegisterSpace = uint32_t(DxbcShaderTranslator::SRVSpace::kMain);
|
||||||
range.OffsetInDescriptorsFromTableStart = 0;
|
range.OffsetInDescriptorsFromTableStart = 0;
|
||||||
++desc.NumParameters;
|
++desc.NumParameters;
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,8 +195,7 @@ class D3D12CommandProcessor : public CommandProcessor {
|
||||||
// Pretty rarely used and rarely changed - flow control constants.
|
// Pretty rarely used and rarely changed - flow control constants.
|
||||||
kRootParameter_BoolLoopConstants,
|
kRootParameter_BoolLoopConstants,
|
||||||
// Never changed except for when starting a new descriptor heap - shared
|
// Never changed except for when starting a new descriptor heap - shared
|
||||||
// memory byte address buffer (t0) and, if ROV is used for EDRAM, EDRAM UAV
|
// memory byte address buffer, and, if ROV is used for EDRAM, EDRAM UAV.
|
||||||
// (u0).
|
|
||||||
kRootParameter_SharedMemoryAndEDRAM,
|
kRootParameter_SharedMemoryAndEDRAM,
|
||||||
|
|
||||||
kRootParameter_Count_Base,
|
kRootParameter_Count_Base,
|
||||||
|
|
|
@ -3481,14 +3481,12 @@ void DxbcShaderTranslator::WriteResourceDefinitions() {
|
||||||
shader_object_.push_back(uint32_t(DxbcRdefDimension::kSRVBuffer));
|
shader_object_.push_back(uint32_t(DxbcRdefDimension::kSRVBuffer));
|
||||||
// Multisampling not applicable.
|
// Multisampling not applicable.
|
||||||
shader_object_.push_back(0);
|
shader_object_.push_back(0);
|
||||||
// Register t0.
|
shader_object_.push_back(uint32_t(SRVMainRegister::kSharedMemory));
|
||||||
shader_object_.push_back(0);
|
|
||||||
// One binding.
|
// One binding.
|
||||||
shader_object_.push_back(1);
|
shader_object_.push_back(1);
|
||||||
// No DxbcRdefInputFlags.
|
// No DxbcRdefInputFlags.
|
||||||
shader_object_.push_back(0);
|
shader_object_.push_back(0);
|
||||||
// Register space 0.
|
shader_object_.push_back(uint32_t(SRVSpace::kMain));
|
||||||
shader_object_.push_back(0);
|
|
||||||
// SRV ID T0.
|
// SRV ID T0.
|
||||||
shader_object_.push_back(0);
|
shader_object_.push_back(0);
|
||||||
|
|
||||||
|
@ -3511,14 +3509,13 @@ void DxbcShaderTranslator::WriteResourceDefinitions() {
|
||||||
}
|
}
|
||||||
// Not multisampled.
|
// Not multisampled.
|
||||||
shader_object_.push_back(0xFFFFFFFFu);
|
shader_object_.push_back(0xFFFFFFFFu);
|
||||||
// Register t[1 + i] - t0 is shared memory.
|
shader_object_.push_back(uint32_t(SRVMainRegister::kBoundTexturesStart) +
|
||||||
shader_object_.push_back(1 + i);
|
i);
|
||||||
// One binding.
|
// One binding.
|
||||||
shader_object_.push_back(1);
|
shader_object_.push_back(1);
|
||||||
// 4-component.
|
// 4-component.
|
||||||
shader_object_.push_back(DxbcRdefInputFlagsComponents);
|
shader_object_.push_back(DxbcRdefInputFlagsComponents);
|
||||||
// Register space 0.
|
shader_object_.push_back(uint32_t(SRVSpace::kMain));
|
||||||
shader_object_.push_back(0);
|
|
||||||
// SRV ID T[1 + i] - T0 is shared memory.
|
// SRV ID T[1 + i] - T0 is shared memory.
|
||||||
shader_object_.push_back(1 + i);
|
shader_object_.push_back(1 + i);
|
||||||
texture_name_offset += GetStringLength(texture_srv.name.c_str());
|
texture_name_offset += GetStringLength(texture_srv.name.c_str());
|
||||||
|
@ -4326,16 +4323,16 @@ void DxbcShaderTranslator::WriteShaderCode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shader resources.
|
// Shader resources.
|
||||||
// Shared memory ByteAddressBuffer (T0, at t0, space0).
|
// Shared memory ByteAddressBuffer.
|
||||||
shader_object_.push_back(
|
shader_object_.push_back(
|
||||||
ENCODE_D3D10_SB_OPCODE_TYPE(D3D11_SB_OPCODE_DCL_RESOURCE_RAW) |
|
ENCODE_D3D10_SB_OPCODE_TYPE(D3D11_SB_OPCODE_DCL_RESOURCE_RAW) |
|
||||||
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(6));
|
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(6));
|
||||||
shader_object_.push_back(EncodeVectorSwizzledOperand(
|
shader_object_.push_back(EncodeVectorSwizzledOperand(
|
||||||
D3D10_SB_OPERAND_TYPE_RESOURCE, kSwizzleXYZW, 3));
|
D3D10_SB_OPERAND_TYPE_RESOURCE, kSwizzleXYZW, 3));
|
||||||
shader_object_.push_back(0);
|
shader_object_.push_back(0);
|
||||||
shader_object_.push_back(0);
|
shader_object_.push_back(uint32_t(SRVMainRegister::kSharedMemory));
|
||||||
shader_object_.push_back(0);
|
shader_object_.push_back(uint32_t(SRVMainRegister::kSharedMemory));
|
||||||
shader_object_.push_back(0);
|
shader_object_.push_back(uint32_t(SRVSpace::kMain));
|
||||||
// Textures.
|
// Textures.
|
||||||
for (uint32_t i = 0; i < uint32_t(texture_srvs_.size()); ++i) {
|
for (uint32_t i = 0; i < uint32_t(texture_srvs_.size()); ++i) {
|
||||||
const TextureSRV& texture_srv = texture_srvs_[i];
|
const TextureSRV& texture_srv = texture_srvs_[i];
|
||||||
|
@ -4358,15 +4355,16 @@ void DxbcShaderTranslator::WriteShaderCode() {
|
||||||
D3D10_SB_OPERAND_TYPE_RESOURCE, kSwizzleXYZW, 3));
|
D3D10_SB_OPERAND_TYPE_RESOURCE, kSwizzleXYZW, 3));
|
||||||
// T0 is shared memory.
|
// T0 is shared memory.
|
||||||
shader_object_.push_back(1 + i);
|
shader_object_.push_back(1 + i);
|
||||||
// t0 is shared memory.
|
shader_object_.push_back(uint32_t(SRVMainRegister::kBoundTexturesStart) +
|
||||||
shader_object_.push_back(1 + i);
|
i);
|
||||||
shader_object_.push_back(1 + i);
|
shader_object_.push_back(uint32_t(SRVMainRegister::kBoundTexturesStart) +
|
||||||
|
i);
|
||||||
shader_object_.push_back(
|
shader_object_.push_back(
|
||||||
ENCODE_D3D10_SB_RESOURCE_RETURN_TYPE(D3D10_SB_RETURN_TYPE_FLOAT, 0) |
|
ENCODE_D3D10_SB_RESOURCE_RETURN_TYPE(D3D10_SB_RETURN_TYPE_FLOAT, 0) |
|
||||||
ENCODE_D3D10_SB_RESOURCE_RETURN_TYPE(D3D10_SB_RETURN_TYPE_FLOAT, 1) |
|
ENCODE_D3D10_SB_RESOURCE_RETURN_TYPE(D3D10_SB_RETURN_TYPE_FLOAT, 1) |
|
||||||
ENCODE_D3D10_SB_RESOURCE_RETURN_TYPE(D3D10_SB_RETURN_TYPE_FLOAT, 2) |
|
ENCODE_D3D10_SB_RESOURCE_RETURN_TYPE(D3D10_SB_RETURN_TYPE_FLOAT, 2) |
|
||||||
ENCODE_D3D10_SB_RESOURCE_RETURN_TYPE(D3D10_SB_RETURN_TYPE_FLOAT, 3));
|
ENCODE_D3D10_SB_RESOURCE_RETURN_TYPE(D3D10_SB_RETURN_TYPE_FLOAT, 3));
|
||||||
shader_object_.push_back(0);
|
shader_object_.push_back(uint32_t(SRVSpace::kMain));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -321,6 +321,18 @@ class DxbcShaderTranslator : public ShaderTranslator {
|
||||||
float edram_blend_constant[4];
|
float edram_blend_constant[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Shader resource view binding spaces.
|
||||||
|
enum class SRVSpace {
|
||||||
|
// SRVMainSpaceRegister t# layout.
|
||||||
|
kMain,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Shader resource view bindings in SRVSpace::kMain.
|
||||||
|
enum class SRVMainRegister {
|
||||||
|
kSharedMemory,
|
||||||
|
kBoundTexturesStart,
|
||||||
|
};
|
||||||
|
|
||||||
// 192 textures at most because there are 32 fetch constants, and textures can
|
// 192 textures at most because there are 32 fetch constants, and textures can
|
||||||
// be 2D array, 3D or cube, and also signed and unsigned.
|
// be 2D array, 3D or cube, and also signed and unsigned.
|
||||||
static constexpr uint32_t kMaxTextureSRVIndexBits = 8;
|
static constexpr uint32_t kMaxTextureSRVIndexBits = 8;
|
||||||
|
@ -335,7 +347,8 @@ class DxbcShaderTranslator : public ShaderTranslator {
|
||||||
bool is_sign_required;
|
bool is_sign_required;
|
||||||
std::string name;
|
std::string name;
|
||||||
};
|
};
|
||||||
// The first binding returned is at t1 because t0 is shared memory.
|
// The first binding returned is at t[SRVMainRegister::kBoundTexturesStart]
|
||||||
|
// of space SRVSpace::kMain.
|
||||||
const TextureSRV* GetTextureSRVs(uint32_t& count_out) const {
|
const TextureSRV* GetTextureSRVs(uint32_t& count_out) const {
|
||||||
count_out = uint32_t(texture_srvs_.size());
|
count_out = uint32_t(texture_srvs_.size());
|
||||||
return texture_srvs_.data();
|
return texture_srvs_.data();
|
||||||
|
@ -2081,7 +2094,8 @@ class DxbcShaderTranslator : public ShaderTranslator {
|
||||||
// Emits copde for endian swapping of the data located in pv.
|
// Emits copde for endian swapping of the data located in pv.
|
||||||
void SwapVertexData(uint32_t vfetch_index, uint32_t write_mask);
|
void SwapVertexData(uint32_t vfetch_index, uint32_t write_mask);
|
||||||
|
|
||||||
// Returns T#/t# index (they are the same in this translator).
|
// Returns index in texture_srvs_, and, for bound textures, it's also relative
|
||||||
|
// to the base T#/t# index of textures.
|
||||||
uint32_t FindOrAddTextureSRV(uint32_t fetch_constant,
|
uint32_t FindOrAddTextureSRV(uint32_t fetch_constant,
|
||||||
TextureDimension dimension, bool is_signed,
|
TextureDimension dimension, bool is_signed,
|
||||||
bool is_sign_required = false);
|
bool is_sign_required = false);
|
||||||
|
|
|
@ -501,7 +501,7 @@ void DxbcShaderTranslator::ProcessVertexFetchInstruction(
|
||||||
D3D10_SB_OPERAND_TYPE_RESOURCE,
|
D3D10_SB_OPERAND_TYPE_RESOURCE,
|
||||||
kSwizzleXYZW & ((1 << (load_dword_count * 2)) - 1), 2));
|
kSwizzleXYZW & ((1 << (load_dword_count * 2)) - 1), 2));
|
||||||
shader_code_.push_back(0);
|
shader_code_.push_back(0);
|
||||||
shader_code_.push_back(0);
|
shader_code_.push_back(uint32_t(SRVMainRegister::kSharedMemory));
|
||||||
++stat_.instruction_count;
|
++stat_.instruction_count;
|
||||||
++stat_.texture_load_instructions;
|
++stat_.texture_load_instructions;
|
||||||
|
|
||||||
|
@ -756,7 +756,6 @@ uint32_t DxbcShaderTranslator::FindOrAddTextureSRV(uint32_t fetch_constant,
|
||||||
if (dimension == TextureDimension::k1D) {
|
if (dimension == TextureDimension::k1D) {
|
||||||
dimension = TextureDimension::k2D;
|
dimension = TextureDimension::k2D;
|
||||||
}
|
}
|
||||||
// 1 is added to the return value because T0/t0 is shared memory.
|
|
||||||
for (uint32_t i = 0; i < uint32_t(texture_srvs_.size()); ++i) {
|
for (uint32_t i = 0; i < uint32_t(texture_srvs_.size()); ++i) {
|
||||||
TextureSRV& texture_srv = texture_srvs_[i];
|
TextureSRV& texture_srv = texture_srvs_[i];
|
||||||
if (texture_srv.fetch_constant == fetch_constant &&
|
if (texture_srv.fetch_constant == fetch_constant &&
|
||||||
|
@ -767,12 +766,12 @@ uint32_t DxbcShaderTranslator::FindOrAddTextureSRV(uint32_t fetch_constant,
|
||||||
// must be bound even when all components are signed.
|
// must be bound even when all components are signed.
|
||||||
texture_srv.is_sign_required = true;
|
texture_srv.is_sign_required = true;
|
||||||
}
|
}
|
||||||
return 1 + i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (texture_srvs_.size() >= kMaxTextureSRVs) {
|
if (texture_srvs_.size() >= kMaxTextureSRVs) {
|
||||||
assert_always();
|
assert_always();
|
||||||
return 1 + (kMaxTextureSRVs - 1);
|
return kMaxTextureSRVs - 1;
|
||||||
}
|
}
|
||||||
TextureSRV new_texture_srv;
|
TextureSRV new_texture_srv;
|
||||||
new_texture_srv.fetch_constant = fetch_constant;
|
new_texture_srv.fetch_constant = fetch_constant;
|
||||||
|
@ -792,9 +791,9 @@ uint32_t DxbcShaderTranslator::FindOrAddTextureSRV(uint32_t fetch_constant,
|
||||||
}
|
}
|
||||||
new_texture_srv.name = fmt::format("xe_texture{}_{}_{}", fetch_constant,
|
new_texture_srv.name = fmt::format("xe_texture{}_{}_{}", fetch_constant,
|
||||||
dimension_name, is_signed ? 's' : 'u');
|
dimension_name, is_signed ? 's' : 'u');
|
||||||
uint32_t srv_register = 1 + uint32_t(texture_srvs_.size());
|
uint32_t srv_index = uint32_t(texture_srvs_.size());
|
||||||
texture_srvs_.emplace_back(std::move(new_texture_srv));
|
texture_srvs_.emplace_back(std::move(new_texture_srv));
|
||||||
return srv_register;
|
return srv_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t DxbcShaderTranslator::FindOrAddSamplerBinding(
|
uint32_t DxbcShaderTranslator::FindOrAddSamplerBinding(
|
||||||
|
@ -1277,8 +1276,8 @@ void DxbcShaderTranslator::ProcessTextureFetchInstruction(
|
||||||
store_result = true;
|
store_result = true;
|
||||||
|
|
||||||
// 0 is unsigned, 1 is signed.
|
// 0 is unsigned, 1 is signed.
|
||||||
uint32_t srv_registers[2] = {UINT32_MAX, UINT32_MAX};
|
uint32_t srv_indices[2] = {UINT32_MAX, UINT32_MAX};
|
||||||
uint32_t srv_registers_stacked[2] = {UINT32_MAX, UINT32_MAX};
|
uint32_t srv_indices_stacked[2] = {UINT32_MAX, UINT32_MAX};
|
||||||
uint32_t sampler_register = UINT32_MAX;
|
uint32_t sampler_register = UINT32_MAX;
|
||||||
// Only the fetch constant needed for kGetTextureWeights.
|
// Only the fetch constant needed for kGetTextureWeights.
|
||||||
if (instr.opcode != FetchOpcode::kGetTextureWeights) {
|
if (instr.opcode != FetchOpcode::kGetTextureWeights) {
|
||||||
|
@ -1286,23 +1285,23 @@ void DxbcShaderTranslator::ProcessTextureFetchInstruction(
|
||||||
// The LOD is a scalar and it doesn't depend on the texture contents, so
|
// The LOD is a scalar and it doesn't depend on the texture contents, so
|
||||||
// require any variant - unsigned in this case because more texture
|
// require any variant - unsigned in this case because more texture
|
||||||
// formats support it.
|
// formats support it.
|
||||||
srv_registers[0] =
|
srv_indices[0] =
|
||||||
FindOrAddTextureSRV(tfetch_index, instr.dimension, false, true);
|
FindOrAddTextureSRV(tfetch_index, instr.dimension, false, true);
|
||||||
if (instr.dimension == TextureDimension::k3D) {
|
if (instr.dimension == TextureDimension::k3D) {
|
||||||
// 3D or 2D stacked is selected dynamically.
|
// 3D or 2D stacked is selected dynamically.
|
||||||
srv_registers_stacked[0] = FindOrAddTextureSRV(
|
srv_indices_stacked[0] = FindOrAddTextureSRV(
|
||||||
tfetch_index, TextureDimension::k2D, false, true);
|
tfetch_index, TextureDimension::k2D, false, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
srv_registers[0] =
|
srv_indices[0] =
|
||||||
FindOrAddTextureSRV(tfetch_index, instr.dimension, false);
|
FindOrAddTextureSRV(tfetch_index, instr.dimension, false);
|
||||||
srv_registers[1] =
|
srv_indices[1] =
|
||||||
FindOrAddTextureSRV(tfetch_index, instr.dimension, true);
|
FindOrAddTextureSRV(tfetch_index, instr.dimension, true);
|
||||||
if (instr.dimension == TextureDimension::k3D) {
|
if (instr.dimension == TextureDimension::k3D) {
|
||||||
// 3D or 2D stacked is selected dynamically.
|
// 3D or 2D stacked is selected dynamically.
|
||||||
srv_registers_stacked[0] =
|
srv_indices_stacked[0] =
|
||||||
FindOrAddTextureSRV(tfetch_index, TextureDimension::k2D, false);
|
FindOrAddTextureSRV(tfetch_index, TextureDimension::k2D, false);
|
||||||
srv_registers_stacked[1] =
|
srv_indices_stacked[1] =
|
||||||
FindOrAddTextureSRV(tfetch_index, TextureDimension::k2D, true);
|
FindOrAddTextureSRV(tfetch_index, TextureDimension::k2D, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2297,8 +2296,8 @@ void DxbcShaderTranslator::ProcessTextureFetchInstruction(
|
||||||
// The non-pixel-shader case should be handled before because it
|
// The non-pixel-shader case should be handled before because it
|
||||||
// just returns a constant in this case.
|
// just returns a constant in this case.
|
||||||
assert_true(IsDxbcPixelShader());
|
assert_true(IsDxbcPixelShader());
|
||||||
uint32_t srv_register_current =
|
uint32_t srv_index_current =
|
||||||
i ? srv_registers_stacked[0] : srv_registers[0];
|
i ? srv_indices_stacked[0] : srv_indices[0];
|
||||||
replicate_result = true;
|
replicate_result = true;
|
||||||
shader_code_.push_back(
|
shader_code_.push_back(
|
||||||
ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_1_SB_OPCODE_LOD) |
|
ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_1_SB_OPCODE_LOD) |
|
||||||
|
@ -2311,8 +2310,10 @@ void DxbcShaderTranslator::ProcessTextureFetchInstruction(
|
||||||
shader_code_.push_back(coord_temp);
|
shader_code_.push_back(coord_temp);
|
||||||
shader_code_.push_back(EncodeVectorSwizzledOperand(
|
shader_code_.push_back(EncodeVectorSwizzledOperand(
|
||||||
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(1 + srv_index_current);
|
||||||
shader_code_.push_back(srv_register_current);
|
shader_code_.push_back(
|
||||||
|
uint32_t(SRVMainRegister::kBoundTexturesStart) +
|
||||||
|
srv_index_current);
|
||||||
shader_code_.push_back(
|
shader_code_.push_back(
|
||||||
EncodeZeroComponentOperand(D3D10_SB_OPERAND_TYPE_SAMPLER, 2));
|
EncodeZeroComponentOperand(D3D10_SB_OPERAND_TYPE_SAMPLER, 2));
|
||||||
shader_code_.push_back(sampler_register);
|
shader_code_.push_back(sampler_register);
|
||||||
|
@ -2341,8 +2342,8 @@ void DxbcShaderTranslator::ProcessTextureFetchInstruction(
|
||||||
// Sample both unsigned and signed, and for stacked textures, two
|
// Sample both unsigned and signed, and for stacked textures, two
|
||||||
// samples if filtering is needed.
|
// samples if filtering is needed.
|
||||||
for (uint32_t j = 0; j < 2; ++j) {
|
for (uint32_t j = 0; j < 2; ++j) {
|
||||||
uint32_t srv_register_current =
|
uint32_t srv_index_current =
|
||||||
i ? srv_registers_stacked[j] : srv_registers[j];
|
i ? srv_indices_stacked[j] : srv_indices[j];
|
||||||
uint32_t target_temp_sign = j ? signed_value_temp : system_temp_pv_;
|
uint32_t target_temp_sign = j ? signed_value_temp : system_temp_pv_;
|
||||||
for (uint32_t k = 0;
|
for (uint32_t k = 0;
|
||||||
k < (vol_filter_lerp_temp != UINT32_MAX ? 2u : 1u); ++k) {
|
k < (vol_filter_lerp_temp != UINT32_MAX ? 2u : 1u); ++k) {
|
||||||
|
@ -2392,8 +2393,10 @@ void DxbcShaderTranslator::ProcessTextureFetchInstruction(
|
||||||
shader_code_.push_back(coord_temp);
|
shader_code_.push_back(coord_temp);
|
||||||
shader_code_.push_back(EncodeVectorSwizzledOperand(
|
shader_code_.push_back(EncodeVectorSwizzledOperand(
|
||||||
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(1 + srv_index_current);
|
||||||
shader_code_.push_back(srv_register_current);
|
shader_code_.push_back(
|
||||||
|
uint32_t(SRVMainRegister::kBoundTexturesStart) +
|
||||||
|
srv_index_current);
|
||||||
shader_code_.push_back(EncodeZeroComponentOperand(
|
shader_code_.push_back(EncodeZeroComponentOperand(
|
||||||
D3D10_SB_OPERAND_TYPE_SAMPLER, 2));
|
D3D10_SB_OPERAND_TYPE_SAMPLER, 2));
|
||||||
shader_code_.push_back(sampler_register);
|
shader_code_.push_back(sampler_register);
|
||||||
|
@ -2419,8 +2422,10 @@ void DxbcShaderTranslator::ProcessTextureFetchInstruction(
|
||||||
shader_code_.push_back(coord_temp);
|
shader_code_.push_back(coord_temp);
|
||||||
shader_code_.push_back(EncodeVectorSwizzledOperand(
|
shader_code_.push_back(EncodeVectorSwizzledOperand(
|
||||||
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(1 + srv_index_current);
|
||||||
shader_code_.push_back(srv_register_current);
|
shader_code_.push_back(
|
||||||
|
uint32_t(SRVMainRegister::kBoundTexturesStart) +
|
||||||
|
srv_index_current);
|
||||||
shader_code_.push_back(EncodeZeroComponentOperand(
|
shader_code_.push_back(EncodeZeroComponentOperand(
|
||||||
D3D10_SB_OPERAND_TYPE_SAMPLER, 2));
|
D3D10_SB_OPERAND_TYPE_SAMPLER, 2));
|
||||||
shader_code_.push_back(sampler_register);
|
shader_code_.push_back(sampler_register);
|
||||||
|
@ -2466,8 +2471,10 @@ void DxbcShaderTranslator::ProcessTextureFetchInstruction(
|
||||||
shader_code_.push_back(coord_temp);
|
shader_code_.push_back(coord_temp);
|
||||||
shader_code_.push_back(EncodeVectorSwizzledOperand(
|
shader_code_.push_back(EncodeVectorSwizzledOperand(
|
||||||
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(1 + srv_index_current);
|
||||||
shader_code_.push_back(srv_register_current);
|
shader_code_.push_back(
|
||||||
|
uint32_t(SRVMainRegister::kBoundTexturesStart) +
|
||||||
|
srv_index_current);
|
||||||
shader_code_.push_back(EncodeZeroComponentOperand(
|
shader_code_.push_back(EncodeZeroComponentOperand(
|
||||||
D3D10_SB_OPERAND_TYPE_SAMPLER, 2));
|
D3D10_SB_OPERAND_TYPE_SAMPLER, 2));
|
||||||
shader_code_.push_back(sampler_register);
|
shader_code_.push_back(sampler_register);
|
||||||
|
|
Loading…
Reference in New Issue