Implement NVX_multiview_per_view_attributes

This commit is contained in:
chaoc
2017-02-14 14:52:34 -08:00
parent 7225a1cb1e
commit df3956c50f
17 changed files with 285 additions and 60 deletions

View File

@@ -207,6 +207,8 @@ enum TBuiltInVariable {
EbvViewportMaskNV,
EbvSecondaryPositionNV,
EbvSecondaryViewportMaskNV,
EbvPositionPerViewNV,
EbvViewportMaskPerViewNV,
#endif
// HLSL built-ins that live only temporarily, until they get remapped
// to one of the above.
@@ -325,6 +327,8 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
case EbvViewportMaskNV: return "ViewportMaskNV";
case EbvSecondaryPositionNV: return "SecondaryPositionNV";
case EbvSecondaryViewportMaskNV: return "SecondaryViewportMaskNV";
case EbvPositionPerViewNV: return "PositionPerViewNV";
case EbvViewportMaskPerViewNV: return "ViewportMaskPerViewNV";
#endif
default: return "unknown built-in variable";
}

View File

@@ -1360,6 +1360,8 @@ public:
case EbvViewportMaskNV:
case EbvSecondaryPositionNV:
case EbvSecondaryViewportMaskNV:
case EbvPositionPerViewNV:
case EbvViewportMaskPerViewNV:
#endif
return true;
default:

View File

@@ -3249,6 +3249,8 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"out int gl_ViewportMask[];"
"out int gl_SecondaryViewportMaskNV[];"
"out vec4 gl_SecondaryPositionNV;"
"out vec4 gl_PositionPerViewNV[];"
"out int gl_ViewportMaskPerViewNV[];"
);
#endif
@@ -3313,6 +3315,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"float gl_CullDistance[];"
#ifdef NV_EXTENSIONS
"vec4 gl_SecondaryPositionNV;"
"vec4 gl_PositionPerViewNV[];"
#endif
);
stageBuiltins[EShLangGeometry].append(
@@ -3362,9 +3365,11 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
#ifdef NV_EXTENSIONS
if (version >= 450)
stageBuiltins[EShLangGeometry].append(
"out int gl_ViewportMask[];"
"out int gl_SecondaryViewportMaskNV[];"
"out vec4 gl_SecondaryPositionNV;"
"out int gl_ViewportMask[];"
"out int gl_SecondaryViewportMaskNV[];"
"out vec4 gl_SecondaryPositionNV;"
"out vec4 gl_PositionPerViewNV[];"
"out int gl_ViewportMaskPerViewNV[];"
);
#endif
@@ -3424,11 +3429,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
stageBuiltins[EShLangTessControl].append(
"float gl_CullDistance[];"
#ifdef NV_EXTENSIONS
"int gl_ViewportIndex;"
"int gl_Layer;"
"int gl_ViewportMask[];"
"int gl_ViewportIndex;"
"int gl_Layer;"
"int gl_ViewportMask[];"
"vec4 gl_SecondaryPositionNV;"
"int gl_SecondaryViewportMaskNV[];"
"int gl_SecondaryViewportMaskNV[];"
"vec4 gl_PositionPerViewNV[];"
"int gl_ViewportMaskPerViewNV[];"
#endif
);
stageBuiltins[EShLangTessControl].append(
@@ -3503,11 +3510,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
#ifdef NV_EXTENSIONS
if (version >= 450)
stageBuiltins[EShLangTessEvaluation].append(
"out int gl_ViewportIndex;"
"out int gl_Layer;"
"out int gl_ViewportMask[];"
"out int gl_ViewportIndex;"
"out int gl_Layer;"
"out int gl_ViewportMask[];"
"out vec4 gl_SecondaryPositionNV;"
"out int gl_SecondaryViewportMaskNV[];"
"out int gl_SecondaryViewportMaskNV[];"
"out vec4 gl_PositionPerViewNV[];"
"out int gl_ViewportMaskPerViewNV[];"
);
#endif
@@ -4446,6 +4455,7 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
"highp float gl_PointSize;"
#ifdef NV_EXTENSIONS
"highp vec4 gl_SecondaryPositionNV;"
"highp vec4 gl_PositionPerViewNV[];"
#endif
"} gl_in[gl_MaxPatchVertices];"
"\n");
@@ -4635,6 +4645,7 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
"float gl_CullDistance[];"
#ifdef NV_EXTENSIONS
"vec4 gl_SecondaryPositionNV;"
"vec4 gl_PositionPerViewNV[];"
#endif
);
s.append(
@@ -5033,19 +5044,26 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setVariableExtensions("gl_ViewportMask", 1, &E_GL_NV_viewport_array2);
symbolTable.setVariableExtensions("gl_SecondaryPositionNV", 1, &E_GL_NV_stereo_view_rendering);
symbolTable.setVariableExtensions("gl_SecondaryViewportMaskNV", 1, &E_GL_NV_stereo_view_rendering);
symbolTable.setVariableExtensions("gl_PositionPerViewNV", 1, &E_GL_NVX_multiview_per_view_attributes);
symbolTable.setVariableExtensions("gl_ViewportMaskPerViewNV", 1, &E_GL_NVX_multiview_per_view_attributes);
BuiltInVariable("gl_ViewportMask", EbvViewportMaskNV, symbolTable);
BuiltInVariable("gl_SecondaryPositionNV", EbvSecondaryPositionNV, symbolTable);
BuiltInVariable("gl_SecondaryViewportMaskNV", EbvSecondaryViewportMaskNV, symbolTable);
BuiltInVariable("gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable);
BuiltInVariable("gl_ViewportMaskPerViewNV", EbvViewportMaskPerViewNV, symbolTable);
if (language != EShLangVertex)
if (language != EShLangVertex) {
BuiltInVariable("gl_in", "gl_SecondaryPositionNV", EbvSecondaryPositionNV, symbolTable);
BuiltInVariable("gl_in", "gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable);
}
BuiltInVariable("gl_out", "gl_Layer", EbvLayer, symbolTable);
BuiltInVariable("gl_out", "gl_ViewportIndex", EbvViewportIndex, symbolTable);
BuiltInVariable("gl_out", "gl_ViewportMask", EbvViewportMaskNV, symbolTable);
BuiltInVariable("gl_out", "gl_SecondaryPositionNV", EbvSecondaryPositionNV, symbolTable);
BuiltInVariable("gl_out", "gl_SecondaryViewportMaskNV", EbvSecondaryViewportMaskNV, symbolTable);
BuiltInVariable("gl_out", "gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable);
BuiltInVariable("gl_out", "gl_ViewportMaskPerViewNV", EbvViewportMaskPerViewNV, symbolTable);
#endif
BuiltInVariable("gl_PatchVerticesIn", EbvPatchVertices, symbolTable);

View File

@@ -201,6 +201,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_ARB_shader_viewport_layer_array] = EBhDisable;
extensionBehavior[E_GL_NV_viewport_array2] = EBhDisable;
extensionBehavior[E_GL_NV_stereo_view_rendering] = EBhDisable;
extensionBehavior[E_GL_NVX_multiview_per_view_attributes] = EBhDisable;
#endif
// AEP

View File

@@ -149,6 +149,7 @@ const char* const E_SPV_NV_geometry_shader_passthrough = "GL_NV_geometr
const char* const E_GL_ARB_shader_viewport_layer_array = "GL_ARB_shader_viewport_layer_array";
const char* const E_GL_NV_viewport_array2 = "GL_NV_viewport_array2";
const char* const E_GL_NV_stereo_view_rendering = "GL_NV_stereo_view_rendering";
const char* const E_GL_NVX_multiview_per_view_attributes = "GL_NVX_multiview_per_view_attributes";
// Arrays of extensions for the above viewportEXTs duplications