Commit 3958927a by Sahil Parmar

Add missing support for gl_MeshViewCountNV/gl_MeshViewIndicesNV in task shaders

parent 9dda1281
#version 450 #version 450
#define MAX_VIEWS gl_MaxMeshViewCountNV
#define BARRIER() \ #define BARRIER() \
memoryBarrierShared(); \ memoryBarrierShared(); \
barrier(); barrier();
...@@ -19,12 +21,14 @@ shared vec4 mem[10]; ...@@ -19,12 +21,14 @@ shared vec4 mem[10];
taskNV out Task { taskNV out Task {
vec2 dummy; vec2 dummy;
vec2 submesh[3]; vec2 submesh[3];
uint viewID;
} mytask; } mytask;
void main() void main()
{ {
uint iid = gl_LocalInvocationID.x; uint iid = gl_LocalInvocationID.x;
uint gid = gl_WorkGroupID.x; uint gid = gl_WorkGroupID.x;
uint viewID = gl_MeshViewIndicesNV[gl_MeshViewCountNV%MAX_VIEWS];
// 1. shared memory load and stores // 1. shared memory load and stores
for (uint i = 0; i < 10; ++i) { for (uint i = 0; i < 10; ++i) {
...@@ -41,6 +45,7 @@ void main() ...@@ -41,6 +45,7 @@ void main()
mytask.submesh[0] = vec2(32.0, 33.0); mytask.submesh[0] = vec2(32.0, 33.0);
mytask.submesh[1] = vec2(34.0, 35.0); mytask.submesh[1] = vec2(34.0, 35.0);
mytask.submesh[2] = mytask.submesh[gid%2]; mytask.submesh[2] = mytask.submesh[gid%2];
mytask.viewID = viewID;
BARRIER(); BARRIER();
......
...@@ -5357,6 +5357,9 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV ...@@ -5357,6 +5357,9 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"in highp uvec3 gl_GlobalInvocationID;" "in highp uvec3 gl_GlobalInvocationID;"
"in highp uint gl_LocalInvocationIndex;" "in highp uint gl_LocalInvocationIndex;"
"in uint gl_MeshViewCountNV;"
"in uint gl_MeshViewIndicesNV[4];"
"\n"); "\n");
} }
...@@ -8843,6 +8846,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion ...@@ -8843,6 +8846,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setVariableExtensions("gl_LocalInvocationID", 1, &E_GL_NV_mesh_shader); symbolTable.setVariableExtensions("gl_LocalInvocationID", 1, &E_GL_NV_mesh_shader);
symbolTable.setVariableExtensions("gl_GlobalInvocationID", 1, &E_GL_NV_mesh_shader); symbolTable.setVariableExtensions("gl_GlobalInvocationID", 1, &E_GL_NV_mesh_shader);
symbolTable.setVariableExtensions("gl_LocalInvocationIndex", 1, &E_GL_NV_mesh_shader); symbolTable.setVariableExtensions("gl_LocalInvocationIndex", 1, &E_GL_NV_mesh_shader);
symbolTable.setVariableExtensions("gl_MeshViewCountNV", 1, &E_GL_NV_mesh_shader);
symbolTable.setVariableExtensions("gl_MeshViewIndicesNV", 1, &E_GL_NV_mesh_shader);
BuiltInVariable("gl_TaskCountNV", EbvTaskCountNV, symbolTable); BuiltInVariable("gl_TaskCountNV", EbvTaskCountNV, symbolTable);
BuiltInVariable("gl_WorkGroupSize", EbvWorkGroupSize, symbolTable); BuiltInVariable("gl_WorkGroupSize", EbvWorkGroupSize, symbolTable);
...@@ -8850,8 +8855,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion ...@@ -8850,8 +8855,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_LocalInvocationID", EbvLocalInvocationId, symbolTable); BuiltInVariable("gl_LocalInvocationID", EbvLocalInvocationId, symbolTable);
BuiltInVariable("gl_GlobalInvocationID", EbvGlobalInvocationId, symbolTable); BuiltInVariable("gl_GlobalInvocationID", EbvGlobalInvocationId, symbolTable);
BuiltInVariable("gl_LocalInvocationIndex", EbvLocalInvocationIndex, symbolTable); BuiltInVariable("gl_LocalInvocationIndex", EbvLocalInvocationIndex, symbolTable);
BuiltInVariable("gl_MeshViewCountNV", EbvMeshViewCountNV, symbolTable);
BuiltInVariable("gl_MeshViewIndicesNV", EbvMeshViewIndicesNV, symbolTable);
symbolTable.setVariableExtensions("gl_MaxTaskWorkGroupSizeNV", 1, &E_GL_NV_mesh_shader); symbolTable.setVariableExtensions("gl_MaxTaskWorkGroupSizeNV", 1, &E_GL_NV_mesh_shader);
symbolTable.setVariableExtensions("gl_MaxMeshViewCountNV", 1, &E_GL_NV_mesh_shader);
symbolTable.setFunctionExtensions("barrier", 1, &E_GL_NV_mesh_shader); symbolTable.setFunctionExtensions("barrier", 1, &E_GL_NV_mesh_shader);
symbolTable.setFunctionExtensions("memoryBarrierShared", 1, &E_GL_NV_mesh_shader); symbolTable.setFunctionExtensions("memoryBarrierShared", 1, &E_GL_NV_mesh_shader);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment