Add support for GL_NV_shader_noperspective_interpolation

This commit is contained in:
Ben Clayton 2018-03-12 15:12:38 +00:00
parent 845860d565
commit 017a567be1
11 changed files with 1118 additions and 1073 deletions

View file

@ -962,7 +962,7 @@ int TScanContext::tokenizeIdentifier()
case PATCH:
if (parseContext.symbolTable.atBuiltInLevel() ||
(parseContext.profile == EEsProfile &&
(parseContext.version >= 320 ||
(parseContext.version >= 320 ||
parseContext.extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader))) ||
(parseContext.profile != EEsProfile && parseContext.extensionTurnedOn(E_GL_ARB_tessellation_shader)))
return keyword;
@ -1450,6 +1450,11 @@ int TScanContext::tokenizeIdentifier()
#endif
case NOPERSPECTIVE:
#ifdef NV_EXTENSIONS
if (parseContext.profile == EEsProfile && parseContext.version >= 300 &&
parseContext.extensionTurnedOn(E_GL_NV_shader_noperspective_interpolation))
return keyword;
#endif
return es30ReservedFromGLSL(130);
case SMOOTH:

View file

@ -225,6 +225,7 @@ void TParseVersions::initializeExtensionBehavior()
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;
extensionBehavior[E_GL_NV_shader_noperspective_interpolation] = EBhDisable;
#endif
// AEP
@ -319,6 +320,13 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_OES_texture_cube_map_array 1\n"
"#define GL_EXT_shader_non_constant_global_initializers 1\n"
;
#ifdef NV_EXTENSIONS
if (profile == EEsProfile && version >= 300) {
preamble += "#define GL_NV_shader_noperspective_interpolation 1\n";
}
#endif
} else {
preamble =
"#define GL_FRAGMENT_PRECISION_HIGH 1\n"

View file

@ -196,6 +196,7 @@ const char* const E_GL_NV_stereo_view_rendering = "GL_NV_stereo_
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";
const char* const E_GL_NV_shader_noperspective_interpolation = "GL_NV_shader_noperspective_interpolation";
// Arrays of extensions for the above viewportEXTs duplications

View file

@ -1117,7 +1117,11 @@ interpolation_qualifier
}
| NOPERSPECTIVE {
parseContext.globalCheck($1.loc, "noperspective");
#ifdef NV_EXTENSIONS
parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective");
#else
parseContext.requireProfile($1.loc, ~EEsProfile, "noperspective");
#endif
parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "noperspective");
$$.init($1.loc);
$$.qualifier.nopersp = true;

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,8 @@
/* A Bison parser, made by GNU Bison 3.0. */
/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -437,7 +437,7 @@ extern int yydebug;
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE YYSTYPE;
union YYSTYPE
{
#line 70 "MachineIndependent/glslang.y" /* yacc.c:1909 */
@ -477,6 +477,8 @@ union YYSTYPE
#line 479 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif