Commit 9f6907bf by Shannon Woods

Fix application of vertex divisor for non-instanced draws in D3D9

BUG=398337 ANGLE_instanced_arrays defines the behavior of the non-instanced draw calls (glDrawArrays, glDrawElements) such that they behave as single-instance draws, so the vertex divisor should still apply. We were handling this correctly in D3D11, but not D3D9. This fixes a new WebGL conformance test: https://www.khronos.org/registry/webgl/sdk/tests/conformance/extensions/angle-instanced-arrays.html Change-Id: Ib50e189d866d6dc97612e46460db4ca1723b3662 Reviewed-on: https://chromium-review.googlesource.com/211445Tested-by: 's avatarShannon Woods <shannonwoods@chromium.org> Reviewed-by: 's avatarKenneth Russell <kbr@chromium.org> Reviewed-by: 's avatarBrandon Jones <bajones@chromium.org>
parent baa34bea
...@@ -48,6 +48,20 @@ GLenum VertexDeclarationCache::applyDeclaration(IDirect3DDevice9 *device, Transl ...@@ -48,6 +48,20 @@ GLenum VertexDeclarationCache::applyDeclaration(IDirect3DDevice9 *device, Transl
int indexedAttribute = gl::MAX_VERTEX_ATTRIBS; int indexedAttribute = gl::MAX_VERTEX_ATTRIBS;
int instancedAttribute = gl::MAX_VERTEX_ATTRIBS; int instancedAttribute = gl::MAX_VERTEX_ATTRIBS;
if (instances == 0)
{
for (int i = 0; i < gl::MAX_VERTEX_ATTRIBS; ++i)
{
if (attributes[i].divisor != 0)
{
// If a divisor is set, it still applies even if an instanced draw was not used, so treat
// as a single-instance draw.
instances = 1;
break;
}
}
}
if (instances > 0) if (instances > 0)
{ {
// Find an indexed attribute to be mapped to D3D stream 0 // Find an indexed attribute to be mapped to D3D stream 0
......
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