mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-09 20:10:06 +00:00
228c67228a
Added following updates to GL_EXT_mesh_shader implementation: 1. Added SPIRV and GLSL test cases 2. Added checks to ensure NV and EXT mesh shader builtins cannot be used interchangeably. 3. Updated the language name by removing the postfix "NV" to MeshShader and TaskShader. 4. Added checks for grammar checking to comply with the spec. 5. Added gl_NumWorkGroups builtin to Mesh shader 6. Fixed data type of gl_PrimitiveLineIndicesEXT and gl_PrimitiveTriangleIndicesEXT 7. Added new constants to the resources table 8. Updates to handle new storage qualifier "taskPayloadSharedEXT" 9. Updated test cases by replacing "taskEXT" with storage qualifier "taskPayloadSharedEXT" Addressed Review comments 1. Fixed instruction description used by glslang disassembly. 2. Updated OpEmitMeshTasksEXT as per spec update 3. Fixed implementation that errors out if there are more then one taskPayloadSharedEXT varjables. 4. Fixed miscellaneous error logs and removed unwanted code. SPIRV 1.6 related build failure fixes - Update SPIRV header to 1.6 - Fix conflict wiht SPIRV 1.6 change, where localSizeId is used for execution mode for mesh/task shaders Enable SPIRV generated for EXT_mesh_shader to be version 1.4 GL_EXT_mesh_shader: Add checks for atomic support and corresponding test cases
76 lines
2.3 KiB
Plaintext
76 lines
2.3 KiB
Plaintext
#version 460
|
|
|
|
#define MAX_VER 81
|
|
#define MAX_PRIM 32
|
|
|
|
#define BARRIER() \
|
|
memoryBarrierShared(); \
|
|
barrier();
|
|
|
|
#extension GL_EXT_mesh_shader : enable
|
|
|
|
layout(local_size_x = 32, local_size_y = 1, local_size_z = 1) in;
|
|
|
|
layout(max_vertices=MAX_VER) out;
|
|
layout(max_primitives=MAX_PRIM) out;
|
|
layout(points) out;
|
|
|
|
// test use of redeclared single-view builtins in mesh shaders:
|
|
|
|
out gl_MeshPerVertexEXT {
|
|
vec4 gl_Position;
|
|
float gl_PointSize;
|
|
float gl_ClipDistance[4];
|
|
float gl_CullDistance[4];
|
|
} gl_MeshVerticesEXT[MAX_VER]; // explicitly sized to MAX_VER
|
|
|
|
perprimitiveEXT out gl_MeshPerPrimitiveEXT {
|
|
int gl_PrimitiveID;
|
|
int gl_Layer;
|
|
int gl_ViewportIndex;
|
|
bool gl_CullPrimitiveEXT;
|
|
int gl_PrimitiveShadingRateEXT;
|
|
} gl_MeshPrimitivesEXT[]; // implicitly sized to MAX_PRIM
|
|
|
|
out uint gl_PrimitivePointIndicesEXT[MAX_PRIM]; // explicitly sized to MAX_PRIM
|
|
|
|
void main()
|
|
{
|
|
uint iid = gl_LocalInvocationID.x;
|
|
uint gid = gl_WorkGroupID.x;
|
|
|
|
SetMeshOutputsEXT(MAX_VER, MAX_PRIM);
|
|
|
|
gl_MeshVerticesEXT[iid].gl_Position = vec4(1.0);
|
|
gl_MeshVerticesEXT[iid].gl_PointSize = 2.0;
|
|
gl_MeshVerticesEXT[iid].gl_ClipDistance[3] = 3.0;
|
|
gl_MeshVerticesEXT[iid].gl_CullDistance[2] = 4.0;
|
|
|
|
BARRIER();
|
|
|
|
gl_MeshVerticesEXT[iid+1].gl_Position = gl_MeshVerticesEXT[iid].gl_Position;
|
|
gl_MeshVerticesEXT[iid+1].gl_PointSize = gl_MeshVerticesEXT[iid].gl_PointSize;
|
|
gl_MeshVerticesEXT[iid+1].gl_ClipDistance[3] = gl_MeshVerticesEXT[iid].gl_ClipDistance[3];
|
|
gl_MeshVerticesEXT[iid+1].gl_CullDistance[2] = gl_MeshVerticesEXT[iid].gl_CullDistance[2];
|
|
|
|
BARRIER();
|
|
|
|
gl_MeshPrimitivesEXT[iid].gl_PrimitiveID = 6;
|
|
gl_MeshPrimitivesEXT[iid].gl_Layer = 7;
|
|
gl_MeshPrimitivesEXT[iid].gl_ViewportIndex = 8;
|
|
gl_MeshPrimitivesEXT[iid].gl_CullPrimitiveEXT = false;
|
|
|
|
BARRIER();
|
|
|
|
gl_MeshPrimitivesEXT[iid+1].gl_PrimitiveID = gl_MeshPrimitivesEXT[iid].gl_PrimitiveID;
|
|
gl_MeshPrimitivesEXT[iid+1].gl_Layer = gl_MeshPrimitivesEXT[iid].gl_Layer;
|
|
gl_MeshPrimitivesEXT[iid+1].gl_ViewportIndex = gl_MeshPrimitivesEXT[iid].gl_ViewportIndex;
|
|
gl_MeshPrimitivesEXT[iid+1].gl_CullPrimitiveEXT = gl_MeshPrimitivesEXT[iid].gl_CullPrimitiveEXT;
|
|
|
|
BARRIER();
|
|
|
|
// check bound limits
|
|
gl_PrimitivePointIndicesEXT[0] = 1;
|
|
gl_PrimitivePointIndicesEXT[MAX_PRIM - 1] = 2;
|
|
}
|