-
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 #2430 from KhronosGroup/hlsl-mesh-single-clip-cull…
…-fix HLSL: Fix clip/cull lowering for single element.
- Loading branch information
Showing
4 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
.../shaders-hlsl-no-opt/mesh/clip-cull-array-load-store-single.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,36 @@ | ||
static uint gl_LocalInvocationIndex; | ||
struct SPIRV_Cross_Input | ||
{ | ||
uint gl_LocalInvocationIndex : SV_GroupIndex; | ||
}; | ||
|
||
struct gl_MeshPerVertexEXT | ||
{ | ||
float gl_ClipDistance[1] : SV_ClipDistance; | ||
}; | ||
|
||
struct gl_MeshPerPrimitiveEXT | ||
{ | ||
}; | ||
|
||
void write_clip_distance(inout float v[1]) | ||
{ | ||
v[0] += 1.0f; | ||
} | ||
|
||
void mesh_main(out gl_MeshPerVertexEXT gl_MeshVerticesEXT[3]) | ||
{ | ||
SetMeshOutputCounts(3u, 1u); | ||
gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0] = 4.0f; | ||
float param[1] = gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance; | ||
write_clip_distance(param); | ||
gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance = param; | ||
} | ||
|
||
[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
20 changes: 20 additions & 0 deletions
20
shaders-hlsl-no-opt/mesh/clip-cull-array-load-store-single.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,20 @@ | ||
#version 450 | ||
#extension GL_EXT_mesh_shader : require | ||
layout(triangles, max_vertices = 3, max_primitives = 1) out; | ||
|
||
out gl_MeshPerVertexEXT | ||
{ | ||
float gl_ClipDistance[1]; | ||
} gl_MeshVerticesEXT[]; | ||
|
||
void write_clip_distance(inout float v[1]) | ||
{ | ||
v[0] += 1.0; | ||
} | ||
|
||
void main() | ||
{ | ||
SetMeshOutputsEXT(3, 1); | ||
gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0] = 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