Re-re-land "D3D11: Implement dirty bits for VertexArray11.""
Translated attributes are now stored in the VertexArray11 in a cache,
and only updated when dirty bits change. Currently dynamic attributes
must be re-translated every call, so these are stored in a list and
processed repeatedly.
This skips doing a lot of the VertexDataManager work for vertex
attributes that don't change between draw calls.
Current value attributes, which correspond to disabled attributes that
the program will pulls vertex data from, are owned by the Context, so
these need to be handled outside of the VertexArray11.
Further changes will be necessary to reduce the redundant work we do in
the InputLayoutCache. We shouldn't need to re-check the cache if
nothing relevant changed.
This give about a 23% performance improvement on the draw call
benchmark on my machine.
Re-land with a fix for the start vertex offset.
Re-re-land with a fix for using XFB with deleted buffers.
BUG=angleproject:1327
Change-Id: I0fba49515375c149bbf54d933f8d1f747fbb8158
Reviewed-on: https://chromium-review.googlesource.com/338003
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/tests/gl_tests/BufferDataTest.cpp b/src/tests/gl_tests/BufferDataTest.cpp
index 6e23ecc..6235ef6 100644
--- a/src/tests/gl_tests/BufferDataTest.cpp
+++ b/src/tests/gl_tests/BufferDataTest.cpp
@@ -207,6 +207,31 @@
delete[] data;
}
+// Internally in D3D, we promote dynamic data to static after many draw loops. This code tests
+// path.
+TEST_P(BufferDataTest, RepeatedDrawWithDynamic)
+{
+ std::vector<GLfloat> data;
+ for (int i = 0; i < 16; ++i)
+ {
+ data.push_back(static_cast<GLfloat>(i));
+ }
+
+ glUseProgram(mProgram);
+ glBindBuffer(GL_ARRAY_BUFFER, mBuffer);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * data.size(), data.data(), GL_DYNAMIC_DRAW);
+ glVertexAttribPointer(mAttribLocation, 1, GL_FLOAT, GL_FALSE, 0, nullptr);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ glEnableVertexAttribArray(mAttribLocation);
+
+ for (int drawCount = 0; drawCount < 40; ++drawCount)
+ {
+ drawQuad(mProgram, "position", 0.5f);
+ }
+
+ EXPECT_GL_NO_ERROR();
+}
+
class IndexedBufferCopyTest : public ANGLETest
{
protected: