Add-support-for-SPV_NV_shading_rate

This commit is contained in:
Chao Chen 2018-09-19 11:43:21 -07:00
parent b50c02ef53
commit 5b2203db04
10 changed files with 93 additions and 1 deletions

View file

@ -237,6 +237,8 @@ enum TBuiltInVariable {
EbvPositionPerViewNV,
EbvViewportMaskPerViewNV,
EbvFragFullyCoveredNV,
EbvFragmentSizeNV,
EbvInvocationsPerPixelNV,
// raytracing
EbvLaunchIdNV,
EbvLaunchSizeNV,
@ -404,6 +406,8 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
case EbvPositionPerViewNV: return "PositionPerViewNV";
case EbvViewportMaskPerViewNV: return "ViewportMaskPerViewNV";
case EbvFragFullyCoveredNV: return "FragFullyCoveredNV";
case EbvFragmentSizeNV: return "FragmentSizeNV";
case EbvInvocationsPerPixelNV: return "InvocationsPerPixelNV";
case EbvLaunchIdNV: return "LaunchIdNVX";
case EbvLaunchSizeNV: return "LaunchSizeNVX";
case EbvInstanceCustomIndexNV: return "InstanceCustomIndexNVX";

View file

@ -5949,6 +5949,8 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
);
if (version >= 450)
stageBuiltins[EShLangFragment].append(
"flat in ivec2 gl_FragmentSizeNV;"
"flat in int gl_InvocationsPerPixelNV;"
"in vec3 gl_BaryCoordNV;"
"in vec3 gl_BaryCoordNoPerspNV;"
);
@ -5995,6 +5997,11 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"highp float gl_FragDepthEXT;" // GL_EXT_frag_depth
);
#ifdef NV_EXTENSIONS
if (version >= 320)
stageBuiltins[EShLangFragment].append(
"flat in ivec2 gl_FragmentSizeNV;"
"flat in int gl_InvocationsPerPixelNV;"
);
if (version >= 320)
stageBuiltins[EShLangFragment].append(
"in vec3 gl_BaryCoordNV;"
@ -8286,6 +8293,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
}
if ((profile != EEsProfile && version >= 450) ||
(profile == EEsProfile && version >= 320)) {
symbolTable.setVariableExtensions("gl_FragmentSizeNV", 1, &E_GL_NV_shading_rate_image);
symbolTable.setVariableExtensions("gl_InvocationsPerPixelNV", 1, &E_GL_NV_shading_rate_image);
BuiltInVariable("gl_FragmentSizeNV", EbvFragmentSizeNV, symbolTable);
BuiltInVariable("gl_InvocationsPerPixelNV", EbvInvocationsPerPixelNV, symbolTable);
symbolTable.setVariableExtensions("gl_BaryCoordNV", 1, &E_GL_NV_fragment_shader_barycentric);
symbolTable.setVariableExtensions("gl_BaryCoordNoPerspNV", 1, &E_GL_NV_fragment_shader_barycentric);
BuiltInVariable("gl_BaryCoordNV", EbvBaryCoordNV, symbolTable);

View file

@ -235,6 +235,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_NV_conservative_raster_underestimation] = EBhDisable;
extensionBehavior[E_GL_NV_shader_noperspective_interpolation] = EBhDisable;
extensionBehavior[E_GL_NV_shader_subgroup_partitioned] = EBhDisable;
extensionBehavior[E_GL_NV_shading_rate_image] = EBhDisable;
extensionBehavior[E_GL_NVX_raytracing] = EBhDisable;
extensionBehavior[E_GL_NV_fragment_shader_barycentric] = EBhDisable;
extensionBehavior[E_GL_NV_compute_shader_derivatives] = EBhDisable;
@ -410,6 +411,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_NV_shader_atomic_int64 1\n"
"#define GL_NV_conservative_raster_underestimation 1\n"
"#define GL_NV_shader_subgroup_partitioned 1\n"
"#define GL_NV_shading_rate_image 1\n"
"#define GL_NVX_raytracing 1\n"
"#define GL_NV_fragment_shader_barycentric 1\n"
"#define GL_NV_compute_shader_derivatives 1\n"

View file

@ -207,6 +207,7 @@ const char* const E_GL_NV_shader_atomic_int64 = "GL_NV_shader_
const char* const E_GL_NV_conservative_raster_underestimation = "GL_NV_conservative_raster_underestimation";
const char* const E_GL_NV_shader_noperspective_interpolation = "GL_NV_shader_noperspective_interpolation";
const char* const E_GL_NV_shader_subgroup_partitioned = "GL_NV_shader_subgroup_partitioned";
const char* const E_GL_NV_shading_rate_image = "GL_NV_shading_rate_image";
const char* const E_GL_NVX_raytracing = "GL_NVX_raytracing";
const char* const E_GL_NV_fragment_shader_barycentric = "GL_NV_fragment_shader_barycentric";
const char* const E_GL_NV_compute_shader_derivatives = "GL_NV_compute_shader_derivatives";