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
diff --git a/include/GLSLANG/ShaderLang.h b/include/GLSLANG/ShaderLang.h
index 1237727..9a06dea 100644
--- a/include/GLSLANG/ShaderLang.h
+++ b/include/GLSLANG/ShaderLang.h
@@ -37,7 +37,7 @@
// Version number for shader translation API.
// 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
@@ -120,7 +120,8 @@
SH_HASHED_NAME_MAX_LENGTH = 0x6002,
SH_HASHED_NAMES_COUNT = 0x6003,
SH_ACTIVE_UNIFORMS_ARRAY = 0x6004,
- SH_SHADER_VERSION = 0x6005
+ SH_SHADER_VERSION = 0x6005,
+ SH_ACTIVE_INTERFACE_BLOCKS_ARRAY = 0x6006,
} ShShaderInfo;
// Compile options.
diff --git a/src/compiler/ShaderLang.cpp b/src/compiler/ShaderLang.cpp
index 6aefaaa..7b3fa75 100644
--- a/src/compiler/ShaderLang.cpp
+++ b/src/compiler/ShaderLang.cpp
@@ -376,6 +376,9 @@
case SH_ACTIVE_UNIFORMS_ARRAY:
*params = (void*)&translator->getUniforms();
break;
+ case SH_ACTIVE_INTERFACE_BLOCKS_ARRAY:
+ *params = (void*)&translator->getInterfaceBlocks();
+ break;
default: UNREACHABLE();
}
}
diff --git a/src/compiler/TranslatorHLSL.cpp b/src/compiler/TranslatorHLSL.cpp
index 37408a0..0819424 100644
--- a/src/compiler/TranslatorHLSL.cpp
+++ b/src/compiler/TranslatorHLSL.cpp
@@ -21,4 +21,5 @@
outputHLSL.output();
mActiveUniforms = outputHLSL.getUniforms();
+ mActiveInterfaceBlocks = outputHLSL.getInterfaceBlocks();
}
diff --git a/src/compiler/TranslatorHLSL.h b/src/compiler/TranslatorHLSL.h
index 9550e15..3cb8b90 100644
--- a/src/compiler/TranslatorHLSL.h
+++ b/src/compiler/TranslatorHLSL.h
@@ -16,11 +16,13 @@
virtual TranslatorHLSL *getAsTranslatorHLSL() { return this; }
const sh::ActiveUniforms &getUniforms() { return mActiveUniforms; }
+ const sh::ActiveInterfaceBlocks &getInterfaceBlocks() const { return mActiveInterfaceBlocks; }
protected:
virtual void translate(TIntermNode* root);
sh::ActiveUniforms mActiveUniforms;
+ sh::ActiveInterfaceBlocks mActiveInterfaceBlocks;
ShShaderOutput mOutputType;
};
diff --git a/src/libGLESv2/Shader.cpp b/src/libGLESv2/Shader.cpp
index a52cf5b..ca01621 100644
--- a/src/libGLESv2/Shader.cpp
+++ b/src/libGLESv2/Shader.cpp
@@ -424,6 +424,10 @@
void *activeUniforms;
ShGetInfoPointer(compiler, SH_ACTIVE_UNIFORMS_ARRAY, &activeUniforms);
mActiveUniforms = *(sh::ActiveUniforms*)activeUniforms;
+
+ void *activeInterfaceBlocks;
+ ShGetInfoPointer(compiler, SH_ACTIVE_INTERFACE_BLOCKS_ARRAY, &activeInterfaceBlocks);
+ mActiveInterfaceBlocks = *(sh::ActiveInterfaceBlocks*)activeInterfaceBlocks;
}
else
{