Fix incorrect resource count in dispatch data

このコミットが含まれているのは:
Sergio Pedri committed 2023-10-14 01:08:06 +02:00
1 親 a724cb3efe
コミット 0919e5b1b4
3ファイル変更
+6 -5

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

@@ -24,12 +24,10 @@ partial class IShaderGenerator
using (writer.WriteBlock())
{
int numberOfResources = info.ResourceDescriptors.Length;
writer.WriteLine($"global::System.Span<uint> span0 = stackalloc uint[{info.Root32BitConstantCount}];");
writer.WriteLineIf($"global::System.Span<ulong> span1 = stackalloc ulong[{numberOfResources}];", numberOfResources > 0);
writer.WriteLineIf($"global::System.Span<ulong> span1 = stackalloc ulong[{info.ResourceCount}];", info.ResourceCount > 0);
writer.WriteLine("ref uint r0 = ref span0[0];");
writer.WriteLineIf("ref ulong r1 = ref span1[0];", numberOfResources > 0);
writer.WriteLineIf("ref ulong r1 = ref span1[0];", info.ResourceCount > 0);
// Append the statements for the dispatch ranges
writer.WriteLine("span0[0] = (uint)x;");
@@ -94,7 +92,7 @@ partial class IShaderGenerator
// Load the prepared buffers
writer.WriteLine("loader.LoadCapturedValues(span0);");
writer.WriteLineIf("loader.LoadCapturedResources(span1);", numberOfResources > 0);
writer.WriteLineIf("loader.LoadCapturedResources(span1);", info.ResourceCount > 0);
}
}
}
+1
ファイルの表示
@@ -125,6 +125,7 @@ public sealed partial class IShaderGenerator : IIncrementalGenerator
IsSamplerUsed: isSamplerUsed,
Fields: fieldInfos,
ResourceDescriptors: resourceDescriptors,
ResourceCount: resourceCount,
Root32BitConstantCount: root32BitConstantCount,
HlslInfoKey: hlslInfoKey,
HlslInfo: hlslInfo,
+2
ファイルの表示
@@ -14,6 +14,7 @@ namespace ComputeSharp.SourceGenerators.Models;
/// <param name="IsSamplerUsed">Whether or not the static sampler is used.</param>
/// <param name="Fields">The description on shader instance fields.</param>
/// <param name="ResourceDescriptors">The sequence of resource descriptors for the shader.</param>
/// <param name="ResourceCount">The total number of captured resources in the shader.</param>
/// <param name="Root32BitConstantCount">The size of the shader root signature, in 32 bit constants.</param>
/// <param name="HlslInfoKey">The key with processed info on the shader.</param>
/// <param name="HlslInfo">The value with processed info on the shader.</param>
@@ -27,6 +28,7 @@ internal sealed record ShaderInfo(
bool IsSamplerUsed,
EquatableArray<FieldInfo> Fields,
EquatableArray<ResourceDescriptor> ResourceDescriptors,
int ResourceCount,
int Root32BitConstantCount,
HlslBytecodeInfoKey HlslInfoKey,
HlslBytecodeInfo HlslInfo,