Commit 29cd91af by alokp@chromium.org

Added an option for specifying language specification in preparation for…

Added an option for specifying language specification in preparation for supporting WebGL in addition to GLES2. This CL just replaces unused debugOptions variable with EShSpec variable. BUG=11 Review URL: http://codereview.appspot.com/1692051 git-svn-id: https://angleproject.googlecode.com/svn/trunk@344 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 01b666f2
......@@ -42,6 +42,15 @@ typedef enum {
} EShLanguage;
//
// The language specification compiler conforms to.
// It currently supports OpenGL ES and WebGL specifications.
//
typedef enum {
EShSpecGLES2,
EShSpecWebGL,
} EShSpec;
//
// Types of output the linker will create.
//
typedef enum {
......@@ -88,7 +97,7 @@ typedef void* ShHandle;
// Driver calls these to create and destroy compiler/linker
// objects.
//
ShHandle ShConstructCompiler(const EShLanguage, int debugOptions); // one per shader
ShHandle ShConstructCompiler(EShLanguage, EShSpec); // one per shader
ShHandle ShConstructLinker(const EShExecutable, int debugOptions); // one per shader pair
ShHandle ShConstructUniformMap(); // one per uniform namespace (currently entire program object)
void ShDestruct(ShHandle);
......
......@@ -71,7 +71,7 @@ int C_DECL main(int argc, char* argv[])
default: usage(); return EFailUsage;
}
} else {
compilers[numCompilers] = ShConstructCompiler(FindLanguage(argv[0]), debugOptions);
compilers[numCompilers] = ShConstructCompiler(FindLanguage(argv[0]), EShSpecGLES2);
if (compilers[numCompilers] == 0)
return EFailCompilerCreate;
++numCompilers;
......
......@@ -11,9 +11,9 @@
// compile object used by higher level code. It returns
// a subclass of TCompiler.
//
TCompiler* ConstructCompiler(EShLanguage language, int debugOptions)
TCompiler* ConstructCompiler(EShLanguage language, EShSpec spec)
{
return new TranslatorGLSL(language, debugOptions);
return new TranslatorGLSL(language, spec);
}
//
......
......@@ -11,9 +11,9 @@
// compile object used by higher level code. It returns
// a subclass of TCompiler.
//
TCompiler* ConstructCompiler(EShLanguage language, int debugOptions)
TCompiler* ConstructCompiler(EShLanguage language, EShSpec spec)
{
return new TranslatorHLSL(language, debugOptions);
return new TranslatorHLSL(language, spec);
}
//
......
......@@ -56,7 +56,7 @@ class TIntermNode;
//
class TCompiler : public TShHandleBase {
public:
TCompiler(EShLanguage l) : language(l), haveValidObjectCode(false) { }
TCompiler(EShLanguage l, EShSpec s) : language(l), spec(s), haveValidObjectCode(false) { }
virtual ~TCompiler() { }
EShLanguage getLanguage() { return language; }
virtual TInfoSink& getInfoSink() { return infoSink; }
......@@ -69,6 +69,7 @@ public:
TInfoSink infoSink;
protected:
EShLanguage language;
EShSpec spec;
bool haveValidObjectCode;
};
......@@ -125,7 +126,7 @@ protected:
// destroy the machine dependent objects, which contain the
// above machine independent information.
//
TCompiler* ConstructCompiler(EShLanguage, int);
TCompiler* ConstructCompiler(EShLanguage, EShSpec);
TShHandleBase* ConstructLinker(EShExecutable, int);
void DeleteLinker(TShHandleBase*);
......
......@@ -82,12 +82,12 @@ int ShInitialize()
// objects.
//
ShHandle ShConstructCompiler(const EShLanguage language, int debugOptions)
ShHandle ShConstructCompiler(EShLanguage language, EShSpec spec)
{
if (!InitThread())
return 0;
TShHandleBase* base = static_cast<TShHandleBase*>(ConstructCompiler(language, debugOptions));
TShHandleBase* base = static_cast<TShHandleBase*>(ConstructCompiler(language, spec));
return reinterpret_cast<void*>(base);
}
......
......@@ -8,9 +8,8 @@
#include "compiler/OutputGLSL.h"
TranslatorGLSL::TranslatorGLSL(EShLanguage l, int dOptions)
: TCompiler(l),
debugOptions(dOptions) {
TranslatorGLSL::TranslatorGLSL(EShLanguage lang, EShSpec spec)
: TCompiler(lang, spec) {
}
bool TranslatorGLSL::compile(TIntermNode* root) {
......
......@@ -11,9 +11,8 @@
class TranslatorGLSL : public TCompiler {
public:
TranslatorGLSL(EShLanguage l, int dOptions);
TranslatorGLSL(EShLanguage lang, EShSpec spec);
virtual bool compile(TIntermNode* root);
int debugOptions;
};
#endif // COMPILER_TRANSLATORGLSL_H_
......@@ -8,8 +8,8 @@
#include "compiler/OutputHLSL.h"
TranslatorHLSL::TranslatorHLSL(EShLanguage language, int debugOptions)
: TCompiler(language), debugOptions(debugOptions)
TranslatorHLSL::TranslatorHLSL(EShLanguage lang, EShSpec spec)
: TCompiler(lang, spec)
{
}
......
......@@ -11,9 +11,8 @@
class TranslatorHLSL : public TCompiler {
public:
TranslatorHLSL(EShLanguage l, int dOptions);
TranslatorHLSL(EShLanguage lang, EShSpec spec);
virtual bool compile(TIntermNode* root);
int debugOptions;
};
#endif // COMPILER_TRANSLATORHLSL_H_
......@@ -34,8 +34,8 @@ Shader::Shader(Context *context, GLuint handle) : mHandle(handle), mContext(cont
if (result)
{
mFragmentCompiler = ShConstructCompiler(EShLangFragment, EDebugOpObjectCode);
mVertexCompiler = ShConstructCompiler(EShLangVertex, EDebugOpObjectCode);
mFragmentCompiler = ShConstructCompiler(EShLangFragment, EShSpecGLES2);
mVertexCompiler = ShConstructCompiler(EShLangVertex, EShSpecGLES2);
}
}
......
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