Commit 96d8042a by John Kessenich

Merge pull request #31 from google/explicit-extension-directive

Only output explicit extension directives in preprocessing.
parents 12a38337 1d2996db
#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
......
#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
......
......@@ -5352,4 +5352,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
......@@ -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();
......
......@@ -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))
......
......@@ -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')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment