Enable the translator to pass parsed interface blocks back to the ANGLE API via…

Enable the translator to pass parsed interface blocks back to the ANGLE API via the shader translator layer. TRAC #22930 Signed-off-by: Nicolas Capens Signed-off-by: Geoff Lang Author: Jamie Madill git-svn-id: https://angleproject.googlecode.com/svn/branches/es3proto@2346 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 4430b0d3
...@@ -37,7 +37,7 @@ extern "C" { ...@@ -37,7 +37,7 @@ extern "C" {
// Version number for shader translation API. // Version number for shader translation API.
// It is incremented everytime the API changes. // It is incremented everytime the API changes.
#define ANGLE_SH_VERSION 111 #define ANGLE_SH_VERSION 112
// //
// The names of the following enums have been derived by replacing GL prefix // The names of the following enums have been derived by replacing GL prefix
...@@ -120,7 +120,8 @@ typedef enum { ...@@ -120,7 +120,8 @@ typedef enum {
SH_HASHED_NAME_MAX_LENGTH = 0x6002, SH_HASHED_NAME_MAX_LENGTH = 0x6002,
SH_HASHED_NAMES_COUNT = 0x6003, SH_HASHED_NAMES_COUNT = 0x6003,
SH_ACTIVE_UNIFORMS_ARRAY = 0x6004, SH_ACTIVE_UNIFORMS_ARRAY = 0x6004,
SH_SHADER_VERSION = 0x6005 SH_SHADER_VERSION = 0x6005,
SH_ACTIVE_INTERFACE_BLOCKS_ARRAY = 0x6006,
} ShShaderInfo; } ShShaderInfo;
// Compile options. // Compile options.
......
...@@ -376,6 +376,9 @@ void ShGetInfoPointer(const ShHandle handle, ShShaderInfo pname, void** params) ...@@ -376,6 +376,9 @@ void ShGetInfoPointer(const ShHandle handle, ShShaderInfo pname, void** params)
case SH_ACTIVE_UNIFORMS_ARRAY: case SH_ACTIVE_UNIFORMS_ARRAY:
*params = (void*)&translator->getUniforms(); *params = (void*)&translator->getUniforms();
break; break;
case SH_ACTIVE_INTERFACE_BLOCKS_ARRAY:
*params = (void*)&translator->getInterfaceBlocks();
break;
default: UNREACHABLE(); default: UNREACHABLE();
} }
} }
...@@ -21,4 +21,5 @@ void TranslatorHLSL::translate(TIntermNode *root) ...@@ -21,4 +21,5 @@ void TranslatorHLSL::translate(TIntermNode *root)
outputHLSL.output(); outputHLSL.output();
mActiveUniforms = outputHLSL.getUniforms(); mActiveUniforms = outputHLSL.getUniforms();
mActiveInterfaceBlocks = outputHLSL.getInterfaceBlocks();
} }
...@@ -16,11 +16,13 @@ public: ...@@ -16,11 +16,13 @@ public:
virtual TranslatorHLSL *getAsTranslatorHLSL() { return this; } virtual TranslatorHLSL *getAsTranslatorHLSL() { return this; }
const sh::ActiveUniforms &getUniforms() { return mActiveUniforms; } const sh::ActiveUniforms &getUniforms() { return mActiveUniforms; }
const sh::ActiveInterfaceBlocks &getInterfaceBlocks() const { return mActiveInterfaceBlocks; }
protected: protected:
virtual void translate(TIntermNode* root); virtual void translate(TIntermNode* root);
sh::ActiveUniforms mActiveUniforms; sh::ActiveUniforms mActiveUniforms;
sh::ActiveInterfaceBlocks mActiveInterfaceBlocks;
ShShaderOutput mOutputType; ShShaderOutput mOutputType;
}; };
......
...@@ -424,6 +424,10 @@ void Shader::compileToHLSL(void *compiler) ...@@ -424,6 +424,10 @@ void Shader::compileToHLSL(void *compiler)
void *activeUniforms; void *activeUniforms;
ShGetInfoPointer(compiler, SH_ACTIVE_UNIFORMS_ARRAY, &activeUniforms); ShGetInfoPointer(compiler, SH_ACTIVE_UNIFORMS_ARRAY, &activeUniforms);
mActiveUniforms = *(sh::ActiveUniforms*)activeUniforms; mActiveUniforms = *(sh::ActiveUniforms*)activeUniforms;
void *activeInterfaceBlocks;
ShGetInfoPointer(compiler, SH_ACTIVE_INTERFACE_BLOCKS_ARRAY, &activeInterfaceBlocks);
mActiveInterfaceBlocks = *(sh::ActiveInterfaceBlocks*)activeInterfaceBlocks;
} }
else else
{ {
......
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