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:
Daniel Koch 2018-11-26 10:01:58 -05:00
parent 83fe01e274
commit 5154db5183
18 changed files with 215 additions and 12 deletions

View file

@ -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) {