GLSL: Implement gl_FragFullyCoveredNV.

This commit is contained in:
Hans-Kristian Arntzen 2021-04-20 13:44:52 +02:00
parent 3cb8e7c223
commit 3fd148450a
3 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,14 @@
#version 450
#extension GL_NV_conservative_raster_underestimation : require
layout(location = 0) out vec4 FragColor;
void main()
{
if (!gl_FragFullyCoveredNV)
{
discard;
}
FragColor = vec4(1.0);
}

View File

@ -0,0 +1,11 @@
#version 450
#extension GL_NV_conservative_raster_underestimation : require
layout(location = 0) out vec4 FragColor;
void main()
{
if (!gl_FragFullyCoveredNV)
discard;
FragColor = vec4(1.0);
}

View File

@ -8323,6 +8323,13 @@ string CompilerGLSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage)
require_extension_internal("GL_EXT_device_group");
return "gl_DeviceIndex";
case BuiltInFullyCoveredEXT:
if (!options.es)
require_extension_internal("GL_NV_conservative_raster_underestimation");
else
SPIRV_CROSS_THROW("Need desktop GL to use GL_NV_conservative_raster_underestimation.");
return "gl_FragFullyCoveredNV";
default:
return join("gl_BuiltIn_", convert_to_string(builtin));
}