Fix redundant index validation on the D3D9 backend
Make sure that the computed index range is added to the cache of the main
buffer object, instead of just to the static buffer object created for the
buffer object. This applies to the code path used for D3D9. This way the
front-end code in ValidateDrawElements gets the index range from the cache
instead of having to iterate over all the indices used on every draw call.
BUG=chromium:461274
TEST=WebGL conformance tests, angle_end2end_tests
Change-Id: I07cf493d2771dab8e76d69bafda7ac49e5a04808
Reviewed-on: https://chromium-review.googlesource.com/262180
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/libANGLE/renderer/d3d/IndexDataManager.cpp b/src/libANGLE/renderer/d3d/IndexDataManager.cpp
index ada3aec..f29a6f2 100644
--- a/src/libANGLE/renderer/d3d/IndexDataManager.cpp
+++ b/src/libANGLE/renderer/d3d/IndexDataManager.cpp
@@ -130,6 +130,10 @@
streamOffset = (offset / typeInfo.bytes) * gl::GetTypeInfo(destinationIndexType).bytes;
staticBuffer->getIndexRangeCache()->addRange(type, offset, count, translated->indexRange, streamOffset);
}
+ if (!buffer->getIndexRangeCache()->findRange(type, offset, count, nullptr, nullptr))
+ {
+ buffer->getIndexRangeCache()->addRange(type, offset, count, translated->indexRange, offset);
+ }
}
// Avoid D3D11's primitive restart index value