Skip to content

Commit f4d5372

Browse files
authored
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.
1 parent 7a942cf commit f4d5372

30 files changed

+421
-153
lines changed

tests/bugs/texture2d-gather.hlsl

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct VertexStageOutput
3131
float4 position : SV_Position;
3232
};
3333

34+
[shader("vertex")]
3435
VertexStageOutput vertexMain(VertexStageInput input)
3536
{
3637
VertexStageOutput output;
@@ -41,7 +42,7 @@ VertexStageOutput vertexMain(VertexStageInput input)
4142
return output;
4243
}
4344

44-
// Fragment Shader
45+
[shader("fragment")]
4546
float4 fragmentMain(VertexStageOutput input) : SV_Target
4647
{
4748
return g_texture.GatherRed(g_sampler, input.color.xy);

tests/compute/compile-time-loop.slang

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ struct VertexStageOutput
4545
float4 sv_position : SV_Position;
4646
};
4747

48+
[shader("vertex")]
4849
VertexStageOutput vertexMain(VertexStageInput input)
4950
{
5051
VertexStageOutput output;
@@ -70,6 +71,7 @@ struct FragmentStageOutput
7071
Fragment fragment : SV_Target;
7172
};
7273

74+
[shader("fragment")]
7375
FragmentStageOutput fragmentMain(FragmentStageInput input)
7476
{
7577
FragmentStageOutput output;

tests/compute/constexpr.slang

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ struct VertexStageOutput
5252
float4 sv_position : SV_Position;
5353
};
5454

55+
[shader("vertex")]
5556
VertexStageOutput vertexMain(VertexStageInput input)
5657
{
5758
VertexStageOutput output;
@@ -77,6 +78,7 @@ struct FragmentStageOutput
7778
Fragment fragment : SV_Target;
7879
};
7980

81+
[shader("fragment")]
8082
FragmentStageOutput fragmentMain(FragmentStageInput input)
8183
{
8284
// The texel offset argument to `Texture2D.Sample` is

tests/compute/discard-stmt.slang

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ struct VertexStageOutput
4646
float4 sv_position : SV_Position;
4747
};
4848

49+
[shader("vertex")]
4950
VertexStageOutput vertexMain(VertexStageInput input)
5051
{
5152
VertexStageOutput output;
@@ -71,6 +72,7 @@ struct FragmentStageOutput
7172
Fragment fragment : SV_Target;
7273
};
7374

75+
[shader("fragment")]
7476
FragmentStageOutput fragmentMain(FragmentStageInput input)
7577
{
7678
FragmentStageOutput output;

tests/compute/dynamic-dispatch-bindless-texture.slang

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
2525
gOutputBuffer[tid] = uint(trunc(outputVal));
2626
}
2727

28-
//TEST_INPUT: globalExistentialType __Dynamic
2928

3029
// Type must be marked `public` to ensure it is visible in the generated DLL.
3130
export struct MyImpl : IInterface

tests/compute/interface-shader-param.slang

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ RWStructuredBuffer<int> gOutputBuffer;
8484
// Now we'll define a global shader parameter for the
8585
// random number generation strategy.
8686
//
87+
//TEST_INPUT: globalSpecializationArg MyStrategy
8788
//TEST_INPUT:set gStrategy = new MyStrategy{}
8889
uniform IRandomNumberGenerationStrategy gStrategy;
8990

@@ -93,6 +94,7 @@ uniform IRandomNumberGenerationStrategy gStrategy;
9394
//
9495
[numthreads(4, 1, 1)]
9596
void computeMain(
97+
//TEST_INPUT: entryPointSpecializationArg MyModifier
9698
//TEST_INPUT:set modifier = new MyModifier{}
9799
uniform IModifier modifier,
98100
int3 dispatchThreadID : SV_DispatchThreadID)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute
2+
3+
interface IGetter
4+
{
5+
int get(int x);
6+
}
7+
8+
//TEST_INPUT:set gOutputBuffer = out ubuffer(data=[0 0 0 0], stride=4)
9+
RWStructuredBuffer<int> gOutputBuffer;
10+
11+
//TEST_INPUT: globalSpecializationArg MyGetter
12+
//TEST_INPUT: set gGetter = new MyGetter{}
13+
uniform IGetter gGetter;
14+
15+
[numthreads(4, 1, 1)]
16+
void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
17+
{
18+
gOutputBuffer[dispatchThreadID.x] = gGetter.get(dispatchThreadID.x);
19+
}
20+
21+
struct MyGetter : IGetter
22+
{
23+
int get(int x)
24+
{
25+
return x + 1;
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
1
2+
2
3+
3
4+
4

tests/compute/texture-sampling-no-1d-arrays.slang

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ struct VertexStageOutput
6060
float4 sv_position : SV_Position;
6161
};
6262

63+
[shader("vertex")]
6364
VertexStageOutput vertexMain(VertexStageInput input)
6465
{
6566
VertexStageOutput output;
@@ -85,6 +86,7 @@ struct FragmentStageOutput
8586
Fragment fragment : SV_Target;
8687
};
8788

89+
[shader("fragment")]
8890
FragmentStageOutput fragmentMain(FragmentStageInput input)
8991
{
9092
FragmentStageOutput output;

tests/glsl-intrinsic/shader-invocation-group/shader-invocation-group.slang

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ bool testAllInvocationsEqual()
3434
&& allInvocationsEqual(gl_GlobalInvocationID.x == 0) == false
3535
;
3636
}
37+
38+
[shader("compute")]
3739
void computeMain()
3840
{
3941
outputBuffer.data[0] = true

tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_Exclusive.slang

+1
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ bool testArithmetic() {
183183
;
184184
}
185185

186+
[shader("compute")]
186187
void computeMain()
187188
{
188189

tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_Inclusive.slang

+1
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ bool testArithmetic() {
183183
;
184184
}
185185

186+
[shader("compute")]
186187
void computeMain()
187188
{
188189

tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_None.slang

+1
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ bool testArithmetic() {
182182
;
183183
}
184184

185+
[shader("compute")]
185186
void computeMain()
186187
{
187188

tests/glsl-intrinsic/shader-subgroup/shader-subgroup-ballot.slang

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ bool testBallot() {
139139
;
140140
}
141141

142+
[shader("compute")]
142143
void computeMain()
143144
{
144145
outputBuffer.data[0] = true

tests/glsl-intrinsic/shader-subgroup/shader-subgroup-builtin-variables-2.slang

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ buffer MyBlockName2
1616

1717
layout(local_size_x = 4) in;
1818

19+
[shader("compute")]
1920
void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
2021
{
2122
// There may be some issues with structure padding for global context containing

tests/glsl-intrinsic/shader-subgroup/shader-subgroup-builtin-variables.slang

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ buffer MyBlockName2
2525

2626
layout(local_size_x = 32) in;
2727

28+
[shader("compute")]
2829
void computeMain()
2930
{
3031
if (gl_GlobalInvocationID.x == 3) {

tests/glsl-intrinsic/shader-subgroup/shader-subgroup-vote.slang

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ void _barrier()
126126
#endif
127127
}
128128

129+
[shader("compute")]
129130
void computeMain()
130131
{
131132
//seperate tests since testing concurrency

tests/glsl/ssbo.slang

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ buffer MyBlockName2
1717
} outputBuffer;
1818

1919
layout(local_size_x = 4) in;
20+
[shader("compute")]
2021
void computeMain()
2122
{
2223
outputBuffer.data[gl_GlobalInvocationID.x] = inputBuffer.data[gl_GlobalInvocationID.x];

tests/language-feature/shader-params/interface-shader-param-ordinary.slang

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ RWStructuredBuffer<int> gOutputBuffer;
2323
//TEST_INPUT:set delta = 65536
2424
uniform int delta;
2525

26+
//TEST_INPUT: globalSpecializationArg MyModifier
2627
//TEST_INPUT:set gModifier = new MyModifier{ ubuffer(data=[4 3 2 1], stride=4), 3 } }
2728
uniform IModifier gModifier;
2829

tests/pipeline/rasterization/mesh/task-groupshared.slang

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ struct MeshPayload
3232
groupshared MeshPayload p;
3333

3434
[numthreads(1, 1, 1)]
35+
[shader("amplification")]
3536
void taskMain(in uint tig : SV_GroupIndex)
3637
{
3738
p.exponent = 3;

tests/pipeline/rasterization/mesh/task-simple.slang

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ struct MeshPayload
3535
};
3636

3737
[numthreads(1, 1, 1)]
38+
[shader("amplification")]
3839
void taskMain(in uint tig : SV_GroupIndex)
3940
{
4041
MeshPayload p;

tests/render/cross-compile-entry-point.slang

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ struct VertexStageOutput
5050
float4 sv_position : SV_Position;
5151
};
5252

53+
[shader("vertex")]
5354
VertexStageOutput vertexMain(VertexStageInput input)
5455
{
5556
VertexStageOutput output;
@@ -76,6 +77,7 @@ struct FragmentStageOutput
7677
Fragment fragment : SV_Target;
7778
};
7879

80+
[shader("fragment")]
7981
FragmentStageOutput fragmentMain(FragmentStageInput input)
8082
{
8183
FragmentStageOutput output;

tests/render/cross-compile0.hlsl

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ struct VertexStageOutput
4545
float4 sv_position : SV_Position;
4646
};
4747

48+
[shader("vertex")]
4849
VertexStageOutput vertexMain(VertexStageInput input)
4950
{
5051
VertexStageOutput output;
@@ -71,6 +72,7 @@ struct FragmentStageOutput
7172
Fragment fragment : SV_Target;
7273
};
7374

75+
[shader("fragment")]
7476
FragmentStageOutput fragmentMain(FragmentStageInput input)
7577
{
7678
FragmentStageOutput output;

tests/render/imported-parameters.hlsl

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ struct VertexStageOutput
3838
float4 sv_position : SV_Position;
3939
};
4040

41+
[shader("vertex")]
4142
VertexStageOutput vertexMain(VertexStageInput input)
4243
{
4344
VertexStageOutput output;
@@ -64,6 +65,7 @@ struct FragmentStageOutput
6465
Fragment fragment : SV_Target;
6566
};
6667

68+
[shader("fragment")]
6769
FragmentStageOutput fragmentMain(FragmentStageInput input)
6870
{
6971
FragmentStageOutput output;

tests/render/multiple-stage-io-locations-without-user-semantics.slang

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct VertexStageOutput
3131
float4 sv_position : SV_Position;
3232
};
3333

34+
[shader("vertex")]
3435
VertexStageOutput vertexMain(VertexStageInput input)
3536
{
3637
VertexStageOutput output;
@@ -58,6 +59,7 @@ struct FragmentStageOutput
5859
Fragment fragment : SV_Target;
5960
};
6061

62+
[shader("fragment")]
6163
FragmentStageOutput fragmentMain(FragmentStageInput input)
6264
{
6365
FragmentStageOutput output;

tests/render/multiple-stage-io-locations.slang

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ struct VertexStageOutput
3232
float4 sv_position : SV_Position;
3333
};
3434

35+
[shader("vertex")]
3536
VertexStageOutput vertexMain(VertexStageInput input)
3637
{
3738
VertexStageOutput output;
@@ -59,6 +60,7 @@ struct FragmentStageOutput
5960
Fragment fragment : SV_Target;
6061
};
6162

63+
[shader("fragment")]
6264
FragmentStageOutput fragmentMain(FragmentStageInput input)
6365
{
6466
FragmentStageOutput output;

tests/render/nointerpolation.hlsl

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ struct VertexStageOutput
4141
float4 sv_position : SV_Position;
4242
};
4343

44+
[shader("vertex")]
4445
VertexStageOutput vertexMain(VertexStageInput input)
4546
{
4647
VertexStageOutput output;
@@ -66,6 +67,7 @@ struct FragmentStageOutput
6667
Fragment fragment : SV_Target;
6768
};
6869

70+
[shader("fragment")]
6971
FragmentStageOutput fragmentMain(FragmentStageInput input)
7072
{
7173
FragmentStageOutput output;

tests/render/render0.hlsl

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ struct VertexStageOutput
3838
float4 sv_position : SV_Position;
3939
};
4040

41+
[shader("vertex")]
4142
VertexStageOutput vertexMain(VertexStageInput input)
4243
{
4344
VertexStageOutput output;
@@ -63,6 +64,7 @@ struct FragmentStageOutput
6364
Fragment fragment : SV_Target;
6465
};
6566

67+
[shader("fragment")]
6668
FragmentStageOutput fragmentMain(FragmentStageInput input)
6769
{
6870
FragmentStageOutput output;

0 commit comments

Comments
 (0)