Front-end: Implement GL_EXT_shader_non_constant_global_initializers.
This lets ES shaders use non-constant initializers for non-constant globals.
This commit is contained in:
parent
b901ade058
commit
21f1286f57
5 changed files with 48 additions and 6 deletions
|
|
@ -5083,11 +5083,13 @@ TIntermNode* TParseContext::executeInitializer(const TSourceLoc& loc, TIntermTyp
|
|||
// "In declarations of global variables with no storage qualifier or with a const
|
||||
// qualifier any initializer must be a constant expression."
|
||||
if (symbolTable.atGlobalLevel() && ! initializer->getType().getQualifier().isConstant()) {
|
||||
const char* initFeature = "non-constant global initializer";
|
||||
if (relaxedErrors())
|
||||
warn(loc, "not allowed in this version", initFeature, "");
|
||||
else
|
||||
requireProfile(loc, ~EEsProfile, initFeature);
|
||||
const char* initFeature = "non-constant global initializer (needs GL_EXT_shader_non_constant_global_initializers)";
|
||||
if (profile == EEsProfile) {
|
||||
if (relaxedErrors() && ! extensionTurnedOn(E_GL_EXT_shader_non_constant_global_initializers))
|
||||
warn(loc, "not allowed in this version", initFeature, "");
|
||||
else
|
||||
profileRequires(loc, EEsProfile, 0, E_GL_EXT_shader_non_constant_global_initializers, initFeature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -182,6 +182,8 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_ARB_sparse_texture_clamp] = EBhDisable;
|
||||
// extensionBehavior[E_GL_ARB_cull_distance] = EBhDisable; // present for 4.5, but need extension control over block members
|
||||
|
||||
extensionBehavior[E_GL_EXT_shader_non_constant_global_initializers] = EBhDisable;
|
||||
|
||||
// #line and #include
|
||||
extensionBehavior[E_GL_GOOGLE_cpp_style_line_directive] = EBhDisable;
|
||||
extensionBehavior[E_GL_GOOGLE_include_directive] = EBhDisable;
|
||||
|
|
@ -256,6 +258,7 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
"#define GL_OES_tessellation_point_size 1\n"
|
||||
"#define GL_OES_texture_buffer 1\n"
|
||||
"#define GL_OES_texture_cube_map_array 1\n"
|
||||
"#define GL_EXT_shader_non_constant_global_initializers 1\n"
|
||||
;
|
||||
} else {
|
||||
preamble =
|
||||
|
|
@ -284,6 +287,7 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
"#define GL_ARB_sparse_texture2 1\n"
|
||||
"#define GL_ARB_sparse_texture_clamp 1\n"
|
||||
// "#define GL_ARB_cull_distance 1\n" // present for 4.5, but need extension control over block members
|
||||
"#define GL_EXT_shader_non_constant_global_initializers 1\n"
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -130,6 +130,8 @@ const char* const E_GL_ARB_sparse_texture2 = "GL_ARB_sparse_texture
|
|||
const char* const E_GL_ARB_sparse_texture_clamp = "GL_ARB_sparse_texture_clamp";
|
||||
//const char* const E_GL_ARB_cull_distance = "GL_ARB_cull_distance"; // present for 4.5, but need extension control over block members
|
||||
|
||||
const char* const E_GL_EXT_shader_non_constant_global_initializers = "GL_EXT_shader_non_constant_global_initializers";
|
||||
|
||||
// #line and #include
|
||||
const char* const E_GL_GOOGLE_cpp_style_line_directive = "GL_GOOGLE_cpp_style_line_directive";
|
||||
const char* const E_GL_GOOGLE_include_directive = "GL_GOOGLE_include_directive";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue