Eliminate the ShaderLang interface.
Bug 19331817
Change-Id: I6f5e0c1130974a16cec9575f0fefdd81707b648b
Reviewed-on: https://swiftshader-review.googlesource.com/2153
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/compiler/Compiler.cpp b/src/OpenGL/compiler/Compiler.cpp
index e34bee9..436e49f 100644
--- a/src/OpenGL/compiler/Compiler.cpp
+++ b/src/OpenGL/compiler/Compiler.cpp
@@ -4,11 +4,13 @@
// found in the LICENSE file.
//
+#include "Compiler.h"
+
#include "AnalyzeCallDepth.h"
#include "Initialize.h"
#include "InitializeParseContext.h"
+#include "InitializeGlobals.h"
#include "ParseHelper.h"
-#include "Compiler.h"
#include "ValidateLimitations.h"
namespace
@@ -31,6 +33,29 @@
};
} // namespace
+//
+// Initialize built-in resources with minimum expected values.
+//
+ShBuiltInResources::ShBuiltInResources()
+{
+ // Constants.
+ MaxVertexAttribs = 8;
+ MaxVertexUniformVectors = 128;
+ MaxVaryingVectors = 8;
+ MaxVertexTextureImageUnits = 0;
+ MaxCombinedTextureImageUnits = 8;
+ MaxTextureImageUnits = 8;
+ MaxFragmentUniformVectors = 16;
+ MaxDrawBuffers = 1;
+
+ // Extensions.
+ OES_standard_derivatives = 0;
+ OES_fragment_precision_high = 0;
+ OES_EGL_image_external = 0;
+
+ MaxCallStackDepth = UINT_MAX;
+}
+
TCompiler::TCompiler(ShShaderType type, ShShaderSpec spec)
: shaderType(type),
shaderSpec(spec),
@@ -210,3 +235,26 @@
{
return extensionBehavior;
}
+
+bool InitCompilerGlobals()
+{
+ if(!InitializePoolIndex())
+ {
+ assert(0 && "InitCompilerGlobals(): Failed to initalize global pool");
+ return false;
+ }
+
+ if(!InitializeParseContextIndex())
+ {
+ assert(0 && "InitCompilerGlobals(): Failed to initalize parse context");
+ return false;
+ }
+
+ return true;
+}
+
+void FreeCompilerGlobals()
+{
+ FreeParseContextIndex();
+ FreePoolIndex();
+}
\ No newline at end of file