glslang: Allow programmatically prepending code to a shader without worrying about #version being first, to implement command-line-defined macros. From Dejan Mircevski <deki@google.com>.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31448 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2015-06-08 18:31:23 +00:00
parent a49fe84a4e
commit b8478d7eac
2 changed files with 32 additions and 20 deletions

View file

@ -263,11 +263,13 @@ bool InitializeProcess();
// Call once per process to tear down everything
void FinalizeProcess();
// Make one TShader per shader that you will link into a program. Then
// provide the shader through setStrings(), then call parse(), then query
// the info logs.
// Make one TShader per shader that you will link into a program. Then provide
// the shader through setStrings(), then call parse(), then query the info logs.
// Optionally use setPreamble() to set a special shader string that will be
// processed before all others but won't affect the validity of #version.
//
// N.B.: Does not yet support having the same TShader instance being linked into multiple programs.
// N.B.: Does not yet support having the same TShader instance being linked into
// multiple programs.
//
// N.B.: Destruct a linked program *before* destructing the shaders linked into it.
//
@ -276,6 +278,7 @@ public:
explicit TShader(EShLanguage);
virtual ~TShader();
void setStrings(const char* const* s, int n) { strings = s; numStrings = n; }
void setPreamble(const char* s) { preamble = s; }
bool parse(const TBuiltInResource*, int defaultVersion, bool forwardCompatible, EShMessages);
const char* getInfoLog();
@ -290,6 +293,7 @@ protected:
TIntermediate* intermediate;
TInfoSink* infoSink;
const char* const* strings;
const char* preamble;
int numStrings;
friend class TProgram;