Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tests/FiveStar.Shaders.Tests/Cases/ComputeCase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public sealed record ComputeCase(string Name, string Program, int Outputs, Func<
/// <summary>Textures at their heap slots; a writable one is read back for <see cref="Check"/> under its slot.</summary>
public IReadOnlyList<TextureResource> Textures { get; init; } = [];

/// <summary>Samplers at their heap slots: the desktop sampler a literal S# reads (unbound slots differ per driver).</summary>
public IReadOnlyList<SamplerResource> Samplers { get; init; } = [];

public int LdsBytes { get; init; }

public bool Raw { get; init; }
Expand Down
6 changes: 3 additions & 3 deletions tests/FiveStar.Shaders.Tests/Cases/ComputeCaseRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public IReadOnlyList<string> RunDirect(ComputeCase testCase)
var output = new BufferResource(ComputeCase.OutputHeap, [.. Enumerable.Repeat(testCase.Fill, testCase.TotalThreads * testCase.Outputs)], Writable: true);

var ring = new BufferResource(ProbeRingSlot, new uint[(MeshProbe.RecordsOffset / sizeof(uint)) + (ProbeRecords * MeshProbeRecord.Dwords)], Writable: true);
var bindings = new Bindings { UserSgprs = user[..ComputeCase.UserSgprCount], Buffers = [output, ring, .. testCase.Buffers], Textures = testCase.Textures };
var bindings = new Bindings { UserSgprs = user[..ComputeCase.UserSgprCount], Buffers = [output, ring, .. testCase.Buffers], Textures = testCase.Textures, Samplers = testCase.Samplers };
var (x, y, z) = testCase.Groups;
var result = _fixture.Runner.Compute(new ComputeJob(shader, x, y, z, bindings));

Expand All @@ -130,7 +130,7 @@ public IReadOnlyList<string> RunDirect(ComputeCase testCase)
uint[] user = [.. ComputeCase.Descriptor(ComputeCase.OutputHeap), .. testCase.SecondDescriptor, .. testCase.User, .. new uint[ComputeCase.UserSgprCount]];
var output = new BufferResource(ComputeCase.OutputHeap, [.. Enumerable.Repeat(testCase.Fill, testCase.TotalThreads * testCase.Outputs)], Writable: true);
var table = new BufferResource(ProbeRingSlot, new uint[Slots * SlotDwords], Writable: true);
var bindings = new Bindings { UserSgprs = user[..ComputeCase.UserSgprCount], Buffers = [output, table, .. testCase.Buffers], Textures = testCase.Textures };
var bindings = new Bindings { UserSgprs = user[..ComputeCase.UserSgprCount], Buffers = [output, table, .. testCase.Buffers], Textures = testCase.Textures, Samplers = testCase.Samplers };

var (x, y, z) = testCase.Groups;
var result = _fixture.Runner.Compute(new ComputeJob(shader, x, y, z, bindings));
Expand Down Expand Up @@ -158,7 +158,7 @@ private List<string> Run(ComputeCase testCase, Func<ShaderProgram, string>? vari
var shader = Build(testCase, variant, direct);
uint[] user = [.. ComputeCase.Descriptor(ComputeCase.OutputHeap), .. testCase.SecondDescriptor, .. testCase.User, .. new uint[ComputeCase.UserSgprCount]];
var output = new BufferResource(ComputeCase.OutputHeap, [.. Enumerable.Repeat(testCase.Fill, testCase.TotalThreads * testCase.Outputs)], Writable: true);
var bindings = new Bindings { UserSgprs = user[..ComputeCase.UserSgprCount], Buffers = [output, .. testCase.Buffers], Textures = testCase.Textures };
var bindings = new Bindings { UserSgprs = user[..ComputeCase.UserSgprCount], Buffers = [output, .. testCase.Buffers], Textures = testCase.Textures, Samplers = testCase.Samplers };
var (x, y, z) = testCase.Groups;
var result = _fixture.Runner.Compute(new ComputeJob(shader, x, y, z, bindings));

Expand Down
2 changes: 1 addition & 1 deletion tests/FiveStar.Shaders.Tests/Cases/PixelMemoryCases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ private static uint Lit(int texel)
}

/// <summary>The desktop sampler a literal S# gets, at its slot (StaticSampler, DesktopSampler).</summary>
private static SamplerResource LiteralSampler(uint[] words, bool comparison)
internal static SamplerResource LiteralSampler(uint[] words, bool comparison)
{
var description = System.Runtime.InteropServices.MemoryMarshal.Cast<uint, Vortice.Direct3D12.SamplerDescription>(Translation.DesktopSampler.Describe(words, comparison))[0];

Expand Down
3 changes: 3 additions & 0 deletions tests/FiveStar.Shaders.Tests/Cases/TypedViewCases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ s_waitcnt vmcnt(0)
{
User = [TextureHeap, 0, 0, viewClass],
Textures = [new TextureResource(TextureHeap, format, Width, Height, texels)],

// The gather reads its literal S#'s desktop sampler: unbound, WARP clamps the edge lanes and NVIDIA wraps them.
Samplers = [PixelMemoryCases.LiteralSampler([0x92, 0xc00000, 0x4000000, 0], comparison: false)],
};
}
}