[D3D12] Change root signature to allow vfetch in pixel shaders

This commit is contained in:
Triang3l 2018-08-30 14:02:32 +03:00
parent ac9d3d0b59
commit 501bec8e5e
2 changed files with 4 additions and 4 deletions

View File

@ -225,7 +225,7 @@ ID3D12RootSignature* D3D12CommandProcessor::GetRootSignature(
parameter.ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; parameter.ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
parameter.DescriptorTable.NumDescriptorRanges = 1; parameter.DescriptorTable.NumDescriptorRanges = 1;
parameter.DescriptorTable.pDescriptorRanges = ⦥ parameter.DescriptorTable.pDescriptorRanges = ⦥
parameter.ShaderVisibility = D3D12_SHADER_VISIBILITY_VERTEX; parameter.ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
range.RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV; range.RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
range.NumDescriptors = 1; range.NumDescriptors = 1;
range.BaseShaderRegister = 0; range.BaseShaderRegister = 0;
@ -245,7 +245,7 @@ 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 = pixel_texture_count; range.NumDescriptors = pixel_texture_count;
range.BaseShaderRegister = 0; range.BaseShaderRegister = 1;
range.RegisterSpace = 0; range.RegisterSpace = 0;
range.OffsetInDescriptorsFromTableStart = 0; range.OffsetInDescriptorsFromTableStart = 0;
++desc.NumParameters; ++desc.NumParameters;

View File

@ -228,10 +228,10 @@ std::vector<uint8_t> HlslShaderTranslator::CompleteTranslation() {
srv_name_suffix = "2d"; srv_name_suffix = "2d";
break; break;
} }
// t0 is shared memory in vertex shaders. // t0 is shared memory for vfetch, so textures start from t1.
source.AppendFormat("Texture%s<float4> xe_texture%u_%s : register(t%u);\n", source.AppendFormat("Texture%s<float4> xe_texture%u_%s : register(t%u);\n",
srv_type_dimension, srv.fetch_constant, srv_name_suffix, srv_type_dimension, srv.fetch_constant, srv_name_suffix,
i + (is_vertex_shader() ? 1 : 0)); i + 1);
} }
for (uint32_t i = 0; i < sampler_count_; ++i) { for (uint32_t i = 0; i < sampler_count_; ++i) {
source.AppendFormat("SamplerState xe_sampler%u : register(s%u);\n", source.AppendFormat("SamplerState xe_sampler%u : register(s%u);\n",