diff options
| author | ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> | 2024-08-26 19:07:10 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-26 19:07:10 -0400 |
| commit | f0ba756c2f982aac8095ff0928d048fc97548315 (patch) | |
| tree | fde40dc0975aff82b4669ff8ce7fca0a3a08f8e2 /tests/hlsl | |
| parent | 6c3261b618b88c2b996e56dea58ba4f5435b0908 (diff) | |
Fix Varying Variable Location Assignments With Hull Shaders (#4915)
* Fix Varying Variable Location Assignments With Hull Shaders
Fixes: #4913
Fixes: #4540
Changes:
1. Added `kIROp_ControlBarrier` to HLSL/GLSL emitting.
2. Added a method to track 'used' and 'unused' varyings for when legalizing GLSL. This allows us to assign correct offsets to automatically added varyings
* Added a `ZeroLSB` check to UIntSet for this purpose
* add missing return
* code comment adjustment
* cleanup
* comment and HLSL controlBarrier mistake
* assume space for glsl/spriv varying is irrelevant
Diffstat (limited to 'tests/hlsl')
| -rw-r--r-- | tests/hlsl/simple-hull-shader-1.slang | 53 | ||||
| -rw-r--r-- | tests/hlsl/simple-hull-shader-2.slang | 56 |
2 files changed, 109 insertions, 0 deletions
diff --git a/tests/hlsl/simple-hull-shader-1.slang b/tests/hlsl/simple-hull-shader-1.slang new file mode 100644 index 000000000..20033ed37 --- /dev/null +++ b/tests/hlsl/simple-hull-shader-1.slang @@ -0,0 +1,53 @@ +//TEST:SIMPLE(filecheck=HLSL):-target hlsl -entry hullMain -stage hull -allow-glsl +//TEST:SIMPLE(filecheck=GLSL):-target glsl -entry hullMain -stage hull -allow-glsl +// Currently SPIR-V fails to compile this hull shader (#4914) +//DISABLE_TEST:SIMPLE(filecheck=SPIRV):-target spirv -entry hullMain -stage hull -allow-glsl + +//HLSL: hullMain + +//GLSL-DAG: location = 0 +//GLSL-DAG: location = 1 +//GLSL-DAG: location = 2 + +//SPIRV-DAG: location 0 +//SPIRV-DAG: location 1 +//SPIRV-DAG: location 2 + +struct HsOut +{ + float2 pos; + float2 hm; +}; + +struct HscOut +{ + float EdgeTessFactor[4] : SV_TessFactor; + float InsideTessFactor[2] : SV_InsideTessFactor; + uint instanceId; +}; + +[domain("quad")] +[partitioning("integer")] +[outputtopology("triangle_ccw")] +[outputcontrolpoints(4)] +[patchconstantfunc("constants")] +HsOut hullMain() +{ + HsOut o; + o.pos = 1; + o.hm = 2; + return o; +} + +HscOut constants() +{ + HscOut o; + o.instanceId = 123; + o.EdgeTessFactor[0] = 1; + o.EdgeTessFactor[1] = 2; + o.EdgeTessFactor[2] = 3; + o.EdgeTessFactor[3] = 4; + o.InsideTessFactor[0] = 0.5; + o.InsideTessFactor[1] = 0.5; + return o; +}
\ No newline at end of file diff --git a/tests/hlsl/simple-hull-shader-2.slang b/tests/hlsl/simple-hull-shader-2.slang new file mode 100644 index 000000000..bc3b34971 --- /dev/null +++ b/tests/hlsl/simple-hull-shader-2.slang @@ -0,0 +1,56 @@ +//TEST:SIMPLE(filecheck=GLSL):-target glsl -entry hullMain -stage hull -allow-glsl + +// Currently SPIR-V fails to compile this hull shader (#4914) +//DISABLE_TEST:SIMPLE(filecheck=SPIRV):-target spirv -entry hullMain -stage hull -allow-glsl + +//GLSL-DAG: location = 0 +//GLSL-DAG: location = 1 +//GLSL-DAG: location = 2 +//GLSL-DAG: location = 3 + +//SPIRV-DAG: location 0 +//SPIRV-DAG: location 1 +//SPIRV-DAG: location 2 +//SPIRV-DAG: location 3 + + +struct HsOut +{ + float2 pos; + float2 hm; +}; + +struct HscOut +{ + uint roundingFactor; + float EdgeTessFactor[4] : SV_TessFactor; + float InsideTessFactor[2] : SV_InsideTessFactor; + uint instanceId; +}; + +[domain("quad")] +[partitioning("integer")] +[outputtopology("triangle_ccw")] +[outputcontrolpoints(4)] +[patchconstantfunc("constants")] +HsOut hullMain() +{ + HsOut o; + o.pos = 1; + o.hm = 2; + return o; +} + +HscOut constants() +{ + HscOut o; + o.instanceId = 123; + o.roundingFactor = 6; + o.EdgeTessFactor[0] = 1; + o.EdgeTessFactor[1] = 2; + o.EdgeTessFactor[2] = 3; + o.EdgeTessFactor[3] = 4; + o.InsideTessFactor[0] = 0.5; + o.InsideTessFactor[1] = 0.5; + return o; +}
\ No newline at end of file |
