Commit a0537333 by Jamie Madill

D3D: Fix incorrect instanced vertex offsets.

The spec says that DrawElements is equivalent to the instanced call with an instance ID of zero. This patch fixes a bug in our VertexDataManager where we would sometimes ignore the attribute divisor for DrawElements, and stream the wrong amount of data/wrong start offset. BUG=angleproject:1213 TEST=dEQP-GLES3.functional.draw.draw_elements.* TEST=dEQP-GLES3.functional.draw.draw_range_elements.* TEST=dEQP-GLES3.functional.draw.random.* Change-Id: I1c430a14ab3be68a24e233e9cdd1e4fd88c920a0 Reviewed-on: https://chromium-review.googlesource.com/312062 Tryjob-Request: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent e1a94c67
...@@ -290,7 +290,7 @@ gl::Error VertexDataManager::storeAttribute(TranslatedAttribute *translated, ...@@ -290,7 +290,7 @@ gl::Error VertexDataManager::storeAttribute(TranslatedAttribute *translated,
bool directStorage = vertexBuffer->directStoragePossible(attrib, translated->currentValueType); bool directStorage = vertexBuffer->directStoragePossible(attrib, translated->currentValueType);
// Instanced vertices do not apply the 'start' offset // Instanced vertices do not apply the 'start' offset
GLint firstVertexIndex = (instances > 0 && attrib.divisor > 0 ? 0 : start); GLint firstVertexIndex = (attrib.divisor > 0 ? 0 : start);
translated->vertexBuffer = vertexBuffer->getVertexBuffer(); translated->vertexBuffer = vertexBuffer->getVertexBuffer();
...@@ -357,7 +357,8 @@ gl::Error VertexDataManager::storeAttribute(TranslatedAttribute *translated, ...@@ -357,7 +357,8 @@ gl::Error VertexDataManager::storeAttribute(TranslatedAttribute *translated,
(static_cast<unsigned int>(attrib.offset) / (static_cast<unsigned int>(attrib.offset) /
static_cast<unsigned int>(ComputeVertexAttributeStride(attrib))) * static_cast<unsigned int>(ComputeVertexAttributeStride(attrib))) *
outputElementSize; outputElementSize;
unsigned int startOffset = (instances == 0 || attrib.divisor == 0) ? firstVertexIndex * outputElementSize : 0; ASSERT(attrib.divisor == 0 || firstVertexIndex == 0);
unsigned int startOffset = firstVertexIndex * outputElementSize;
if (streamOffset + firstElementOffset + startOffset < streamOffset) if (streamOffset + firstElementOffset + startOffset < streamOffset)
{ {
return gl::Error(GL_OUT_OF_MEMORY); return gl::Error(GL_OUT_OF_MEMORY);
......
...@@ -1051,23 +1051,8 @@ ...@@ -1051,23 +1051,8 @@
1101 WIN : dEQP-GLES3.functional.state_query.internal_format.rgb_samples = FAIL 1101 WIN : dEQP-GLES3.functional.state_query.internal_format.rgb_samples = FAIL
1101 WIN : dEQP-GLES3.functional.polygon_offset.fixed16_render_with_units = FAIL 1101 WIN : dEQP-GLES3.functional.polygon_offset.fixed16_render_with_units = FAIL
1101 WIN : dEQP-GLES3.functional.polygon_offset.fixed24_render_with_units = FAIL 1101 WIN : dEQP-GLES3.functional.polygon_offset.fixed24_render_with_units = FAIL
1101 WIN : dEQP-GLES3.functional.draw.draw_elements.points.instanced_attributes = FAIL
1101 WIN : dEQP-GLES3.functional.draw.draw_elements.triangle_strip.instanced_attributes = FAIL
1101 WIN : dEQP-GLES3.functional.draw.draw_elements.lines.instanced_attributes = FAIL
1101 WIN : dEQP-GLES3.functional.draw.draw_elements.line_strip.instanced_attributes = FAIL
1101 WIN : dEQP-GLES3.functional.draw.draw_elements.line_loop.instanced_attributes = FAIL
1101 WIN : dEQP-GLES3.functional.draw.draw_arrays_instanced.line_loop.instanced_attributes = FAIL 1101 WIN : dEQP-GLES3.functional.draw.draw_arrays_instanced.line_loop.instanced_attributes = FAIL
1101 WIN : dEQP-GLES3.functional.draw.draw_elements_instanced.line_loop.instanced_attributes = FAIL 1101 WIN : dEQP-GLES3.functional.draw.draw_elements_instanced.line_loop.instanced_attributes = FAIL
1101 WIN : dEQP-GLES3.functional.draw.draw_range_elements.points.instanced_attributes = FAIL
1101 WIN : dEQP-GLES3.functional.draw.draw_range_elements.triangles.instanced_attributes = FAIL
1101 WIN : dEQP-GLES3.functional.draw.draw_range_elements.triangle_fan.instanced_attributes = FAIL
1101 WIN : dEQP-GLES3.functional.draw.draw_range_elements.triangle_strip.instanced_attributes = FAIL
1101 WIN : dEQP-GLES3.functional.draw.draw_range_elements.lines.instanced_attributes = FAIL
1101 WIN : dEQP-GLES3.functional.draw.draw_range_elements.line_strip.instanced_attributes = FAIL
1101 WIN : dEQP-GLES3.functional.draw.draw_range_elements.line_loop.instanced_attributes = FAIL
1101 WIN : dEQP-GLES3.functional.draw.random.50 = FAIL
1101 WIN : dEQP-GLES3.functional.draw.random.186 = FAIL
1101 WIN : dEQP-GLES3.functional.draw.random.210 = FAIL
1101 WIN : dEQP-GLES3.functional.flush_finish.flush = FAIL 1101 WIN : dEQP-GLES3.functional.flush_finish.flush = FAIL
1101 WIN : dEQP-GLES3.functional.lifetime.gen.transform_feedback = FAIL 1101 WIN : dEQP-GLES3.functional.lifetime.gen.transform_feedback = FAIL
1101 WIN : dEQP-GLES3.functional.lifetime.gen.vertex_array = FAIL 1101 WIN : dEQP-GLES3.functional.lifetime.gen.vertex_array = 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