forked from shader-slang/slang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Varying inputs and outputs for wgsl (shader-slang#5669)
Closes shader-slang#5067 New tests, covering what's declared supported in the WGSL support docs - tests/wgsl/semantic-coverage.slang - tests/wgsl/semantic-depth.slang - tests/wgsl/semantic-dispatch-thread-id.slang - tests/wgsl/semantic-group-id.slang - tests/wgsl/semantic-group-index.slang - tests/wgsl/semantic-group-thread-id.slang - tests/wgsl/semantic-instance-id.slang - tests/wgsl/semantic-is-front-face.slang - tests/wgsl/semantic-position.slang - tests/wgsl/semantic-sample-index.slang - tests/wgsl/semantic-vertex-id.slang WGSL enabled existing tests: - tests/compute/compile-time-loop.slang - tests/compute/constexpr.slang - tests/compute/discard-stmt.slang - tests/metal/nested-struct-fragment-input.slang - tests/metal/nested-struct-fragment-output.slang - tests/metal/nested-struct-multi-entry-point-vertex.slang - tests/metal/no-struct-vertex-output.slang - tests/metal/sv_target-complex-1.slang - tests/metal/sv_target-complex-2.slang - tests/bugs/texture2d-gather.hlsl - tests/render/cross-compile-entry-point.slang - tests/render/nointerpolation.hlsl - tests/render/render0.hlsl - tests/render/cross-compile0.hlsl - tests/render/imported-parameters.hlsl - tests/render/unused-discard.hlsl Can't be enabled due to missing wgsl features - tests/compute/texture-sampling.slang Co-authored-by: Yong He <[email protected]>
- Loading branch information
1 parent
0586e5a
commit 7aaf700
Showing
18 changed files
with
200 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
//TEST:SIMPLE(filecheck=METAL): -target metallib -stage vertex -entry vertexMain | ||
//TEST:SIMPLE(filecheck=METALLIB): -target metallib -stage vertex -entry vertexMain | ||
//TEST:SIMPLE(filecheck=WGSL): -target wgsl -stage vertex -entry vertexMain | ||
|
||
//METAL-DAG: position | ||
//METALLIB: @vertexMain | ||
|
||
//WGSL-DAG: @builtin(position) | ||
//WGSL-DAG: @vertex | ||
|
||
// Vertex Shader | ||
|
||
float4 vertexMain() | ||
{ | ||
return float4(1,1,1,1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//TEST:SIMPLE(filecheck=WGSL): -target wgsl -stage fragment -entry main | ||
|
||
//WGSL-DAG: @builtin(sample_mask) | ||
//WGSL-DAG: @fragment | ||
|
||
struct Out | ||
{ | ||
uint coverage : SV_Coverage; | ||
}; | ||
|
||
Out main() | ||
{ | ||
Out output; | ||
output.coverage = 1; | ||
return output; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//TEST:SIMPLE(filecheck=WGSL): -target wgsl -stage fragment -entry main | ||
|
||
//WGSL-DAG: @builtin(frag_depth) | ||
//WGSL-DAG: @fragment | ||
|
||
struct Out | ||
{ | ||
float depth : SV_Depth; | ||
}; | ||
|
||
Out main() | ||
{ | ||
Out output; | ||
output.depth = 1.0; | ||
return output; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//TEST:SIMPLE(filecheck=WGSL): -target wgsl -stage compute -entry main | ||
|
||
//WGSL-DAG: @builtin(global_invocation_id) | ||
//WGSL-DAG: @compute | ||
|
||
void main(uint3 dtid : SV_DispatchThreadID) | ||
{ | ||
// Empty compute shader | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//TEST:SIMPLE(filecheck=WGSL): -target wgsl -stage compute -entry main | ||
|
||
//WGSL-DAG: @builtin(workgroup_id) | ||
//WGSL-DAG: @compute | ||
|
||
void main(uint3 gid : SV_GroupID) | ||
{ | ||
// Empty compute shader | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//TEST:SIMPLE(filecheck=WGSL): -target wgsl -stage compute -entry main | ||
|
||
//WGSL-DAG: @builtin(local_invocation_index) | ||
//WGSL-DAG: @compute | ||
|
||
void main(uint idx : SV_GroupIndex) | ||
{ | ||
// Empty compute shader | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//TEST:SIMPLE(filecheck=WGSL): -target wgsl -stage compute -entry main | ||
|
||
//WGSL-DAG: @builtin(local_invocation_id) | ||
//WGSL-DAG: @compute | ||
|
||
void main(uint3 gtid : SV_GroupThreadID) | ||
{ | ||
// Empty compute shader | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//TEST:SIMPLE(filecheck=WGSL): -target wgsl -stage vertex -entry main | ||
|
||
//WGSL-DAG: @builtin(instance_index) | ||
//WGSL-DAG: @vertex | ||
|
||
float4 main(uint instanceID : SV_InstanceID) : SV_Position | ||
{ | ||
return float4(1,1,1,1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//TEST:SIMPLE(filecheck=WGSL): -target wgsl -stage fragment -entry main | ||
|
||
//WGSL-DAG: @builtin(front_facing) | ||
//WGSL-DAG: @fragment | ||
|
||
float4 main(bool isFront : SV_IsFrontFace) : SV_Target | ||
{ | ||
return float4(1,1,1,1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//TEST:SIMPLE(filecheck=WGSL): -target wgsl -stage vertex -entry main | ||
|
||
//WGSL-DAG: @builtin(position) | ||
//WGSL-DAG: @vertex | ||
|
||
struct S | ||
{ | ||
float4 position : SV_Position; | ||
}; | ||
|
||
S main() | ||
{ | ||
S output; | ||
output.position = float4(0,0,0,1); | ||
return output; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//TEST:SIMPLE(filecheck=WGSL): -target wgsl -stage fragment -entry main | ||
|
||
//WGSL-DAG: @builtin(sample_index) | ||
//WGSL-DAG: @fragment | ||
|
||
float4 main(uint sampleIndex : SV_SampleIndex) : SV_Target | ||
{ | ||
return float4(1,1,1,1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//TEST:SIMPLE(filecheck=WGSL): -target wgsl -stage vertex -entry main | ||
|
||
//WGSL-DAG: @builtin(vertex_index) | ||
//WGSL-DAG: @vertex | ||
|
||
float4 main(uint vertexID : SV_VertexID) : SV_Position | ||
{ | ||
return float4(1,1,1,1); | ||
} |