GL_EXT_mesh_shader/SPV_EXT_mesh_shader implementation

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
This commit is contained in:
Pankaj Mistry 2021-08-25 13:41:32 -07:00
parent 69ae9e7460
commit 228c67228a
52 changed files with 8937 additions and 4185 deletions

View file

@ -105,6 +105,8 @@ enum TStorageQualifier {
EvqCallableData,
EvqCallableDataIn,
EvqtaskPayloadSharedEXT,
// parameters
EvqIn, // also, for 'in' in the grammar before we know if it's a pipeline input or an 'in' parameter
EvqOut, // also, for 'out' in the grammar before we know if it's a pipeline output or an 'out' parameter
@ -287,6 +289,11 @@ enum TBuiltInVariable {
EbvLayerPerViewNV,
EbvMeshViewCountNV,
EbvMeshViewIndicesNV,
//GL_EXT_mesh_shader
EbvPrimitivePointIndicesEXT,
EbvPrimitiveLineIndicesEXT,
EbvPrimitiveTriangleIndicesEXT,
EbvCullPrimitiveEXT,
// sm builtins
EbvWarpsPerSM,
@ -360,6 +367,7 @@ __inline const char* GetStorageQualifierString(TStorageQualifier q)
case EvqHitAttr: return "hitAttributeNV"; break;
case EvqCallableData: return "callableDataNV"; break;
case EvqCallableDataIn: return "callableDataInNV"; break;
case EvqtaskPayloadSharedEXT: return "taskPayloadSharedEXT"; break;
default: return "unknown qualifier";
}
}
@ -496,6 +504,11 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
case EbvLayerPerViewNV: return "LayerPerViewNV";
case EbvMeshViewCountNV: return "MeshViewCountNV";
case EbvMeshViewIndicesNV: return "MeshViewIndicesNV";
// GL_EXT_mesh_shader
case EbvPrimitivePointIndicesEXT: return "PrimitivePointIndicesEXT";
case EbvPrimitiveLineIndicesEXT: return "PrimitiveLineIndicesEXT";
case EbvPrimitiveTriangleIndicesEXT: return "PrimitiveTriangleIndicesEXT";
case EbvCullPrimitiveEXT: return "CullPrimitiveEXT";
case EbvWarpsPerSM: return "WarpsPerSMNV";
case EbvSMCount: return "SMCountNV";

View file

@ -142,6 +142,15 @@ struct TBuiltInResource {
int maxTaskWorkGroupSizeY_NV;
int maxTaskWorkGroupSizeZ_NV;
int maxMeshViewCountNV;
int maxMeshOutputVerticesEXT;
int maxMeshOutputPrimitivesEXT;
int maxMeshWorkGroupSizeX_EXT;
int maxMeshWorkGroupSizeY_EXT;
int maxMeshWorkGroupSizeZ_EXT;
int maxTaskWorkGroupSizeX_EXT;
int maxTaskWorkGroupSizeY_EXT;
int maxTaskWorkGroupSizeZ_EXT;
int maxMeshViewCountEXT;
int maxDualSourceDrawBuffersEXT;
TLimits limits;

View file

@ -833,7 +833,7 @@ public:
}
storage = EvqUniform;
break;
case EbsStorageBuffer :
case EbsStorageBuffer :
storage = EvqBuffer;
break;
#ifndef GLSLANG_WEB
@ -856,6 +856,7 @@ public:
bool isPerPrimitive() const { return perPrimitiveNV; }
bool isPerView() const { return perViewNV; }
bool isTaskMemory() const { return perTaskNV; }
bool isTaskPayload() const { return storage == EvqtaskPayloadSharedEXT; }
bool isAnyPayload() const {
return storage == EvqPayload || storage == EvqPayloadIn;
}
@ -874,8 +875,8 @@ public:
case EShLangTessEvaluation:
return ! patch && isPipeInput();
case EShLangFragment:
return (pervertexNV || pervertexEXT) && isPipeInput();
case EShLangMeshNV:
return pervertexNV && isPipeInput();
case EShLangMesh:
return ! perTaskNV && isPipeOutput();
default:
@ -2543,7 +2544,7 @@ public:
void setStruct(TTypeList* s) { assert(isStruct()); structure = s; }
TTypeList* getWritableStruct() const { assert(isStruct()); return structure; } // This should only be used when known to not be sharing with other threads
void setBasicType(const TBasicType& t) { basicType = t; }
int computeNumComponents() const
{
int components = 0;

View file

@ -148,6 +148,15 @@ typedef struct glslang_resource_s {
int max_task_work_group_size_y_nv;
int max_task_work_group_size_z_nv;
int max_mesh_view_count_nv;
int max_mesh_output_vertices_ext;
int max_mesh_output_primitives_ext;
int max_mesh_work_group_size_x_ext;
int max_mesh_work_group_size_y_ext;
int max_mesh_work_group_size_z_ext;
int max_task_work_group_size_x_ext;
int max_task_work_group_size_y_ext;
int max_task_work_group_size_z_ext;
int max_mesh_view_count_ext;
int maxDualSourceDrawBuffersEXT;
glslang_limits_t limits;

View file

@ -49,8 +49,10 @@ typedef enum {
GLSLANG_STAGE_CLOSESTHIT_NV,
GLSLANG_STAGE_MISS_NV,
GLSLANG_STAGE_CALLABLE_NV,
GLSLANG_STAGE_TASK_NV,
GLSLANG_STAGE_MESH_NV,
GLSLANG_STAGE_TASK,
GLSLANG_STAGE_TASK_NV = GLSLANG_STAGE_TASK,
GLSLANG_STAGE_MESH,
GLSLANG_STAGE_MESH_NV = GLSLANG_STAGE_MESH,
LAST_ELEMENT_MARKER(GLSLANG_STAGE_COUNT),
} glslang_stage_t; // would be better as stage, but this is ancient now
@ -68,8 +70,10 @@ typedef enum {
GLSLANG_STAGE_CLOSESTHIT_NV_MASK = (1 << GLSLANG_STAGE_CLOSESTHIT_NV),
GLSLANG_STAGE_MISS_NV_MASK = (1 << GLSLANG_STAGE_MISS_NV),
GLSLANG_STAGE_CALLABLE_NV_MASK = (1 << GLSLANG_STAGE_CALLABLE_NV),
GLSLANG_STAGE_TASK_NV_MASK = (1 << GLSLANG_STAGE_TASK_NV),
GLSLANG_STAGE_MESH_NV_MASK = (1 << GLSLANG_STAGE_MESH_NV),
GLSLANG_STAGE_TASK_MASK = (1 << GLSLANG_STAGE_TASK),
GLSLANG_STAGE_TASK_NV_MASK = GLSLANG_STAGE_TASK_MASK,
GLSLANG_STAGE_MESH_MASK = (1 << GLSLANG_STAGE_MESH),
GLSLANG_STAGE_MESH_NV_MASK = GLSLANG_STAGE_MESH_MASK,
LAST_ELEMENT_MARKER(GLSLANG_STAGE_MASK_COUNT),
} glslang_stage_mask_t;

View file

@ -934,6 +934,8 @@ enum TOperator {
EOpExecuteCallableNV,
EOpExecuteCallableKHR,
EOpWritePackedPrimitiveIndices4x8NV,
EOpEmitMeshTasksEXT,
EOpSetMeshOutputsEXT,
//
// GL_EXT_ray_query operations