diff options
| author | Anders Leino <aleino@nvidia.com> | 2025-03-12 13:44:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-12 13:44:57 +0200 |
| commit | f4d5372d3354e62770b076b47892b5172223e98a (patch) | |
| tree | 48220e9716dd585ffa64635e977df2878fc63bdc /tests/compute | |
| parent | 7a942cfdc338d199b8e775d16b0b9b49699363d7 (diff) | |
Migrate render-test away from deprecated compile request API (#6514)
* Add a simple interface parameter test
Since there's no documentation, it's nice to have a simple test case in order to
experiment with this feature of the testing framework.
* Add shader entry point attributes to tests
* Fix specialization arguments for tests
- Add some missing arguments
- Rremove one extraneous argument.
* Stop using deprecated compile request in render-test
Use a session object instead of the deprecated compile request object.
This closes issue #4760.
Diffstat (limited to 'tests/compute')
| -rw-r--r-- | tests/compute/compile-time-loop.slang | 2 | ||||
| -rw-r--r-- | tests/compute/constexpr.slang | 2 | ||||
| -rw-r--r-- | tests/compute/discard-stmt.slang | 2 | ||||
| -rw-r--r-- | tests/compute/dynamic-dispatch-bindless-texture.slang | 1 | ||||
| -rw-r--r-- | tests/compute/interface-shader-param.slang | 2 | ||||
| -rw-r--r-- | tests/compute/simple-interface-parameter.slang | 27 | ||||
| -rw-r--r-- | tests/compute/simple-interface-parameter.slang.expected.txt | 4 | ||||
| -rw-r--r-- | tests/compute/texture-sampling-no-1d-arrays.slang | 2 |
8 files changed, 41 insertions, 1 deletions
diff --git a/tests/compute/compile-time-loop.slang b/tests/compute/compile-time-loop.slang index 9035bde2a..c70cfb1b9 100644 --- a/tests/compute/compile-time-loop.slang +++ b/tests/compute/compile-time-loop.slang @@ -45,6 +45,7 @@ struct VertexStageOutput float4 sv_position : SV_Position; }; +[shader("vertex")] VertexStageOutput vertexMain(VertexStageInput input) { VertexStageOutput output; @@ -70,6 +71,7 @@ struct FragmentStageOutput Fragment fragment : SV_Target; }; +[shader("fragment")] FragmentStageOutput fragmentMain(FragmentStageInput input) { FragmentStageOutput output; diff --git a/tests/compute/constexpr.slang b/tests/compute/constexpr.slang index f1cd76841..5370de733 100644 --- a/tests/compute/constexpr.slang +++ b/tests/compute/constexpr.slang @@ -52,6 +52,7 @@ struct VertexStageOutput float4 sv_position : SV_Position; }; +[shader("vertex")] VertexStageOutput vertexMain(VertexStageInput input) { VertexStageOutput output; @@ -77,6 +78,7 @@ struct FragmentStageOutput Fragment fragment : SV_Target; }; +[shader("fragment")] FragmentStageOutput fragmentMain(FragmentStageInput input) { // The texel offset argument to `Texture2D.Sample` is diff --git a/tests/compute/discard-stmt.slang b/tests/compute/discard-stmt.slang index fa00c9ec3..6988d611b 100644 --- a/tests/compute/discard-stmt.slang +++ b/tests/compute/discard-stmt.slang @@ -46,6 +46,7 @@ struct VertexStageOutput float4 sv_position : SV_Position; }; +[shader("vertex")] VertexStageOutput vertexMain(VertexStageInput input) { VertexStageOutput output; @@ -71,6 +72,7 @@ struct FragmentStageOutput Fragment fragment : SV_Target; }; +[shader("fragment")] FragmentStageOutput fragmentMain(FragmentStageInput input) { FragmentStageOutput output; diff --git a/tests/compute/dynamic-dispatch-bindless-texture.slang b/tests/compute/dynamic-dispatch-bindless-texture.slang index 34ef67d1e..b02ca9686 100644 --- a/tests/compute/dynamic-dispatch-bindless-texture.slang +++ b/tests/compute/dynamic-dispatch-bindless-texture.slang @@ -25,7 +25,6 @@ void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) gOutputBuffer[tid] = uint(trunc(outputVal)); } -//TEST_INPUT: globalExistentialType __Dynamic // Type must be marked `public` to ensure it is visible in the generated DLL. export struct MyImpl : IInterface diff --git a/tests/compute/interface-shader-param.slang b/tests/compute/interface-shader-param.slang index 7965253b2..58e477fcb 100644 --- a/tests/compute/interface-shader-param.slang +++ b/tests/compute/interface-shader-param.slang @@ -84,6 +84,7 @@ RWStructuredBuffer<int> gOutputBuffer; // Now we'll define a global shader parameter for the // random number generation strategy. // +//TEST_INPUT: globalSpecializationArg MyStrategy //TEST_INPUT:set gStrategy = new MyStrategy{} uniform IRandomNumberGenerationStrategy gStrategy; @@ -93,6 +94,7 @@ uniform IRandomNumberGenerationStrategy gStrategy; // [numthreads(4, 1, 1)] void computeMain( +//TEST_INPUT: entryPointSpecializationArg MyModifier //TEST_INPUT:set modifier = new MyModifier{} uniform IModifier modifier, int3 dispatchThreadID : SV_DispatchThreadID) diff --git a/tests/compute/simple-interface-parameter.slang b/tests/compute/simple-interface-parameter.slang new file mode 100644 index 000000000..067fb621f --- /dev/null +++ b/tests/compute/simple-interface-parameter.slang @@ -0,0 +1,27 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute + +interface IGetter +{ + int get(int x); +} + +//TEST_INPUT:set gOutputBuffer = out ubuffer(data=[0 0 0 0], stride=4) +RWStructuredBuffer<int> gOutputBuffer; + +//TEST_INPUT: globalSpecializationArg MyGetter +//TEST_INPUT: set gGetter = new MyGetter{} +uniform IGetter gGetter; + +[numthreads(4, 1, 1)] +void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) +{ + gOutputBuffer[dispatchThreadID.x] = gGetter.get(dispatchThreadID.x); +} + +struct MyGetter : IGetter +{ + int get(int x) + { + return x + 1; + } +} diff --git a/tests/compute/simple-interface-parameter.slang.expected.txt b/tests/compute/simple-interface-parameter.slang.expected.txt new file mode 100644 index 000000000..94ebaf900 --- /dev/null +++ b/tests/compute/simple-interface-parameter.slang.expected.txt @@ -0,0 +1,4 @@ +1 +2 +3 +4 diff --git a/tests/compute/texture-sampling-no-1d-arrays.slang b/tests/compute/texture-sampling-no-1d-arrays.slang index f95050fca..0985374cc 100644 --- a/tests/compute/texture-sampling-no-1d-arrays.slang +++ b/tests/compute/texture-sampling-no-1d-arrays.slang @@ -60,6 +60,7 @@ struct VertexStageOutput float4 sv_position : SV_Position; }; +[shader("vertex")] VertexStageOutput vertexMain(VertexStageInput input) { VertexStageOutput output; @@ -85,6 +86,7 @@ struct FragmentStageOutput Fragment fragment : SV_Target; }; +[shader("fragment")] FragmentStageOutput fragmentMain(FragmentStageInput input) { FragmentStageOutput output; |
