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 | |
| 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')
28 files changed, 70 insertions, 2 deletions
diff --git a/tests/bugs/texture2d-gather.hlsl b/tests/bugs/texture2d-gather.hlsl index 7344d863d..46f921b26 100644 --- a/tests/bugs/texture2d-gather.hlsl +++ b/tests/bugs/texture2d-gather.hlsl @@ -31,6 +31,7 @@ struct VertexStageOutput float4 position : SV_Position; }; +[shader("vertex")] VertexStageOutput vertexMain(VertexStageInput input) { VertexStageOutput output; @@ -41,7 +42,7 @@ VertexStageOutput vertexMain(VertexStageInput input) return output; } -// Fragment Shader +[shader("fragment")] float4 fragmentMain(VertexStageOutput input) : SV_Target { return g_texture.GatherRed(g_sampler, input.color.xy); 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; diff --git a/tests/glsl-intrinsic/shader-invocation-group/shader-invocation-group.slang b/tests/glsl-intrinsic/shader-invocation-group/shader-invocation-group.slang index 201f33ea2..d68979675 100644 --- a/tests/glsl-intrinsic/shader-invocation-group/shader-invocation-group.slang +++ b/tests/glsl-intrinsic/shader-invocation-group/shader-invocation-group.slang @@ -34,6 +34,8 @@ bool testAllInvocationsEqual() && allInvocationsEqual(gl_GlobalInvocationID.x == 0) == false ; } + +[shader("compute")] void computeMain() { outputBuffer.data[0] = true diff --git a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_Exclusive.slang b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_Exclusive.slang index 0a0fcade5..c77fa5929 100644 --- a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_Exclusive.slang +++ b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_Exclusive.slang @@ -183,6 +183,7 @@ bool testArithmetic() { ; } +[shader("compute")] void computeMain() { diff --git a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_Inclusive.slang b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_Inclusive.slang index 58c7d5aaa..40f77ee61 100644 --- a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_Inclusive.slang +++ b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_Inclusive.slang @@ -183,6 +183,7 @@ bool testArithmetic() { ; } +[shader("compute")] void computeMain() { diff --git a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_None.slang b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_None.slang index bb6316a59..4bea35b6e 100644 --- a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_None.slang +++ b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_None.slang @@ -182,6 +182,7 @@ bool testArithmetic() { ; } +[shader("compute")] void computeMain() { diff --git a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-ballot.slang b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-ballot.slang index 04f1b935a..82fb38f5e 100644 --- a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-ballot.slang +++ b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-ballot.slang @@ -139,6 +139,7 @@ bool testBallot() { ; } +[shader("compute")] void computeMain() { outputBuffer.data[0] = true diff --git a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-builtin-variables-2.slang b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-builtin-variables-2.slang index 2e3896cc5..aceff939b 100644 --- a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-builtin-variables-2.slang +++ b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-builtin-variables-2.slang @@ -16,6 +16,7 @@ buffer MyBlockName2 layout(local_size_x = 4) in; +[shader("compute")] void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) { // There may be some issues with structure padding for global context containing diff --git a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-builtin-variables.slang b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-builtin-variables.slang index 2d11ca5fb..bfef48374 100644 --- a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-builtin-variables.slang +++ b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-builtin-variables.slang @@ -25,6 +25,7 @@ buffer MyBlockName2 layout(local_size_x = 32) in; +[shader("compute")] void computeMain() { if (gl_GlobalInvocationID.x == 3) { diff --git a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-vote.slang b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-vote.slang index c0b6e3788..23466b742 100644 --- a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-vote.slang +++ b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-vote.slang @@ -126,6 +126,7 @@ void _barrier() #endif } +[shader("compute")] void computeMain() { //seperate tests since testing concurrency diff --git a/tests/glsl/ssbo.slang b/tests/glsl/ssbo.slang index 4f4db07cd..1eb2722ff 100644 --- a/tests/glsl/ssbo.slang +++ b/tests/glsl/ssbo.slang @@ -17,6 +17,7 @@ buffer MyBlockName2 } outputBuffer; layout(local_size_x = 4) in; +[shader("compute")] void computeMain() { outputBuffer.data[gl_GlobalInvocationID.x] = inputBuffer.data[gl_GlobalInvocationID.x]; diff --git a/tests/language-feature/shader-params/interface-shader-param-ordinary.slang b/tests/language-feature/shader-params/interface-shader-param-ordinary.slang index 7196f9b04..fa4657d76 100644 --- a/tests/language-feature/shader-params/interface-shader-param-ordinary.slang +++ b/tests/language-feature/shader-params/interface-shader-param-ordinary.slang @@ -23,6 +23,7 @@ RWStructuredBuffer<int> gOutputBuffer; //TEST_INPUT:set delta = 65536 uniform int delta; +//TEST_INPUT: globalSpecializationArg MyModifier //TEST_INPUT:set gModifier = new MyModifier{ ubuffer(data=[4 3 2 1], stride=4), 3 } } uniform IModifier gModifier; diff --git a/tests/pipeline/rasterization/mesh/task-groupshared.slang b/tests/pipeline/rasterization/mesh/task-groupshared.slang index 46334bf3e..4d88de780 100644 --- a/tests/pipeline/rasterization/mesh/task-groupshared.slang +++ b/tests/pipeline/rasterization/mesh/task-groupshared.slang @@ -32,6 +32,7 @@ struct MeshPayload groupshared MeshPayload p; [numthreads(1, 1, 1)] +[shader("amplification")] void taskMain(in uint tig : SV_GroupIndex) { p.exponent = 3; diff --git a/tests/pipeline/rasterization/mesh/task-simple.slang b/tests/pipeline/rasterization/mesh/task-simple.slang index 053b24045..61cc6da3d 100644 --- a/tests/pipeline/rasterization/mesh/task-simple.slang +++ b/tests/pipeline/rasterization/mesh/task-simple.slang @@ -35,6 +35,7 @@ struct MeshPayload }; [numthreads(1, 1, 1)] +[shader("amplification")] void taskMain(in uint tig : SV_GroupIndex) { MeshPayload p; diff --git a/tests/render/cross-compile-entry-point.slang b/tests/render/cross-compile-entry-point.slang index d8cb687c5..3b5faa111 100644 --- a/tests/render/cross-compile-entry-point.slang +++ b/tests/render/cross-compile-entry-point.slang @@ -50,6 +50,7 @@ struct VertexStageOutput float4 sv_position : SV_Position; }; +[shader("vertex")] VertexStageOutput vertexMain(VertexStageInput input) { VertexStageOutput output; @@ -76,6 +77,7 @@ struct FragmentStageOutput Fragment fragment : SV_Target; }; +[shader("fragment")] FragmentStageOutput fragmentMain(FragmentStageInput input) { FragmentStageOutput output; diff --git a/tests/render/cross-compile0.hlsl b/tests/render/cross-compile0.hlsl index 1d33b68bf..1820a17f0 100644 --- a/tests/render/cross-compile0.hlsl +++ b/tests/render/cross-compile0.hlsl @@ -45,6 +45,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/render/imported-parameters.hlsl b/tests/render/imported-parameters.hlsl index 495ff8da2..1ed27bfa0 100644 --- a/tests/render/imported-parameters.hlsl +++ b/tests/render/imported-parameters.hlsl @@ -38,6 +38,7 @@ struct VertexStageOutput float4 sv_position : SV_Position; }; +[shader("vertex")] VertexStageOutput vertexMain(VertexStageInput input) { VertexStageOutput output; @@ -64,6 +65,7 @@ struct FragmentStageOutput Fragment fragment : SV_Target; }; +[shader("fragment")] FragmentStageOutput fragmentMain(FragmentStageInput input) { FragmentStageOutput output; diff --git a/tests/render/multiple-stage-io-locations-without-user-semantics.slang b/tests/render/multiple-stage-io-locations-without-user-semantics.slang index af0e3e39f..585b8e34e 100644 --- a/tests/render/multiple-stage-io-locations-without-user-semantics.slang +++ b/tests/render/multiple-stage-io-locations-without-user-semantics.slang @@ -31,6 +31,7 @@ struct VertexStageOutput float4 sv_position : SV_Position; }; +[shader("vertex")] VertexStageOutput vertexMain(VertexStageInput input) { VertexStageOutput output; @@ -58,6 +59,7 @@ struct FragmentStageOutput Fragment fragment : SV_Target; }; +[shader("fragment")] FragmentStageOutput fragmentMain(FragmentStageInput input) { FragmentStageOutput output; diff --git a/tests/render/multiple-stage-io-locations.slang b/tests/render/multiple-stage-io-locations.slang index 9f74d1398..5e27a9cf1 100644 --- a/tests/render/multiple-stage-io-locations.slang +++ b/tests/render/multiple-stage-io-locations.slang @@ -32,6 +32,7 @@ struct VertexStageOutput float4 sv_position : SV_Position; }; +[shader("vertex")] VertexStageOutput vertexMain(VertexStageInput input) { VertexStageOutput output; @@ -59,6 +60,7 @@ struct FragmentStageOutput Fragment fragment : SV_Target; }; +[shader("fragment")] FragmentStageOutput fragmentMain(FragmentStageInput input) { FragmentStageOutput output; diff --git a/tests/render/nointerpolation.hlsl b/tests/render/nointerpolation.hlsl index d514379d0..145bd3bed 100644 --- a/tests/render/nointerpolation.hlsl +++ b/tests/render/nointerpolation.hlsl @@ -41,6 +41,7 @@ struct VertexStageOutput float4 sv_position : SV_Position; }; +[shader("vertex")] VertexStageOutput vertexMain(VertexStageInput input) { VertexStageOutput output; @@ -66,6 +67,7 @@ struct FragmentStageOutput Fragment fragment : SV_Target; }; +[shader("fragment")] FragmentStageOutput fragmentMain(FragmentStageInput input) { FragmentStageOutput output; diff --git a/tests/render/render0.hlsl b/tests/render/render0.hlsl index 90ca42430..9fd169b06 100644 --- a/tests/render/render0.hlsl +++ b/tests/render/render0.hlsl @@ -38,6 +38,7 @@ struct VertexStageOutput float4 sv_position : SV_Position; }; +[shader("vertex")] VertexStageOutput vertexMain(VertexStageInput input) { VertexStageOutput output; @@ -63,6 +64,7 @@ struct FragmentStageOutput Fragment fragment : SV_Target; }; +[shader("fragment")] FragmentStageOutput fragmentMain(FragmentStageInput input) { FragmentStageOutput output; |
