Implementing gl_InstanceID in the HLSL compiler.
Fixes:
dEQP-GLES3.functional.instanced.draw_arrays_instanced.instance_id
dEQP-GLES3.functional.instanced.draw_arrays_instanced.mixed
dEQP-GLES3.functional.instanced.draw_elements_instanced.instance_id
dEQP-GLES3.functional.instanced.draw_elements_instanced.mixed
BUG=angle:601
Change-Id: I6e120eebc90d00e025fc58f096064e6ed1da826b
Reviewed-on: https://chromium-review.googlesource.com/246911
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Gregoire Payen de La Garanderie <Gregory.Payen@imgtec.com>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index 065719b..44d348a 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -110,6 +110,7 @@
mUsesPointCoord = false;
mUsesFrontFacing = false;
mUsesPointSize = false;
+ mUsesInstanceID = false;
mUsesFragDepth = false;
mUsesXor = false;
mUsesDiscardRewriting = false;
@@ -498,6 +499,11 @@
out << "static float gl_PointSize = float(1);\n";
}
+ if (mUsesInstanceID)
+ {
+ out << "static int gl_InstanceID;";
+ }
+
out << "\n"
"// Varyings\n";
out << varyings;
@@ -1305,6 +1311,11 @@
mUsesPointSize = true;
out << name;
}
+ else if (qualifier == EvqInstanceID)
+ {
+ mUsesInstanceID = true;
+ out << name;
+ }
else if (name == "gl_FragDepthEXT")
{
mUsesFragDepth = true;