glslang preprocessing: Add -E option to print out preprocessed GLSL, and do the work needed to generate a preprocessed stream. From Andrew Woloszyn <awoloszyn@google.com>.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31508 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
9288f46b95
commit
c555dddd53
23 changed files with 609 additions and 55 deletions
|
|
@ -41,6 +41,7 @@
|
|||
#include "SymbolTable.h"
|
||||
#include "localintermediate.h"
|
||||
#include "Scan.h"
|
||||
#include <functional>
|
||||
|
||||
#include <functional>
|
||||
|
||||
|
|
@ -200,10 +201,13 @@ public:
|
|||
void addError() { ++numErrors; }
|
||||
int getNumErrors() const { return numErrors; }
|
||||
const TSourceLoc& getCurrentLoc() const { return currentScanner->getSourceLoc(); }
|
||||
void setCurrentLine(int line);
|
||||
void setCurrentLine(int line) { currentScanner->setLine(line); }
|
||||
void setCurrentString(int string) { currentScanner->setString(string); }
|
||||
void setScanner(TInputScanner* scanner) { currentScanner = scanner; }
|
||||
|
||||
void notifyVersion(int line, int version, const char* type_string);
|
||||
void notifyErrorDirective(int line, const char* error_message);
|
||||
void notifyLineDirective(int line, bool has_source, int source);
|
||||
|
||||
// The following are implemented in Versions.cpp to localize version/profile/stage/extensions control
|
||||
void initializeExtensionBehavior();
|
||||
|
|
@ -223,8 +227,9 @@ public:
|
|||
|
||||
void setVersionCallback(const std::function<void(int, int, const char*)>& func) { versionCallback = func; }
|
||||
void setPragmaCallback(const std::function<void(int, const TVector<TString>&)>& func) { pragmaCallback = func; }
|
||||
void setLineCallback(const std::function<void(int)>& func) { lineCallback = func; }
|
||||
void setLineCallback(const std::function<void(int, bool, int)>& func) { lineCallback = func; }
|
||||
void setExtensionCallback(const std::function<void(int, const char*, const char*)>& func) { extensionCallback = func; }
|
||||
void setErrorCallback(const std::function<void(int, const char*)>& func) { errorCallback = func; }
|
||||
|
||||
protected:
|
||||
void nonInitConstCheck(TSourceLoc, TString& identifier, TType& type);
|
||||
|
|
@ -333,10 +338,11 @@ protected:
|
|||
|
||||
// These, if set, will be called when a line, pragma ... is preprocessed.
|
||||
// They will be called with any parameters to the original directive.
|
||||
std::function<void(int)> lineCallback;
|
||||
std::function<void(int, bool, int)> lineCallback;
|
||||
std::function<void(int, const TVector<TString>&)> pragmaCallback;
|
||||
std::function<void(int, int, const char*)> versionCallback;
|
||||
std::function<void(int, const char*, const char*)> extensionCallback;
|
||||
std::function<void(int, const char*)> errorCallback;
|
||||
};
|
||||
|
||||
} // end namespace glslang
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue