D3D11: map index buffers only when needed.
Before this patch, index buffers where always mapped in case we needed the
index data for the indexed point sprites workaround.
This patch makes it so the index buffer is only mapped in this case, when
we need to stream index data or when we need to fill the static copies of
the index buffers.
This make the memory usage of
http://alteredqualia.com/xg/examples/mammoth.html go down from 41MB to
28MB.
BUG=angleproject:516
Change-Id: I937506d06fd6f074ef2120469dbd235e20245fca
Reviewed-on: https://chromium-review.googlesource.com/283626
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/tests/gl_tests/D3D11EmulatedIndexedBufferTest.cpp b/src/tests/gl_tests/D3D11EmulatedIndexedBufferTest.cpp
index fe40f38..5f0c5f2 100644
--- a/src/tests/gl_tests/D3D11EmulatedIndexedBufferTest.cpp
+++ b/src/tests/gl_tests/D3D11EmulatedIndexedBufferTest.cpp
@@ -125,7 +125,7 @@
// into a valid emulated indexed buffer.
TEST_P(D3D11EmulatedIndexedBufferTest, TestNativeToExpandedUsingGLubyteIndices)
{
- rx::SourceIndexData srcData = {mubyteIndices.data(), mubyteIndices.size(), GL_UNSIGNED_BYTE, false};
+ rx::SourceIndexData srcData = {nullptr, mubyteIndices.data(), mubyteIndices.size(), GL_UNSIGNED_BYTE, false};
emulateAndCompare(&srcData);
}
@@ -133,7 +133,7 @@
// into a valid emulated indexed buffer.
TEST_P(D3D11EmulatedIndexedBufferTest, TestNativeToExpandedUsingGLushortIndices)
{
- rx::SourceIndexData srcData = {mushortIndices.data(), mushortIndices.size(), GL_UNSIGNED_SHORT, false};
+ rx::SourceIndexData srcData = {nullptr, mushortIndices.data(), mushortIndices.size(), GL_UNSIGNED_SHORT, false };
emulateAndCompare(&srcData);
}
@@ -141,7 +141,7 @@
// into a valid emulated indexed buffer.
TEST_P(D3D11EmulatedIndexedBufferTest, TestNativeToExpandedUsingGLuintIndices)
{
- rx::SourceIndexData srcData = {muintIndices.data(), muintIndices.size(), GL_UNSIGNED_INT, false};
+ rx::SourceIndexData srcData = {nullptr, muintIndices.data(), muintIndices.size(), GL_UNSIGNED_INT, false };
emulateAndCompare(&srcData);
}
@@ -153,7 +153,7 @@
cleanSourceBuffer->copySubData(mSourceBuffer, 0, 0, mSourceBuffer->getSize());
// Do a basic exanded and compare test.
- rx::SourceIndexData srcData = {muintIndices.data(), muintIndices.size(), GL_UNSIGNED_INT, false};
+ rx::SourceIndexData srcData = {nullptr, muintIndices.data(), muintIndices.size(), GL_UNSIGNED_INT, false };
emulateAndCompare(&srcData);
const uint8_t *sourceBufferMem = nullptr;