-
Notifications
You must be signed in to change notification settings - Fork 570
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2429 from KhronosGroup/fix-2411
HLSL: Fix lowering of arrayed clip/cull distance in mesh shaders.
- Loading branch information
Showing
11 changed files
with
176 additions
and
14 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
43 changes: 43 additions & 0 deletions
43
reference/shaders-hlsl-no-opt/mesh/clip-cull-array-load-store.sm65.nofxc.fxconly.spv16.mesh
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,43 @@ | ||
static uint gl_LocalInvocationIndex; | ||
struct SPIRV_Cross_Input | ||
{ | ||
uint gl_LocalInvocationIndex : SV_GroupIndex; | ||
}; | ||
|
||
struct gl_MeshPerVertexEXT | ||
{ | ||
float4 gl_ClipDistance : SV_ClipDistance; | ||
}; | ||
|
||
struct gl_MeshPerPrimitiveEXT | ||
{ | ||
}; | ||
|
||
void write_clip_distance(inout float v[4]) | ||
{ | ||
v[0] += 1.0f; | ||
v[1] += 2.0f; | ||
v[2] += 3.0f; | ||
v[3] += 4.0f; | ||
} | ||
|
||
void mesh_main(out gl_MeshPerVertexEXT gl_MeshVerticesEXT[3]) | ||
{ | ||
SetMeshOutputCounts(3u, 1u); | ||
gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0] = 4.0f; | ||
gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[1] = 4.0f; | ||
gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[2] = 4.0f; | ||
gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[3] = 4.0f; | ||
float _62[4] = { gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0], gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[1], gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[2], gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[3] }; | ||
float param[4] = _62; | ||
write_clip_distance(param); | ||
gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance = float4(param[0], param[1], param[2], param[3]); | ||
} | ||
|
||
[outputtopology("triangle")] | ||
[numthreads(1, 1, 1)] | ||
void main(SPIRV_Cross_Input stage_input, out vertices gl_MeshPerVertexEXT gl_MeshVerticesEXT[3]) | ||
{ | ||
gl_LocalInvocationIndex = stage_input.gl_LocalInvocationIndex; | ||
mesh_main(gl_MeshVerticesEXT); | ||
} |
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
26 changes: 26 additions & 0 deletions
26
shaders-hlsl-no-opt/mesh/clip-cull-array-load-store.sm65.nofxc.fxconly.spv16.mesh
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,26 @@ | ||
#version 450 | ||
#extension GL_EXT_mesh_shader : require | ||
layout(triangles, max_vertices = 3, max_primitives = 1) out; | ||
|
||
out gl_MeshPerVertexEXT | ||
{ | ||
float gl_ClipDistance[4]; | ||
} gl_MeshVerticesEXT[]; | ||
|
||
void write_clip_distance(inout float v[4]) | ||
{ | ||
v[0] += 1.0; | ||
v[1] += 2.0; | ||
v[2] += 3.0; | ||
v[3] += 4.0; | ||
} | ||
|
||
void main() | ||
{ | ||
SetMeshOutputsEXT(3, 1); | ||
gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0] = 4.0; | ||
gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[1] = 4.0; | ||
gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[2] = 4.0; | ||
gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[3] = 4.0; | ||
write_clip_distance(gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance); | ||
} |
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