Fixed pixel shader dispatching with multiple textures

このコミットが含まれているのは:
Sergio Pedri committed 2021-05-11 01:54:37 +02:00
1 親 3a29a14df6
コミット 3578f00eb9
2ファイル変更
+14 -4

検索条件に一致するファイルはありません

+8 -2
ファイルの表示
@@ -1,7 +1,10 @@
using System;
using ComputeSharp.Core.Extensions;
using TerraFX.Interop;
using static TerraFX.Interop.D3D12_COMPARISON_FUNC;
using static TerraFX.Interop.D3D12_FILTER;
using static TerraFX.Interop.D3D12_PIPELINE_STATE_FLAGS;
using static TerraFX.Interop.D3D12_TEXTURE_ADDRESS_MODE;
using FX = TerraFX.Interop.Windows;
namespace ComputeSharp.Shaders.Extensions
@@ -52,8 +55,11 @@ namespace ComputeSharp.Shaders.Extensions
D3D12_STATIC_SAMPLER_DESC.Init(
out d3D12SamplerDescription,
shaderRegister: 0,
filter: D3D12_FILTER.D3D12_FILTER_MIN_MAG_MIP_LINEAR,
comparisonFunc: D3D12_COMPARISON_FUNC.D3D12_COMPARISON_FUNC_NEVER);
filter: D3D12_FILTER_MIN_MAG_MIP_LINEAR,
addressU: D3D12_TEXTURE_ADDRESS_MODE_MIRROR,
addressV: D3D12_TEXTURE_ADDRESS_MODE_MIRROR,
addressW: D3D12_TEXTURE_ADDRESS_MODE_MIRROR,
comparisonFunc: D3D12_COMPARISON_FUNC_NEVER);
}
// Root signature description wrapping the packed collection of root parameters
+6 -2
ファイルの表示
@@ -241,9 +241,13 @@ namespace ComputeSharp.Shaders
1,
((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuDescriptorHandle(device));
ReadOnlySpan<D3D12_GPU_DESCRIPTOR_HANDLE> resources = dispatchData.Resources;
// Skip the last (missing) resource, as the internal counter is exceeding the number of explicit
// resources that the shader has actually captured (since it includes the target texture too).
// For the same reason, the target root descriptor table index is also offset by 2, as it needs
// to skip not only the constant buffer with capture values, but the implicit texture as well.
ReadOnlySpan<D3D12_GPU_DESCRIPTOR_HANDLE> resources = dispatchData.Resources[..^1];
for (int i = 1; i < resources.Length; i++)
for (int i = 0; i < resources.Length; i++)
{
// Load the captured buffers
commandList.D3D12GraphicsCommandList->SetComputeRootDescriptorTable((uint)i + 2, resources[i]);