From 585982e32a20863b8863816731d0e7f28248464a Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Fri, 28 Mar 2014 17:49:10 +0000 Subject: [PATCH] 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 --- StandAlone/StandAlone.cpp | 6 ++--- Test/baseResults/depthOut.frag.out | 23 ++++++++----------- .../MachineIndependent/localintermediate.h | 1 + glslang/Public/ShaderLang.h | 22 +++++------------- 4 files changed, 18 insertions(+), 34 deletions(-) diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index e0faecfcd..da6f10a35 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -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); diff --git a/Test/baseResults/depthOut.frag.out b/Test/baseResults/depthOut.frag.out index 733be17cf..5e858452c 100644 --- a/Test/baseResults/depthOut.frag.out +++ b/Test/baseResults/depthOut.frag.out @@ -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 diff --git a/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h index 7c91686b9..aad8135c3 100644 --- a/glslang/MachineIndependent/localintermediate.h +++ b/glslang/MachineIndependent/localintermediate.h @@ -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; } diff --git a/glslang/Public/ShaderLang.h b/glslang/Public/ShaderLang.h index 5abdbd5ca..b5cd58e80 100644 --- a/glslang/Public/ShaderLang.h +++ b/glslang/Public/ShaderLang.h @@ -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)