Add implementation of SPV_EXT_fragment_fully_covered

This implementation uses the GLSL extension
GL_NV_conservative_raster_underestimation to generate the new SPIR-V
FullyCoveredEXT built in.
This commit is contained in:
Piers Daniell 2017-12-13 13:07:22 -07:00 committed by John Kessenich
parent e9e0cb60ec
commit 1c5443c693
11 changed files with 116 additions and 1 deletions

View file

@ -218,6 +218,7 @@ enum TBuiltInVariable {
EbvSecondaryViewportMaskNV,
EbvPositionPerViewNV,
EbvViewportMaskPerViewNV,
EbvFragFullyCoveredNV,
#endif
// HLSL built-ins that live only temporarily, until they get remapped
@ -355,6 +356,7 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
case EbvSecondaryViewportMaskNV: return "SecondaryViewportMaskNV";
case EbvPositionPerViewNV: return "PositionPerViewNV";
case EbvViewportMaskPerViewNV: return "ViewportMaskPerViewNV";
case EbvFragFullyCoveredNV: return "FragFullyCoveredNV";
#endif
default: return "unknown built-in variable";
}

View file

@ -3963,6 +3963,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"in vec3 gl_BaryCoordPullModelAMD;"
);
#endif
#ifdef NV_EXTENSIONS
if (version >= 430)
stageBuiltins[EShLangFragment].append(
"in bool gl_FragFullyCoveredNV;"
);
#endif
} else {
// ES profile
@ -5858,6 +5865,13 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
}
#endif
#ifdef NV_EXTENSIONS
if (profile != EEsProfile && version >= 430) {
symbolTable.setVariableExtensions("gl_FragFullyCoveredNV", 1, &E_GL_NV_conservative_raster_underestimation);
BuiltInVariable("gl_FragFullyCoveredNV", EbvFragFullyCoveredNV, symbolTable);
}
#endif
symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &E_GL_EXT_frag_depth);
if (profile == EEsProfile && version < 320) {

View file

@ -2560,7 +2560,7 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
// now, knowing it is a shader in/out, do all the in/out semantic checks
if (publicType.basicType == EbtBool) {
if (publicType.basicType == EbtBool && !parsingBuiltins) {
error(loc, "cannot be bool", GetStorageQualifierString(qualifier.storage), "");
return;
}

View file

@ -212,6 +212,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_NV_stereo_view_rendering] = EBhDisable;
extensionBehavior[E_GL_NVX_multiview_per_view_attributes] = EBhDisable;
extensionBehavior[E_GL_NV_shader_atomic_int64] = EBhDisable;
extensionBehavior[E_GL_NV_conservative_raster_underestimation] = EBhDisable;
#endif
// AEP
@ -345,6 +346,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_NV_geometry_shader_passthrough 1\n"
"#define GL_NV_viewport_array2 1\n"
"#define GL_NV_shader_atomic_int64 1\n"
"#define GL_NV_conservative_raster_underestimation 1\n"
#endif
;

View file

@ -183,6 +183,7 @@ const char* const E_GL_NV_viewport_array2 = "GL_NV_viewpor
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";
const char* const E_GL_NV_shader_atomic_int64 = "GL_NV_shader_atomic_int64";
const char* const E_GL_NV_conservative_raster_underestimation = "GL_NV_conservative_raster_underestimation";
// Arrays of extensions for the above viewportEXTs duplications