Commit 2c7ea058 by Gregoire Payen de La Garanderie Committed by Geoff Lang

Implement support for ES 3.0 instanced arrays

BUG=angle:863 Change-Id: I3918c478b33b26b2b179a7f8dd6e4210ecb0cf5c Reviewed-on: https://chromium-review.googlesource.com/239170Tested-by: 's avatarGregoire Payen de La Garanderie <Gregory.Payen@imgtec.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 32855688
...@@ -46,7 +46,9 @@ static int StreamingBufferElementCount(const gl::VertexAttribute &attrib, int ve ...@@ -46,7 +46,9 @@ static int StreamingBufferElementCount(const gl::VertexAttribute &attrib, int ve
// non-instanced vertices, and the instanced vertex index advances once every "mDivisor" instances. // non-instanced vertices, and the instanced vertex index advances once every "mDivisor" instances.
if (instanceDrawCount > 0 && attrib.divisor > 0) if (instanceDrawCount > 0 && attrib.divisor > 0)
{ {
return instanceDrawCount / attrib.divisor; // When instanceDrawCount is not a multiple attrib.divisor, the division must round up.
// For instance, with 5 non-instanced vertices and a divisor equal to 3, we need 2 instanced vertices.
return (instanceDrawCount + attrib.divisor - 1) / attrib.divisor;
} }
return vertexDrawCount; return vertexDrawCount;
......
...@@ -2265,8 +2265,17 @@ void GL_APIENTRY DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GL ...@@ -2265,8 +2265,17 @@ void GL_APIENTRY DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GL
return; return;
} }
// glDrawArraysInstanced if (!ValidateDrawArraysInstanced(context, mode, first, count, instanceCount))
UNIMPLEMENTED(); {
return;
}
Error error = context->drawArrays(mode, first, count, instanceCount);
if (error.isError())
{
context->recordError(error);
return;
}
} }
} }
...@@ -2284,8 +2293,18 @@ void GL_APIENTRY DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, ...@@ -2284,8 +2293,18 @@ void GL_APIENTRY DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type,
return; return;
} }
// glDrawElementsInstanced rx::RangeUI indexRange;
UNIMPLEMENTED(); if (!ValidateDrawElementsInstanced(context, mode, count, type, indices, instanceCount, &indexRange))
{
return;
}
Error error = context->drawElements(mode, count, type, indices, instanceCount, indexRange);
if (error.isError())
{
context->recordError(error);
return;
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment