Implement GL_ANGLE_multi_draw
This patch adds entrypoints glMultiDrawArraysANGLE,
glMultiDrawElementsANGLE, glMultiDrawArraysInstancedANGLE,
annd glMultiDrawElementsInstancedANGLE
Bug: chromium:890539
Change-Id: Ic9c374c53892460f44ca6e73a253b78473ac2dff
Reviewed-on: https://chromium-review.googlesource.com/c/1282268
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp
index 4e7af6a..51dd917 100644
--- a/src/libANGLE/Program.cpp
+++ b/src/libANGLE/Program.cpp
@@ -802,6 +802,7 @@
mGeometryShaderOutputPrimitiveType(PrimitiveMode::TriangleStrip),
mGeometryShaderInvocations(1),
mGeometryShaderMaxVertices(0),
+ mDrawIDLocation(-1),
mActiveSamplerRefCounts{}
{
mComputeShaderLocalSize.fill(1);
@@ -1314,6 +1315,11 @@
setUniformValuesFromBindingQualifiers();
+ if (context->getExtensions().multiDraw)
+ {
+ mState.mDrawIDLocation = getUniformLocation("gl_DrawID");
+ }
+
// Save to the program cache.
auto *cache = linkingState->context->getMemoryProgramCache();
if (cache &&
@@ -1419,6 +1425,7 @@
mState.mGeometryShaderOutputPrimitiveType = PrimitiveMode::TriangleStrip;
mState.mGeometryShaderInvocations = 1;
mState.mGeometryShaderMaxVertices = 0;
+ mState.mDrawIDLocation = -1;
mValidated = false;
@@ -2682,6 +2689,19 @@
return mState.mLinkedTransformFeedbackVaryings[index];
}
+bool Program::hasDrawIDUniform() const
+{
+ ASSERT(mLinkResolved);
+ return mState.mDrawIDLocation >= 0;
+}
+
+void Program::setDrawIDUniform(GLint drawid)
+{
+ ASSERT(mLinkResolved);
+ ASSERT(mState.mDrawIDLocation >= 0);
+ mProgram->setUniform1iv(mState.mDrawIDLocation, 1, &drawid);
+}
+
bool Program::linkVaryings(InfoLog &infoLog) const
{
Shader *previousShader = nullptr;