Implement GL_EXT_fragment_invocation_density
including SPV generation using SPV_EXT_fragment_invocation_density. This is an alias of the functionality in SPV_NV_shading_rate, and thus in some cases we can only have one set of the tokens present (switch statements), so we have picked the EXT version. This required updating the expected test results for SPV_NV_shading_rate. Also updated the known-good for spirv-headers so that the validator in spirv-tools knows about the new extension.
This commit is contained in:
@@ -232,6 +232,9 @@ enum TBuiltInVariable {
|
||||
EbvViewIndex,
|
||||
EbvDeviceIndex,
|
||||
|
||||
EbvFragSizeEXT,
|
||||
EbvFragInvocationCountEXT,
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
EbvViewportMaskNV,
|
||||
EbvSecondaryPositionNV,
|
||||
@@ -404,6 +407,9 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
|
||||
case EbvViewIndex: return "ViewIndex";
|
||||
case EbvDeviceIndex: return "DeviceIndex";
|
||||
|
||||
case EbvFragSizeEXT: return "FragSizeEXT";
|
||||
case EbvFragInvocationCountEXT: return "FragInvocationCountEXT";
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EbvViewportMaskNV: return "ViewportMaskNV";
|
||||
case EbvSecondaryPositionNV: return "SecondaryPositionNV";
|
||||
|
||||
@@ -5939,6 +5939,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
"bool gl_HelperInvocation;" // needs qualifier fixed later
|
||||
);
|
||||
|
||||
if (version >= 450)
|
||||
stageBuiltins[EShLangFragment].append( // GL_EXT_fragment_invocation_density
|
||||
"flat in ivec2 gl_FragSizeEXT;"
|
||||
"flat in int gl_FragInvocationCountEXT;"
|
||||
);
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
if (version >= 450)
|
||||
stageBuiltins[EShLangFragment].append(
|
||||
@@ -5959,9 +5965,9 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
);
|
||||
if (version >= 450)
|
||||
stageBuiltins[EShLangFragment].append(
|
||||
"flat in ivec2 gl_FragmentSizeNV;"
|
||||
"flat in ivec2 gl_FragmentSizeNV;" // GL_NV_shading_rate_image
|
||||
"flat in int gl_InvocationsPerPixelNV;"
|
||||
"in vec3 gl_BaryCoordNV;"
|
||||
"in vec3 gl_BaryCoordNV;" // GL_NV_fragment_shader_barycentric
|
||||
"in vec3 gl_BaryCoordNoPerspNV;"
|
||||
);
|
||||
|
||||
@@ -6006,13 +6012,19 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
stageBuiltins[EShLangFragment].append(
|
||||
"highp float gl_FragDepthEXT;" // GL_EXT_frag_depth
|
||||
);
|
||||
|
||||
if (version >= 310)
|
||||
stageBuiltins[EShLangFragment].append( // GL_EXT_fragment_invocation_density
|
||||
"flat in ivec2 gl_FragSizeEXT;"
|
||||
"flat in int gl_FragInvocationCountEXT;"
|
||||
);
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (version >= 320)
|
||||
stageBuiltins[EShLangFragment].append(
|
||||
stageBuiltins[EShLangFragment].append( // GL_NV_shading_rate_image
|
||||
"flat in ivec2 gl_FragmentSizeNV;"
|
||||
"flat in int gl_InvocationsPerPixelNV;"
|
||||
);
|
||||
if (version >= 320)
|
||||
if (version >= 320)
|
||||
stageBuiltins[EShLangFragment].append(
|
||||
"in vec3 gl_BaryCoordNV;"
|
||||
"in vec3 gl_BaryCoordNoPerspNV;"
|
||||
@@ -8342,6 +8354,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((profile != EEsProfile && version >= 450) ||
|
||||
(profile == EEsProfile && version >= 310)) {
|
||||
symbolTable.setVariableExtensions("gl_FragSizeEXT", 1, &E_GL_EXT_fragment_invocation_density);
|
||||
symbolTable.setVariableExtensions("gl_FragInvocationCountEXT", 1, &E_GL_EXT_fragment_invocation_density);
|
||||
BuiltInVariable("gl_FragSizeEXT", EbvFragSizeEXT, symbolTable);
|
||||
BuiltInVariable("gl_FragInvocationCountEXT", EbvFragInvocationCountEXT, symbolTable);
|
||||
}
|
||||
|
||||
symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &E_GL_EXT_frag_depth);
|
||||
|
||||
if (profile == EEsProfile && version < 320) {
|
||||
|
||||
@@ -205,6 +205,7 @@ void TParseVersions::initializeExtensionBehavior()
|
||||
extensionBehavior[E_GL_EXT_nonuniform_qualifier] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_samplerless_texture_functions] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_scalar_block_layout] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_fragment_invocation_density] = EBhDisable;
|
||||
|
||||
extensionBehavior[E_GL_EXT_shader_16bit_storage] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_shader_8bit_storage] = EBhDisable;
|
||||
@@ -380,6 +381,7 @@ void TParseVersions::getPreamble(std::string& preamble)
|
||||
"#define GL_EXT_shader_8bit_storage 1\n"
|
||||
"#define GL_EXT_samplerless_texture_functions 1\n"
|
||||
"#define GL_EXT_scalar_block_layout 1\n"
|
||||
"#define GL_EXT_fragment_invocation_density 1\n"
|
||||
|
||||
// GL_KHR_shader_subgroup
|
||||
"#define GL_KHR_shader_subgroup_basic 1\n"
|
||||
|
||||
@@ -167,6 +167,7 @@ const char* const E_GL_EXT_control_flow_attributes = "GL_EXT_control_fl
|
||||
const char* const E_GL_EXT_nonuniform_qualifier = "GL_EXT_nonuniform_qualifier";
|
||||
const char* const E_GL_EXT_samplerless_texture_functions = "GL_EXT_samplerless_texture_functions";
|
||||
const char* const E_GL_EXT_scalar_block_layout = "GL_EXT_scalar_block_layout";
|
||||
const char* const E_GL_EXT_fragment_invocation_density = "GL_EXT_fragment_invocation_density";
|
||||
|
||||
// Arrays of extensions for the above viewportEXTs duplications
|
||||
|
||||
|
||||
Reference in New Issue
Block a user