src/libANGLE/VertexArray_unittest.cpp


Log

Author Commit Date CI Message
Charlie Lao 9a05a2b7 2025-06-23T16:24:13 Reland "Vulkan: Avoid some loops in VertexArray::onBufferChanged" This reverts commit 5df85793c602d64d47ef68e29542313be4116bc0. Reason for revert: the regression bug is fixed Some of the functionality related code has been merged into previous CL. This CL now mostly clean up. The old subject/observer code is been deleted from VertexArray. Bug: angleproject:400711938 Original change's description: > Revert "Vulkan: Avoid some loops in VertexArray::onBufferChanged" > > This reverts commit 8d6d127acc1072488e5b57ba4e7e93da2d94bfda. > > Reason for revert: https://issues.chromium.org/427064102 > > Bug: angleproject:400711938 > Original change's description: > > Vulkan: Avoid some loops in VertexArray::onBufferChanged > > > > Before this CL, VertexArray::onBufferChanged() loops over > > bufferBindingMask bits and calls onSubjectStateChange. In this CL, > > VertexArray::onSubjectStateChange is embedded into > > VertexArray::onBufferChanged(). DIRTY_BIT_ELEMENT_ARRAY_BUFFER and > > DIRTY_BIT_ELEMENT_ARRAY_BUFFER_DATA is re-arranged so that we can map > > bufferBindingMask directly to VertexArray::mDirtyBits. This especially > > useful when one buffer is bound to multiple indices in the VertexArray. > > > > This CL also removes angle::ObserverInterface from VertexArray, since it > > no longer observes anything. > > > > ASSERT is added in gl::Buffer::mContentsObservers to ensure it only > > contains BufferTexture, since vertexArray is no longer using the > > subject/observer. > > > > Bug: angleproject:400711938 > > Change-Id: Ie6e7159d7a89f0da5e1b7ca0a9dbe60a1e6c682f > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6569638 > > Reviewed-by: Geoff Lang <geofflang@chromium.org> > > Commit-Queue: Charlie Lao <cclao@google.com> > > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > > Bug: angleproject:400711938 > Change-Id: I3b8e77db7b3d06b9ed875bfe7787904ac753da11 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6664161 > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Bug: angleproject:400711938 Change-Id: If7989b26701dcccbb8e49c42d388c0217e2d0b7f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6663536 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 5df85793 2025-06-23T11:08:49 Revert "Vulkan: Avoid some loops in VertexArray::onBufferChanged" This reverts commit 8d6d127acc1072488e5b57ba4e7e93da2d94bfda. Reason for revert: https://issues.chromium.org/427064102 Bug: angleproject:400711938 Original change's description: > Vulkan: Avoid some loops in VertexArray::onBufferChanged > > Before this CL, VertexArray::onBufferChanged() loops over > bufferBindingMask bits and calls onSubjectStateChange. In this CL, > VertexArray::onSubjectStateChange is embedded into > VertexArray::onBufferChanged(). DIRTY_BIT_ELEMENT_ARRAY_BUFFER and > DIRTY_BIT_ELEMENT_ARRAY_BUFFER_DATA is re-arranged so that we can map > bufferBindingMask directly to VertexArray::mDirtyBits. This especially > useful when one buffer is bound to multiple indices in the VertexArray. > > This CL also removes angle::ObserverInterface from VertexArray, since it > no longer observes anything. > > ASSERT is added in gl::Buffer::mContentsObservers to ensure it only > contains BufferTexture, since vertexArray is no longer using the > subject/observer. > > Bug: angleproject:400711938 > Change-Id: Ie6e7159d7a89f0da5e1b7ca0a9dbe60a1e6c682f > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6569638 > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:400711938 Change-Id: I3b8e77db7b3d06b9ed875bfe7787904ac753da11 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6664161 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Charlie Lao 8d6d127a 2025-05-20T12:26:56 Vulkan: Avoid some loops in VertexArray::onBufferChanged Before this CL, VertexArray::onBufferChanged() loops over bufferBindingMask bits and calls onSubjectStateChange. In this CL, VertexArray::onSubjectStateChange is embedded into VertexArray::onBufferChanged(). DIRTY_BIT_ELEMENT_ARRAY_BUFFER and DIRTY_BIT_ELEMENT_ARRAY_BUFFER_DATA is re-arranged so that we can map bufferBindingMask directly to VertexArray::mDirtyBits. This especially useful when one buffer is bound to multiple indices in the VertexArray. This CL also removes angle::ObserverInterface from VertexArray, since it no longer observes anything. ASSERT is added in gl::Buffer::mContentsObservers to ensure it only contains BufferTexture, since vertexArray is no longer using the subject/observer. Bug: angleproject:400711938 Change-Id: Ie6e7159d7a89f0da5e1b7ca0a9dbe60a1e6c682f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6569638 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 0561884e 2023-04-26T17:26:42 Vulkan: Dirty VertexArray binding bit if buffer storage change In crrev.com/c/3669603, we did optimization for black_desert_mobile that when vertex array is unbound, we remove vertex array from buffer's observer list to reduce overhead of observer notifications when buffer is been modified. To compensate for the lost notification, when vertex array is bound, we always assume every buffer that is bound to vertex array has been dirtied, for the simplicity at that time. This CL further the optimization of that CL. In this CL, I moved the dirty bit set into backend and improves vulkan backend by checking buffer's serial number and only dirty the binding if the serial has changed. Given this, now we can also remove all the non-current vertex array from buffer's observer list (previously it is heuristic based with a hard coded observer count limit). This and the previous CL improves asphalt_9 by ~1%. Bug: b/277644512 Change-Id: Ibc3f8e3df9fe70c6879e0b2bca86d8487a9dba73 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4481241 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Jamie Madill 0946393d 2018-04-04T05:26:59 Move Buffer Subject/Observer to front end. This makes BufferImpl into an Observer Subject. It also refactors the Vertex Array updates for the D3D11 backend use more of a dirty bit coding style. This change makes it so Buffer contents changes trigger front-end dirty bits from the back-end, which may be undesirable. Bug: angleproject:2389 Change-Id: Iac8ce1171284a86851c18cd1373ddf24fcefe40b Reviewed-on: https://chromium-review.googlesource.com/979812 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill e858cb1d 2018-03-27T09:44:32 Split VAO dirty bits to speed iteration. Using > 64 bits (we had over 90) would use a much slower dirty bit iteration. Speed this up by splitting the dirty bits into two levels. The first top level only has a single dirty bit per attrib, per binding, and one bit for the element array buffer. The next level has separate dirty bits for attribs and bindings. The D3D11 back-end doesn't actually care about individual dirty bits of attribs or bindings, since it resets entire attributes at a time, but the GL back-end only refreshes the necessary info. Improves the score of a simple state change microbenchmark by 15% on the D3D11 and GL back-ends with a no-op driver. Real-world impact will be smaller. Also includes a test suppression for an NVIDIA bug that surfaced when we changed the order of that GL commands were sent to the driver. BUG=angleproject:2389 Change-Id: If8d5e5eb0b27e2a77e20535e33626183d372d311 Reviewed-on: https://chromium-review.googlesource.com/556799 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shao dde78e8c 2017-05-22T14:13:27 ES31: Implement Vertex Attrib Binding on OpenGL This patch intends to implement Vertex Attrib Binding on OpenGL back-ends: 1. Add supports for updating vertex attributes by Vertex Attrib Binding APIs. 2. Refactor the process of updating vertex attribtues in class VertexArray to make it easier to implement this feature. BUG=angleproject:1593 TEST=dEQP-GLES31.functional.vertex_attribute_binding.* Change-Id: I800e61518c552b94b84c415895ad31668b0a84b2 Reviewed-on: https://chromium-review.googlesource.com/510251 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6de51858 2017-04-12T09:53:01 Optimize angle::BitSetIterator. Adds a new custom bitset template to handle packing as many bits as possible into a single variable. Intelligently select the right class depending on platform features and bit sizes. For now, always use a packed 64-bit set on 64-bit, instead of using a 32-bit set for smaller bitsets. BUG=angleproject:1814 Change-Id: I3ffef815c15515555833f6fc9302d8a4eee5423b Reviewed-on: https://chromium-review.googlesource.com/471827 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 20e005b2 2017-04-07T14:19:22 Rename BitSetIterator.h to bitset_utils.h BUG=angleproject:1814 Change-Id: I152ae13b6b7cf0ba72259967f0f124e199b20e07 Reviewed-on: https://chromium-review.googlesource.com/471826 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jiawei-Shao 2597fb64 2016-12-09T16:38:02 ES31: Refactor VertexArray for Vertex Attrib Binding OpenGL ES3.1 feature Vertex Attrib Binding requires vertex arrays should be split into two arrays: 1. an array of vertex buffer binding points, each of which specifies: - a bound buffer object, - a starting offset for vertex attribute data in that buffer object, - a stride used by all attributes using that binding point, - a frequency divisor used by all attributes using that binding point. 2. an array of generic vertex attribute format information records, each of which specifies: - a reference to one of the new buffer binding points above, - a component count and format, and a normalization flag for the attribute data, - the offset of the attribute data relative to the base offset of each vertex found at the associated binding point. Current ANGLE implementation simply uses a struct to represent a vertex attribute object, which does not meet the requirements above. This patch aims to be the the basis of the implementation of all ES3.1 Vertex Attrib Binding APIs by refactoring the struct VertexAttribute and the class VertexArray to fit the new data layout and ensuring all current functionality is retained. BUG=angleproject:1593 TEST=angle_unittests, angle_end2end_tests, gpu_unittests Change-Id: Ieb41f1bf503f815fd0476d2ea045dcb863465254 Reviewed-on: https://chromium-review.googlesource.com/418880 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>