[D3D12] Make SHM t0 and textures t1+ in VS as in DXBC SHM will be added first

This commit is contained in:
Triang3l 2018-08-28 17:42:11 +03:00
parent b3650a4b66
commit 443e371a94
2 changed files with 7 additions and 6 deletions

View File

@ -229,7 +229,7 @@ ID3D12RootSignature* D3D12CommandProcessor::GetRootSignature(
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;
range.RegisterSpace = 1; range.RegisterSpace = 0;
range.OffsetInDescriptorsFromTableStart = 0; range.OffsetInDescriptorsFromTableStart = 0;
} }
@ -277,7 +277,7 @@ ID3D12RootSignature* D3D12CommandProcessor::GetRootSignature(
parameter.ShaderVisibility = D3D12_SHADER_VISIBILITY_VERTEX; parameter.ShaderVisibility = D3D12_SHADER_VISIBILITY_VERTEX;
range.RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV; range.RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
range.NumDescriptors = vertex_texture_count; range.NumDescriptors = vertex_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,9 +228,10 @@ std::vector<uint8_t> HlslShaderTranslator::CompleteTranslation() {
srv_name_suffix = "2d"; srv_name_suffix = "2d";
break; break;
} }
source.AppendFormat( // t0 is shared memory in vertex shaders.
"Texture%s<float4> xe_texture%u_%s : register(t%u, space0);\n", source.AppendFormat("Texture%s<float4> xe_texture%u_%s : register(t%u);\n",
srv_type_dimension, srv.fetch_constant, srv_name_suffix, i); srv_type_dimension, srv.fetch_constant, srv_name_suffix,
i + (is_vertex_shader() ? 1 : 0));
} }
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",
@ -250,7 +251,7 @@ std::vector<uint8_t> HlslShaderTranslator::CompleteTranslation() {
// -1 point size means the geometry shader will use the global setting by // -1 point size means the geometry shader will use the global setting by
// default. // default.
source.AppendFormat( source.AppendFormat(
"ByteAddressBuffer xe_shared_memory : register(t0, space1);\n" "ByteAddressBuffer xe_shared_memory : register(t0);\n"
"\n" "\n"
"#define XE_BYTE_SWAP_OVERLOAD(XeByteSwapType) \\\n" "#define XE_BYTE_SWAP_OVERLOAD(XeByteSwapType) \\\n"
"XeByteSwapType XeByteSwap(XeByteSwapType v, uint endian) { \\\n" "XeByteSwapType XeByteSwap(XeByteSwapType v, uint endian) { \\\n"