Refactored the way symbol tables are initialized and stored. This was done in response to the addition of EShSpec.
Symbol table entries depend on three things - language, spec (not now but may eventually), and built-in resources.
We used to build two global symbol-tables - one for each language. During each compile, one of the symbol table was
copied and resource-specific stuff was added. I have moved the symbol table to TCompiler that gets initilized when
compiler is created and reused for each compile. This makes it much cleaner and extensible in case a spec requires
special entries to be added to the symbol table.
PS: Sorry for the long CL, but all of it needed to be done in one CL. I have verified that everything still compiles
and passes all conformance tests.
Review URL: http://codereview.appspot.com/1864044
git-svn-id: https://angleproject.googlecode.com/svn/trunk@351 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Shader.cpp b/src/libGLESv2/Shader.cpp
index 59aa69f..730c1b5 100644
--- a/src/libGLESv2/Shader.cpp
+++ b/src/libGLESv2/Shader.cpp
@@ -34,8 +34,18 @@
if (result)
{
- mFragmentCompiler = ShConstructCompiler(EShLangFragment, EShSpecGLES2);
- mVertexCompiler = ShConstructCompiler(EShLangVertex, EShSpecGLES2);
+ TBuiltInResource resources;
+ resources.maxVertexAttribs = MAX_VERTEX_ATTRIBS;
+ resources.maxVertexUniformVectors = MAX_VERTEX_UNIFORM_VECTORS;
+ resources.maxVaryingVectors = MAX_VARYING_VECTORS;
+ resources.maxVertexTextureImageUnits = MAX_VERTEX_TEXTURE_IMAGE_UNITS;
+ resources.maxCombinedTextureImageUnits = MAX_COMBINED_TEXTURE_IMAGE_UNITS;
+ resources.maxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
+ resources.maxFragmentUniformVectors = MAX_FRAGMENT_UNIFORM_VECTORS;
+ resources.maxDrawBuffers = MAX_DRAW_BUFFERS;
+
+ mFragmentCompiler = ShConstructCompiler(EShLangFragment, EShSpecGLES2, &resources);
+ mVertexCompiler = ShConstructCompiler(EShLangVertex, EShSpecGLES2, &resources);
}
}
@@ -267,18 +277,7 @@
delete[] mInfoLog;
mInfoLog = NULL;
- TBuiltInResource resources;
-
- resources.maxVertexAttribs = MAX_VERTEX_ATTRIBS;
- resources.maxVertexUniformVectors = MAX_VERTEX_UNIFORM_VECTORS;
- resources.maxVaryingVectors = MAX_VARYING_VECTORS;
- resources.maxVertexTextureImageUnits = MAX_VERTEX_TEXTURE_IMAGE_UNITS;
- resources.maxCombinedTextureImageUnits = MAX_COMBINED_TEXTURE_IMAGE_UNITS;
- resources.maxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
- resources.maxFragmentUniformVectors = MAX_FRAGMENT_UNIFORM_VECTORS;
- resources.maxDrawBuffers = MAX_DRAW_BUFFERS;
-
- int result = ShCompile(compiler, &mSource, 1, EShOptNone, &resources, EDebugOpNone);
+ int result = ShCompile(compiler, &mSource, 1, EShOptNone, EDebugOpNone);
const char *obj = ShGetObjectCode(compiler);
const char *info = ShGetInfoLog(compiler);