Compiler - implement proper varying linking
TRAC #11716
Signed-off-by: Shannon Woods
Signed-off-by: Daniel Koch
Author: Nicolas Capens
git-svn-id: https://angleproject.googlecode.com/svn/trunk@97 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/OutputHLSL.cpp b/src/compiler/OutputHLSL.cpp
index 785e18d..4a8ad7f 100644
--- a/src/compiler/OutputHLSL.cpp
+++ b/src/compiler/OutputHLSL.cpp
@@ -50,6 +50,7 @@
sprintf(semantic, " : TEXCOORD%d", semanticIndex);
semanticIndex += type.isArray() ? type.getArraySize() : 1;
+ // Program linking depends on this exact format
varyingInput += " " + typeString(type) + " " + name + arrayString(type) + semantic + ";\n";
varyingGlobals += "static " + typeString(type) + " " + name + arrayString(type) + " = " + initializer(type) + ";\n";
}
@@ -74,7 +75,7 @@
"struct PS_INPUT\n" // FIXME: Prevent name clashes
"{\n";
out << varyingInput;
- out << " float4 gl_FragCoord : TEXCOORD" << HLSL_FRAG_COORD_SEMANTIC << ";\n";
+ out << " float4 gl_FragCoord : TEXCOORD" << semanticIndex << ";\n";
out << " float __vFace : VFACE;\n"
"};\n"
"\n";
@@ -147,6 +148,7 @@
}
else if (qualifier == EvqVaryingOut || qualifier == EvqInvariantVaryingOut)
{
+ // Program linking depends on this exact format
varyingOutput += " " + typeString(type) + " " + name + arrayString(type) + " : TEXCOORD0;\n"; // Actual semantic index assigned during link
varyingGlobals += "static " + typeString(type) + " " + name + arrayString(type) + " = " + initializer(type) + ";\n";
}
@@ -177,7 +179,7 @@
"{\n"
" float4 gl_Position : POSITION;\n"
" float gl_PointSize : PSIZE;\n"
- " float4 gl_FragCoord : TEXCOORD" << HLSL_FRAG_COORD_SEMANTIC << ";\n";
+ " float4 gl_FragCoord : TEXCOORD0;\n"; // Actual semantic index assigned during link
out << varyingOutput;
out << "};\n"
"\n"
@@ -501,6 +503,7 @@
if (qualifier == EvqVaryingOut || qualifier == EvqInvariantVaryingOut)
{
+ // Program linking depends on this exact format
out << " output." + name + " = " + name + ";\n"; // FIXME: Prevent name clashes
}
}
diff --git a/src/compiler/OutputHLSL.h b/src/compiler/OutputHLSL.h
index 667d9e8..2be9a86 100644
--- a/src/compiler/OutputHLSL.h
+++ b/src/compiler/OutputHLSL.h
@@ -12,11 +12,6 @@
namespace sh
{
-enum
-{
- HLSL_FRAG_COORD_SEMANTIC = 15 // Semantic index assigned to the gl_FragCoord varying
-};
-
class OutputHLSL : public TIntermTraverser
{
public: