src/common/FixedVector.h


Log

Author Commit Date CI Message
Tom Sepez 2d28e33f 2025-08-28T23:50:51 Avoid some large copies in range-based for-loops Avoid copies as detected some time ago by a clang compiler plugin, typically this indicates a missing & in the range-based for-loop. -- For the vector initialize code, see https://godbolt.org/z/4PWseve5P as to why I think a copy-assign is more efficient than a copy- construct followed by a move-assign. Bug: b/415953694 Change-Id: I2cf9f713277d811127834235507ee075c4a72956 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6898417 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Auto-Submit: Tom Sepez <tsepez@chromium.org>
Shahbaz Youssefi e3087128 2024-06-19T17:44:52 Tighten FixedVector access asserts FixedVector has a size(), the out-of-bounds check is made tighter to make sure elements beyond size() (but still within the static array) are not accessed. Bug: angleproject:42267038 Change-Id: I46decb4262207bd7f1446e257e7196768345a4fe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5639342 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Igor Nazarov 1833a686 2023-09-20T16:21:21 Fix FixedVector bugs and unit tests Problems: - test was not testing assignment operators; - fixed compilation error in r-value assignment operator; - r-value constructor/assignment were not resetting size. Additionally updated FixedVector.Constructors to better test copy and assignment operations. Bug: angleproject:2435 Bug: angleproject:8127 Change-Id: Ic501b8d85af0280801c7abec8fb20a0ddf67580b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4874039 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Igor Nazarov 12b3d52d 2023-03-10T17:02:55 Prevent bugs in "FastVector" class. FastVector does not call destructors when resizing down and constructors when resizing up. This may cause reuse of previous values after resizing up and prevent releasing resource in destructors. Above problems only relevant for non trivially constructible/destructible types. For performance reasons (chromium:1417087) this CL disables using trivially destructible types at all and adds special resizing methods for non trivially constructible types. Almost all uses of FastVector was already using trivially destructible types. Except "angle::FixedVector" used in "rx::vk::SubpassVector<>". However, "angle::FixedVector" is unnecessarily calls "clear()" in the destructor. This CL removed "clear()" and made the destructor trivial. All non trivial constructor cases are limited to "angle::spirv::BoxedUint32<>" used in "angle::spirv::FastVectorHelper<>". No problems found because of the possibility to reuse previous values. All "resize(count)" methods replaced with special versions. Therefore, this CL does not fix actual bugs, but rather prevents incorrect use in the future. Bug: angleproject:8021 Bug: chromium:1417087 Change-Id: Id65d75575f2f582450b1cc45dc6b1f2bf3bc5289 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4328286 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>
Shahbaz Youssefi 912e52d8 2019-08-23T00:25:09 Vulkan: Storage image support Image bindings are placed after atomic counters in the "resources" descriptor set. There are two issues yet to be addressed: - GL can create a 2D (array) view of a 3D image, but this is not allowed in Vulkan. If this cannot be made possible, emulation needs to be done. https://github.com/KhronosGroup/Vulkan-Docs/issues/1033 - GL can create an image view of a texture with a different format and have the data reinterpreted. This is not currently done. Bug: angleproject:3563 Change-Id: I95c4d92c50bb033212a9a67f3f2d6f97c074c7bf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1767366 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Michael Spang cd946a03 2019-06-10T18:11:57 Vulkan: Fix out of bounds access of pWaitDstStageMask Since a6242e4d4 ("Vulkan: Support submitting multiple semaphores"), we can submit up to 2 semaphores at a time, but pWaitDstStageMask is still a single value. Change it to an array of two elements to prevent an out of bounds access. Bug: angleproject:3289 Change-Id: I5147802ce350af7b78dbf54cfa4a9519dd495f01 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1666347 Commit-Queue: Michael Spang <spang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 3a482179 2018-10-11T10:34:44 Vulkan: Implement glFlush A semaphore pool is implemented to allow dynamic allocation of semaphores as needed when breaking up a frame with flushes. The pool is used both for acquiring the next image and for chaining mid-frame submissions. RendererVk::flush() is changed so that instead of taking the wait/signal semaphores as parameters, it would use the last known signaled semaphore as wait semaphore and allocates a semaphore for signaling. It would additionally wait for any extra semaphore provided externally (i.e. the surface's image acquire semaphore). Bug: angleproject:2504 Change-Id: Iecd2d5535230c48b26a6b7d078710af8730121da Reviewed-on: https://chromium-review.googlesource.com/c/1276805 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 0ce016c1 2018-04-09T10:59:56 FixedVector: Add "full" method. Will be useful for an optimization to the Buffer Subject/Observer pattern. Also cleans up an ASSERT. Bug: angleproject:2389 Bug: chromium:829906 Change-Id: I2f8313ab531bca61947a51cc2396c04fb5d4bb1d Reviewed-on: https://chromium-review.googlesource.com/1002883 Reviewed-by: Luc Ferron <lucferron@chromium.org> Reviewed-by: Lingfeng Yang <lfy@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Lingfeng Yang 8957e832 2018-04-06T10:49:28 Add pop_back() / back() method for FixedVector Good for implementing stacks of fixed size (in the pop operation). + fix an issue where push_back() only allows adding up to max_size() - 1 elements. BUG=angleproject:2306 Change-Id: I99b3c8416055f069fa563b684c102fd6aec116bc Reviewed-on: https://chromium-review.googlesource.com/1000031 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Lingfeng Yang <lfy@google.com>
Geoff Lang 2231b4e0 2018-03-26T16:44:59 Add a FixedVector class to have "variable" size vectors on the stack. Wraps a std::array and a size parameter to give the std::vector interface without making allocations. BUG=angleproject:2435 Change-Id: I7df0be1310446a2f163766149bf631a8692be9ad Reviewed-on: https://chromium-review.googlesource.com/981267 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>