-
Notifications
You must be signed in to change notification settings - Fork 696
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unwrap top-level array for OutVertices when flattenArgument. (#6943)
For primitives and vertices output of mesh shader, we need to unwrap the top-level array to get correct semantic index. Fixes #6940
- Loading branch information
1 parent
dfa1c81
commit b05313c
Showing
4 changed files
with
81 additions
and
2 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
35 changes: 35 additions & 0 deletions
35
tools/clang/test/HLSLFileCheck/shader_targets/geometry/semantic_on_parameter.hlsl
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,35 @@ | ||
// RUN: %dxc -E main -T gs_6_0 %s | FileCheck %s | ||
|
||
// Make sure only one semnatic index created. | ||
// CHECK:; COORD 0 xyzw 0 NONE float xyzw | ||
// CHECK-NOT:; COORD 1 xyzw 0 NONE float xyzw | ||
|
||
struct MyStruct | ||
{ | ||
float4 pos : SV_Position; | ||
float2 a : AAA; | ||
}; | ||
|
||
struct MyStruct2 | ||
{ | ||
uint3 X : XXX; | ||
float4 p[3] : PPP; | ||
uint3 Y : YYY; | ||
}; | ||
|
||
int g1; | ||
|
||
[maxvertexcount(12)] | ||
void main(line float4 array[2] : COORD, inout PointStream<MyStruct> OutputStream0) | ||
{ | ||
float4 r = array[0]; | ||
MyStruct a = (MyStruct)0; | ||
MyStruct2 b = (MyStruct2)0; | ||
a.pos = array[r.x]; | ||
a.a = r.xy; | ||
b.X = r.xyz; | ||
b.Y = a.pos.xyz; | ||
b.p[2] = a.pos * 44; | ||
OutputStream0.Append(a); | ||
OutputStream0.RestartStrip(); | ||
} |
42 changes: 42 additions & 0 deletions
42
tools/clang/test/HLSLFileCheck/shader_targets/mesh/semantic_on_parameter.hlsl
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,42 @@ | ||
// RUN: %dxc -T ms_6_6 %s | FileCheck %s | ||
|
||
// For https://github.com/microsoft/DirectXShaderCompiler/issues/6940 | ||
// Ensure the shader compiles when the semantic is directly on the parameter. | ||
// Only one semantic index should be created. | ||
|
||
// CHECK:; SV_Position 0 xyzw 0 POS float xyzw | ||
// CHECK-NOT:; SV_Position 1 xyzw 0 POS float xyzw | ||
|
||
// CHECK:; A 0 xyzw 0 NONE uint | ||
// CHECK-NOT: ; A 1 xyzw 0 NONE uint | ||
|
||
#define GROUP_SIZE 30 | ||
|
||
cbuffer Constant : register(b0) | ||
{ | ||
uint numPrims; | ||
} | ||
static const uint numVerts = 3; | ||
|
||
[RootSignature("RootConstants(num32BitConstants=1, b0)")] | ||
[numthreads(GROUP_SIZE, 1, 1)] | ||
[OutputTopology("triangle")] | ||
void main( | ||
uint gtid : SV_GroupThreadID, | ||
out indices uint3 tris[GROUP_SIZE], | ||
out vertices float4 verts[GROUP_SIZE] : SV_Position, | ||
out primitives uint4 t[GROUP_SIZE] : A | ||
) | ||
{ | ||
SetMeshOutputCounts(numVerts, numPrims); | ||
|
||
if (gtid < numVerts) | ||
{ | ||
verts[gtid] = 0; | ||
} | ||
|
||
if (gtid < numPrims) | ||
{ | ||
tris[gtid] = uint3(0, 1, 2); | ||
} | ||
} |