Add getStage() and getIntermediate() methods for consumers. Also removed dead options and update test file.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@26126 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2014-03-28 17:49:10 +00:00
parent f5dd2f5c7c
commit 585982e32a
4 changed files with 18 additions and 34 deletions

View File

@ -867,7 +867,6 @@ char** ReadFileData(const char* fileName)
const int maxSourceStrings = 5;
char** return_data = (char**)malloc(sizeof(char *) * (maxSourceStrings+1));
//return_data[MAX_SOURCE_STRINGS]=NULL;
if (errorCode) {
printf("Error: unable to open input file: %s\n", fileName);
return 0;
@ -878,10 +877,9 @@ char** ReadFileData(const char* fileName)
fseek(in, 0, SEEK_SET);
if (!(fdata = (char*)malloc(count+2))) {
printf("Error allocating memory\n");
return 0;
printf("Error allocating memory\n");
return 0;
}
if (fread(fdata,1,count, in)!=count) {
printf("Error reading input file: %s\n", fileName);

View File

@ -4,26 +4,21 @@ WARNING: 0:3: varying deprecated in version 130; may be removed in future releas
WARNING: 0:4: varying deprecated in version 130; may be removed in future release
0:? Sequence
0:8 Function Definition: main( (void)
0:8 Function Parameters:
0:10 Sequence
0:10 move second child to first child (float)
0:10 'gl_FragDepth' (gl_FragDepth float)
0:10 'Depth' (smooth in float)
0:11 move second child to first child (4-component vector of float)
0:11 'gl_FragColor' (fragColor 4-component vector of float)
0:11 'Color' (smooth in 4-component vector of float)
0:12 move second child to first child (4-component vector of float)
0:12 'foo' (out 4-component vector of float)
0:12 'Color' (smooth in 4-component vector of float)
0:6 Function Definition: main( (void)
0:6 Function Parameters:
0:8 Sequence
0:8 move second child to first child (float)
0:8 'gl_FragDepth' (gl_FragDepth float)
0:8 'Depth' (smooth in float)
0:9 move second child to first child (4-component vector of float)
0:9 'gl_FragColor' (fragColor 4-component vector of float)
0:9 'Color' (smooth in 4-component vector of float)
0:? Linker Objects
0:? 'Color' (smooth in 4-component vector of float)
0:? 'Depth' (smooth in float)
0:? 'foo' (out 4-component vector of float)
Linked fragment stage:
ERROR: Linking fragment stage: Cannot use gl_FragColor or gl_FragData when using user-defined outputs

View File

@ -126,6 +126,7 @@ public:
int getVersion() const { return version; }
void setProfile(EProfile p) { profile = p; }
EProfile getProfile() const { return profile; }
EShLanguage getStage() const { return language; }
void setTreeRoot(TIntermNode* r) { treeRoot = r; }
TIntermNode* getTreeRoot() const { return treeRoot; }
void addMainCount() { ++numMains; }

View File

@ -223,21 +223,6 @@ SH_IMPORT_EXPORT int ShExcludeAttributes(const ShHandle, int *attributes, int co
//
SH_IMPORT_EXPORT int ShGetUniformLocation(const ShHandle uniformMap, const char* name);
// These are currently unused in the front end, but consumers of the front-end still
// be rely on them:
enum TDebugOptions {
EDebugOpNone = 0x000,
EDebugOpIntermediate = 0x001,
EDebugOpAssembly = 0x002,
EDebugOpObjectCode = 0x004,
EDebugOpLinkMaps = 0x008,
EDebugOpSuppressInfolog = 0x010,
EDebugOpMemoryLeakMode = 0x020,
EDebugOpTexturePrototypes = 0x040,
EDebugOpRelaxedErrors = 0x080,
EDebugOpGiveWarnings = 0x100,
};
#ifdef __cplusplus
} // end extern "C"
#endif
@ -282,7 +267,7 @@ void FinalizeProcess();
// provide the shader through setStrings(), then call parse(), then query
// the info logs.
//
// N.B.: Does not yet support having the same TShader instance being linked 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.
//
@ -292,9 +277,12 @@ public:
virtual ~TShader();
void setStrings(const char* const* s, int n) { strings = s; numStrings = n; }
bool parse(const TBuiltInResource*, int defaultVersion, bool forwardCompatible, EShMessages);
const char* getInfoLog();
const char* getInfoDebugLog();
EShLanguage getStage() const { return stage; }
protected:
TPoolAllocator* pool;
EShLanguage stage;
@ -329,6 +317,8 @@ public:
const char* getInfoLog();
const char* getInfoDebugLog();
TIntermediate* getIntermediate(EShLanguage stage) const { return intermediate[stage]; }
// Reflection Interface
bool buildReflection(); // call first, to do liveness analysis, index mapping, etc.; returns false on failure
int getNumLiveUniformVariables(); // can be used for glGetProgramiv(GL_ACTIVE_UNIFORMS)