Finished off the GLSL compiler's support for parsing shaders using OES_EGL_image_external.
The GLSL to HLSL translator work is not done yet so the extension is disabled in Shader.cpp.
Review URL: https://codereview.appspot.com/5530081
git-svn-id: https://angleproject.googlecode.com/svn/trunk@946 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/OutputHLSL.cpp b/src/compiler/OutputHLSL.cpp
index b3a00d3..e10c81f 100644
--- a/src/compiler/OutputHLSL.cpp
+++ b/src/compiler/OutputHLSL.cpp
@@ -139,7 +139,7 @@
{
if (mReferencedUniforms.find(name.c_str()) != mReferencedUniforms.end())
{
- uniforms += "uniform " + typeString(type) + " " + decorateUniform(name, type.isArray()) + arrayString(type) + ";\n";
+ uniforms += "uniform " + typeString(type) + " " + decorateUniform(name, type) + arrayString(type) + ";\n";
}
}
else if (qualifier == EvqVaryingIn || qualifier == EvqInvariantVaryingIn)
@@ -303,7 +303,7 @@
{
if (mReferencedUniforms.find(name.c_str()) != mReferencedUniforms.end())
{
- uniforms += "uniform " + typeString(type) + " " + decorateUniform(name, type.isArray()) + arrayString(type) + ";\n";
+ uniforms += "uniform " + typeString(type) + " " + decorateUniform(name, type) + arrayString(type) + ";\n";
}
}
else if (qualifier == EvqAttribute)
@@ -759,7 +759,7 @@
if (qualifier == EvqUniform)
{
mReferencedUniforms.insert(name.c_str());
- out << decorateUniform(name, node->isArray());
+ out << decorateUniform(name, node->getType());
}
else if (qualifier == EvqAttribute)
{
@@ -2019,6 +2019,8 @@
return "sampler2D";
case EbtSamplerCube:
return "samplerCUBE";
+ case EbtSamplerExternalOES:
+ return "sampler2D";
}
}
@@ -2370,12 +2372,16 @@
return string;
}
-TString OutputHLSL::decorateUniform(const TString &string, bool array)
+TString OutputHLSL::decorateUniform(const TString &string, const TType &type)
{
- if (array)
+ if (type.isArray())
{
return "ar_" + string; // Allows identifying arrays of size 1
}
+ else if (type.getBasicType() == EbtSamplerExternalOES)
+ {
+ return "ex_" + string;
+ }
return decorate(string);
}