Only output explicit extension directives in preprocessing.

Preprocessing output shouldn't contain extensions enabled as
dependencies.
This commit is contained in:
Lei Zhang 2015-07-16 18:34:55 -04:00
parent 222457054e
commit 1d2996db68
6 changed files with 11 additions and 5 deletions

View File

@ -1,6 +1,6 @@
#version 310 es
#extension GL_OES_texture_3D : enable
#extension GL_EXT_geometry_shader : enable
#extension GL_EXT_frag_depth : disable
#extension GL_EXT_gpu_shader5 : require
#extension GL_EXT_shader_texture_image_samples : warn

View File

@ -1,6 +1,6 @@
#version 310 es
#extension GL_OES_texture_3D: enable
#extension GL_EXT_geometry_shader: enable
#extension GL_EXT_frag_depth: disable
#extension GL_EXT_gpu_shader5: require
#extension GL_EXT_shader_texture_image_samples: warn

View File

@ -5333,4 +5333,11 @@ void TParseContext::notifyLineDirective(int curLineNo, int newLineNo, bool hasSo
}
}
void TParseContext::notifyExtensionDirective(int line, const char* extension, const char* behavior)
{
if (extensionCallback) {
extensionCallback(line, extension, behavior);
}
}
} // end namespace glslang

View File

@ -222,6 +222,7 @@ public:
void notifyVersion(int line, int version, const char* type_string);
void notifyErrorDirective(int line, const char* error_message);
void notifyLineDirective(int curLineNo, int newLineNo, bool hasSource, int sourceNum);
void notifyExtensionDirective(int line, const char* extension, const char* behavior);
// The following are implemented in Versions.cpp to localize version/profile/stage/extensions control
void initializeExtensionBehavior();

View File

@ -475,9 +475,6 @@ bool TParseContext::extensionsTurnedOn(int numExtensions, const char* const exte
//
void TParseContext::updateExtensionBehavior(int line, const char* extension, const char* behaviorString)
{
if (extensionCallback)
extensionCallback(line, extension, behaviorString);
// Translate from text string of extension's behavior to an enum.
TExtensionBehavior behavior = EBhDisable;
if (! strcmp("require", behaviorString))

View File

@ -773,6 +773,7 @@ int TPpContext::CPPextension(TPpToken* ppToken)
}
parseContext.updateExtensionBehavior(line, extensionName, ppToken->name);
parseContext.notifyExtensionDirective(line, extensionName, ppToken->name);
token = scanToken(ppToken);
if (token == '\n')