Made the API of shader translator library consistent.
- We recently started using OpenGL-type enums. This CL makes all old enums consistent with the new scheme.
- Renamed TBuiltInResource to ShBuiltInResources to have a consistent prefix
BUG=46
Review URL: http://codereview.appspot.com/2328041
git-svn-id: https://angleproject.googlecode.com/svn/trunk@443 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/Initialize.cpp b/src/compiler/Initialize.cpp
index a3d12fb..12b53fe 100644
--- a/src/compiler/Initialize.cpp
+++ b/src/compiler/Initialize.cpp
@@ -341,7 +341,7 @@
// Prototypes for built-in functions seen by vertex shaders only.
//
//============================================================================
-static TString BuiltInFunctionsVertex(const TBuiltInResource& resources)
+static TString BuiltInFunctionsVertex(const ShBuiltInResources& resources)
{
TString s;
@@ -373,7 +373,7 @@
// Prototypes for built-in functions seen by fragment shaders only.
//
//============================================================================
-static TString BuiltInFunctionsFragment(const TBuiltInResource& resources)
+static TString BuiltInFunctionsFragment(const ShBuiltInResources& resources)
{
TString s;
@@ -467,7 +467,7 @@
// Implementation dependent built-in constants.
//
//============================================================================
-static TString BuiltInConstants(const TBuiltInResource &resources)
+static TString BuiltInConstants(const ShBuiltInResources &resources)
{
TStringStream s;
@@ -484,17 +484,18 @@
return s.str();
}
-void TBuiltIns::initialize(EShLanguage language, EShSpec spec, const TBuiltInResource& resources)
+void TBuiltIns::initialize(ShShaderType type, ShShaderSpec spec,
+ const ShBuiltInResources& resources)
{
- switch (language) {
- case EShLangFragment:
+ switch (type) {
+ case SH_FRAGMENT_SHADER:
builtInStrings.push_back(DefaultPrecisionFragment());
builtInStrings.push_back(BuiltInFunctionsCommon());
builtInStrings.push_back(BuiltInFunctionsFragment(resources));
builtInStrings.push_back(StandardUniforms());
break;
- case EShLangVertex:
+ case SH_VERTEX_SHADER:
builtInStrings.push_back(DefaultPrecisionVertex());
builtInStrings.push_back(BuiltInFunctionsCommon());
builtInStrings.push_back(BuiltInFunctionsVertex(resources));
@@ -507,14 +508,16 @@
builtInStrings.push_back(BuiltInConstants(resources));
}
-void IdentifyBuiltIns(EShLanguage language, EShSpec spec, const TBuiltInResource& resources, TSymbolTable& symbolTable)
+void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec,
+ const ShBuiltInResources& resources,
+ TSymbolTable& symbolTable)
{
//
// First, insert some special built-in variables that are not in
// the built-in header files.
//
- switch(language) {
- case EShLangFragment:
+ switch(type) {
+ case SH_FRAGMENT_SHADER:
symbolTable.insert(*new TVariable(NewPoolTString("gl_FragCoord"), TType(EbtFloat, EbpMedium, EvqFragCoord, 4)));
symbolTable.insert(*new TVariable(NewPoolTString("gl_FrontFacing"), TType(EbtBool, EbpUndefined, EvqFrontFacing, 1)));
symbolTable.insert(*new TVariable(NewPoolTString("gl_FragColor"), TType(EbtFloat, EbpMedium, EvqFragColor, 4)));
@@ -522,7 +525,7 @@
symbolTable.insert(*new TVariable(NewPoolTString("gl_PointCoord"), TType(EbtFloat, EbpMedium, EvqPointCoord, 2)));
break;
- case EShLangVertex:
+ case SH_VERTEX_SHADER:
symbolTable.insert(*new TVariable(NewPoolTString("gl_Position"), TType(EbtFloat, EbpHigh, EvqPosition, 4)));
symbolTable.insert(*new TVariable(NewPoolTString("gl_PointSize"), TType(EbtFloat, EbpMedium, EvqPointSize, 1)));
break;
@@ -590,10 +593,10 @@
symbolTable.relateToOperator("all", EOpAll);
// Map language-specific operators.
- switch(language) {
- case EShLangVertex:
+ switch(type) {
+ case SH_VERTEX_SHADER:
break;
- case EShLangFragment:
+ case SH_FRAGMENT_SHADER:
if (resources.OES_standard_derivatives) {
symbolTable.relateToOperator("dFdx", EOpDFdx);
symbolTable.relateToOperator("dFdy", EOpDFdy);
@@ -608,8 +611,8 @@
}
// Finally add resource-specific variables.
- switch(language) {
- case EShLangFragment: {
+ switch(type) {
+ case SH_FRAGMENT_SHADER: {
// Set up gl_FragData. The array size.
TType fragData(EbtFloat, EbpMedium, EvqFragColor, 4, false, true);
fragData.setArraySize(resources.MaxDrawBuffers);
@@ -620,7 +623,7 @@
}
}
-void InitExtensionBehavior(const TBuiltInResource& resources,
+void InitExtensionBehavior(const ShBuiltInResources& resources,
TExtensionBehavior& extBehavior)
{
if (resources.OES_standard_derivatives)