Commit 38a24a94 by Geoff Lang Committed by Commit Bot

Fix incorrect indices being used when divisor is non-zero.

When streaming client data in the OpenGL backend, incorrect vertex data was uploaded. The 'first' parameter should be ignored when drawing with a non-zero divisor, even when doing non-instanced draw calls. BUG=angleproject:1894 Change-Id: If5a9ed4683f5c64eea1436eff28b2b2f86befcf4 Reviewed-on: https://chromium-review.googlesource.com/443067 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 294a5608
...@@ -319,6 +319,10 @@ gl::Error VertexArrayGL::streamAttributes(const gl::AttributesMask &activeAttrib ...@@ -319,6 +319,10 @@ gl::Error VertexArrayGL::streamAttributes(const gl::AttributesMask &activeAttrib
const size_t sourceStride = ComputeVertexAttributeStride(attrib); const size_t sourceStride = ComputeVertexAttributeStride(attrib);
const size_t destStride = ComputeVertexAttributeTypeSize(attrib); const size_t destStride = ComputeVertexAttributeTypeSize(attrib);
// Vertices do not apply the 'start' offset when the divisor is non-zero even when doing
// a non-instanced draw call
const size_t firstIndex = attrib.divisor == 0 ? indexRange.start : 0;
const uint8_t *inputPointer = reinterpret_cast<const uint8_t *>(attrib.pointer); const uint8_t *inputPointer = reinterpret_cast<const uint8_t *>(attrib.pointer);
// Pack the data when copying it, user could have supplied a very large stride that // Pack the data when copying it, user could have supplied a very large stride that
...@@ -326,8 +330,7 @@ gl::Error VertexArrayGL::streamAttributes(const gl::AttributesMask &activeAttrib ...@@ -326,8 +330,7 @@ gl::Error VertexArrayGL::streamAttributes(const gl::AttributesMask &activeAttrib
if (destStride == sourceStride) if (destStride == sourceStride)
{ {
// Can copy in one go, the data is packed // Can copy in one go, the data is packed
memcpy(bufferPointer + curBufferOffset, memcpy(bufferPointer + curBufferOffset, inputPointer + (sourceStride * firstIndex),
inputPointer + (sourceStride * indexRange.start),
destStride * streamedVertexCount); destStride * streamedVertexCount);
} }
else else
...@@ -336,14 +339,13 @@ gl::Error VertexArrayGL::streamAttributes(const gl::AttributesMask &activeAttrib ...@@ -336,14 +339,13 @@ gl::Error VertexArrayGL::streamAttributes(const gl::AttributesMask &activeAttrib
for (size_t vertexIdx = 0; vertexIdx < streamedVertexCount; vertexIdx++) for (size_t vertexIdx = 0; vertexIdx < streamedVertexCount; vertexIdx++)
{ {
uint8_t *out = bufferPointer + curBufferOffset + (destStride * vertexIdx); uint8_t *out = bufferPointer + curBufferOffset + (destStride * vertexIdx);
const uint8_t *in = const uint8_t *in = inputPointer + sourceStride * (vertexIdx + firstIndex);
inputPointer + sourceStride * (vertexIdx + indexRange.start);
memcpy(out, in, destStride); memcpy(out, in, destStride);
} }
} }
// Compute where the 0-index vertex would be. // Compute where the 0-index vertex would be.
const size_t vertexStartOffset = curBufferOffset - (indexRange.start * destStride); const size_t vertexStartOffset = curBufferOffset - (firstIndex * destStride);
if (attrib.pureInteger) if (attrib.pureInteger)
{ {
......
...@@ -249,7 +249,6 @@ ...@@ -249,7 +249,6 @@
// UBO tests trigger crashes when getting the program info log, skip them until this is fixed. // UBO tests trigger crashes when getting the program info log, skip them until this is fixed.
1323 LINUX : dEQP-GLES3.functional.ubo.* = SKIP 1323 LINUX : dEQP-GLES3.functional.ubo.* = SKIP
1323 LINUX : dEQP-GLES3.functional.draw.random.210 = FAIL
1323 LINUX : dEQP-GLES3.functional.fbo.blit.default_framebuffer.srgb8_alpha8 = FAIL 1323 LINUX : dEQP-GLES3.functional.fbo.blit.default_framebuffer.srgb8_alpha8 = FAIL
1323 LINUX : dEQP-GLES3.functional.fbo.blit.default_framebuffer.srgb8_alpha8_linear_out_of_bounds_blit_to_default = FAIL 1323 LINUX : dEQP-GLES3.functional.fbo.blit.default_framebuffer.srgb8_alpha8_linear_out_of_bounds_blit_to_default = FAIL
1323 LINUX : dEQP-GLES3.functional.fbo.blit.default_framebuffer.srgb8_alpha8_linear_scale_blit_to_default = FAIL 1323 LINUX : dEQP-GLES3.functional.fbo.blit.default_framebuffer.srgb8_alpha8_linear_scale_blit_to_default = FAIL
......
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