Allow redeclaration of builtin interface blocks in mesh shader

Apart from allowing redeclaration of gl_MeshPerVertexNV and gl_MeshPerPrimitiveNV blocks, this change also -
- Resize clip/cull perview distances based on static index use
- Error out use of both single-view and per-view builtins
- Add new gtests with redeclared blocks and edit existing test output
- Fix couple of typos
This commit is contained in:
Sahil Parmar 2018-10-04 16:39:18 -07:00
parent ca042a0ffb
commit 035cbbe3d0
13 changed files with 875 additions and 305 deletions

View file

@ -723,6 +723,17 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
error(infoSink, "Only one shaderRecordNVX buffer block is allowed per stage");
break;
case EShLangMeshNV:
// NV_mesh_shader doesn't allow use of both single-view and per-view builtins.
if (inIoAccessed("gl_Position") && inIoAccessed("gl_PositionPerViewNV"))
error(infoSink, "Can only use one of gl_Position or gl_PositionPerViewNV");
if (inIoAccessed("gl_ClipDistance") && inIoAccessed("gl_ClipDistancePerViewNV"))
error(infoSink, "Can only use one of gl_ClipDistance or gl_ClipDistancePerViewNV");
if (inIoAccessed("gl_CullDistance") && inIoAccessed("gl_CullDistancePerViewNV"))
error(infoSink, "Can only use one of gl_CullDistance or gl_CullDistancePerViewNV");
if (inIoAccessed("gl_Layer") && inIoAccessed("gl_LayerPerViewNV"))
error(infoSink, "Can only use one of gl_Layer or gl_LayerPerViewNV");
if (inIoAccessed("gl_ViewportMask") && inIoAccessed("gl_ViewportMaskPerViewNV"))
error(infoSink, "Can only use one of gl_ViewportMask or gl_ViewportMaskPerViewNV");
if (outputPrimitive == ElgNone)
error(infoSink, "At least one shader must specify an output layout primitive");
if (vertices == TQualifier::layoutNotSet)