src/common/FastVector.h


Log

Author Commit Date CI Message
Sungyong Choi c6390143 2022-10-12T09:57:55 Vulkan: Make compatible with GCC Resolves below warnings occurred with GCC build. 1) deperecated-copy Overriding an assignment operator without a copy constructor caused the deprecated-copy warnings. 2) unused-function 3) parenthesis Warnings occurred due to missing parenthesis around some logical expressions, add them to quiet the warnings. 4) unused variable 5) 'maybe-unused' attribute ignored Introduces 'ANGLE_MAYBE_UNUSED_PRIVATE_FIELD' macro to avoid 'attribute ignored' warning which is only occurred with GCC because GCC doesn't warn about 'unused non static data member' whereas Clang has Wno-unused-private-field. Signed-off-by: Sungyong Choi <sywow.choi@samsung.com> Bug: angleproject:7764 Change-Id: I8e7410a5ed8cb9b8f8b3202073d779fea63d6b75 Reviewed-by: Jeff Vigil <j.vigil@samsung.com> Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3963830 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Peng Huang afdd5106 2022-08-11T21:14:23 Use angle::FlatUnorderedMap in Display.cpp Bug: chromium:1336126 Change-Id: I57d97d37749de2abbba88b6558bde31fa8346764 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3828442 Commit-Queue: Peng Huang <penghuang@chromium.org> Auto-Submit: Peng Huang <penghuang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Peng Huang 61a17ba9 2022-08-11T11:23:10 Use angle::FlatUnorderedSet for ImageState::targets In mose cases, chrome only needs 1 or 2 targets for an EGLImage, so using angle::FlatUnorderedSet with 2 default size instead of the std::set for targets. Bug: chromium:1336126 Change-Id: Ieff3cfbd5d020fda3aaecb162ddb354def14d962 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3827681 Auto-Submit: Peng Huang <penghuang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Peng Huang 6491396c 2022-08-06T19:49:37 Use angle::FlatUnorderedMap as storage for AttributMap AttributeMap was using std::map which allocates storage from heap it is not ideal for small map like attribute map. So replace it with angle::FlatUnorderedMap with 2 default size (Chromium creates a lot of gl fence with 2 attributes on Android). Bug: chromium:1336126 Change-Id: I129fe603df2fd475ae1b0e35b63d4d0171bbae09 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3812565 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Peng Huang 6b248a68 2022-08-06T10:20:41 Use angle::FastVector in ImageEGL::initialize to avoid heap allocation Bug: chromium:1336126 Change-Id: I40349c618b648f3a96c19b2f2b032275af90086b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3812564 Auto-Submit: Peng Huang <penghuang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 1ce69722 2022-05-18T13:05:22 Vulkan: Track used command buffers in ResourceUse. The list of command buffers to ResourceUse will replace tracking resources in a CommandBufferHelper. Currently the two tracking methods live side-by-side, and the old method will be removed in a future CL. Bug: angleproject:5664 Change-Id: Ia04d77e72c508e10b549db8c8dd5f0472e4edc83 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3656069 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Mohan Maiya b267c009 2022-05-26T16:36:31 Add support for comparison operator in FlatUnorderedSet Overload operator== so FlatUnorderedSet objects can be used as values in a hashmap. Tests: FlatUnorderedSet.Comparison* Bug: angleproject:5033 Change-Id: Ica746adf87f7c603789593e726051e4562d6a931 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3671826 Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill c82513af 2022-04-14T05:04:11 Add FastMap class. We can use this class in a few cases where we can know that the integer key index won't exceed a fixed small boundary. Bug: angleproject:4524 Bug: angleproject:6776 Change-Id: Ic380e1ce8f4dc591504603ade376d9b1e8a3c1c4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3579865 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill c874943b 2022-02-18T15:29:14 Rename FastUnordered types to FlatUnordered. These names are consistent with the common parlance. Flat indicates the values are packed in memory, while fast indicates that lookup is as fast as possible. Bug: angleproject:6776 Change-Id: I7b56af26d7fdbf5956872be5033c3aa3f6b1b8c7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3484978 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Auto-Submit: Jamie Madill <jmadill@chromium.org>
Steven Noonan 9e8c929e 2021-10-20T17:19:02 FastVector: fix stack read overrun in ensure_capacity mSize should not be set until *after* calling ensure_capacity, otherwise we will read past the end of our statically allocated buffer when initializing the new array. This was caught by AddressSanitizer during one of the Vulkan BasicDraw tests, when compiling a shader to SPIR-V. Bug: angleproject:6600 Change-Id: I9ddb326d03ce5cda23973110e63d30b8829da2f6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3235901 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 7aba3bc5 2021-10-14T23:14:37 Vulkan: Use a CircularBuffer helper class in SurfaceVk There are two instances of circular buffer in SurfaceVk. A common helper class is introduced by this change to consolidate the implementation. This is in preparation for a follow up change that introduces yet another circular buffer in this class. Bug: angleproject:6401 Change-Id: Id01b585567310a2528888114239a5c80ff93f1ee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3225084 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi c072daec 2021-05-26T14:26:28 Add FastVector constructor with begin/end iterators Useful to construct a FastVector out of a subrange of another container. Bug: angleproject:4889 Change-Id: I0e62b601c7d171167343d526d198fa21ba52f0f9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2920191 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya c508e707 2021-02-25T15:40:11 Vulkan: Avoid using assign with BitSets FastIntegerSet::clear() now calls reset() instead of assign(). std::vector::assign(...) invokes the copy-constructor. For better performance, especially with BitSet*, we can leverage the reset() method. This removes 1.2% CPU overhead from a Manhattan30 offscreen run Bug: angleproject:5689 Change-Id: Ib1a760587ffe18341b8ed892a732c506fc50c82b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2723494 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 6689a54d 2021-01-21T00:36:14 Vulkan: autogen for SPIR-V instruction build and parse Handwritten SPIR-V instruction parse and build code is replaced with autogenerated functions based on the SPIR-V grammar. Bug: angleproject:4889 Change-Id: I09d724fd944e79c03fe4eadca3ee3e3ef0b49872 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2644721 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Tobin Ehlis d7276586 2020-08-26T11:27:13 Vulkan:Use roundUpPow2 where possible Utility function roundUpPow2 is more optimal than roundUp so use it. Bug: b/166462979 Change-Id: I616fa9f487b818137b1b496d93e292c3bd1f428c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2377119 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Tobin Ehlis <tobine@google.com>
Mohan Maiya f9a062c9 2020-08-16T14:09:41 Vulkan: Add FastIntegerSet and FastIntegerMap class Add FastIntegerSet container to enable fast contains operation for a set of integer keys. The class uses a BitSet vector to achieve performance. Add FastIntegerMap container to improve buffer serial tracking performance. FastIntegerMap uses FastIntegerSet container to track buffer serial keys. It also provides an ensureCapacity method to reserve space, for the expected buffer count, upfront. CommandBufferHelper::mUsedBuffers and ContextVk::descriptorSetCache are now FastIntegerMap CommandBufferHelper::mRenderPassUsedImages is now a FastIntegerSet Based on a CL by Jamie Bug: angleproject:4950 Test: angle_unittests.exe --gtest_filter=FastInteger* Change-Id: Ib58be20143f588baab99acadac796f2435f72d54 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2369466 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Jamie Madill 5b4f6e31 2020-08-15T23:03:34 Vulkan: Add overlay widget for RP buffer count. Can help evaluate when scenes stress out the resource tracking in the RenderPass command buffer. Bug: angleproject:4950 Bug: angleproject:4965 Change-Id: I7da2ad0101a840c5441f2112db4bb61f564afcef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2358521 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Jamie Madill d201ed8b 2020-08-02T16:29:35 Vulkan: Track used Images in RenderPass. Adding a simple ImageSerial tracking map in our RenderPass allows us to know when we do or do not need to close the RenderPass on a new Image access. This simple tracking scheme improves Manhattan performance by up to 25% on Android. The improved perf comes from reducing our RenderPass count (23->18 RenderPasses in our capture scene). Adds a FastUnorderedSet class to manage the used RP Image serials. Updates the Query helpers to explicitly flush the RP before inserting queries. Bug: angleproject:4911 Change-Id: I0c34fc8e307514ebdf3e81e08d8e5aedb70ebe8f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2334346 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 5e5b7537 2020-08-10T21:02:50 Vulkan: Optimize resource tracking in CommandBufferHelper. Introduces a FastUnorderedMap class that uses FastVector. This type uses static storage for up to a small fixed number of elements and uses dynamic storage for anything larger. Local testing shows this almost fully solves the regression from using unordered_map. It's still slightly slower than using no tracking (<5%). Very degenerate cases which track dozens or more buffers will still have significant overhead. For almost all applications that use only a few buffers per RenderPass this will be very fast. Test: angle_perftests, *vulkan_null_index_buffer_changed_ushort Bug: angleproject:4950 Bug: angleproject:4429 Change-Id: I39edeaaa159124167f1ea23ad2e6eac5e9220d0b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2348108 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 74d4bf98 2019-11-26T15:34:11 Remove !empty() assert on FastVector::data() The user of the API is allowed to call data() on an empty vector. Bug: 1026414 Change-Id: I41ea65c50b94115ace7930d75cd8f14782548d6c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1937807 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill cd0a0a3c 2018-10-18T18:41:57 Introduce SubjectBindingPointer. We can share the same pointer for the subject binding and the binding pointer. This further allows us to optimize buffer re-binding. The shared memory increases cache coherency and reduces the number of instructions needed. Bug: angleproject:2891 Change-Id: Id3162fa79de203f75989e7289ea02cb2ea1bec73 Reviewed-on: https://chromium-review.googlesource.com/c/1270217 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 20c01390 2018-09-19T15:43:28 Fix FastVector::resize when count < size. Also update a test to trigger the bug. Bug: angleproject:2763 Change-Id: I8e6735320a34dcc4cc8beee1b7a22b768912f24f Reviewed-on: https://chromium-review.googlesource.com/1234338 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill bf7cfbea 2018-09-19T03:56:20 Re-land "Add FastVector for simple dynamic vector cases." Re-land fixes memory leak and adds inline to a few more methods. This optimized vector keeps an initial fixed size storage but has unbounded growth like a normal std::vector. It operates like a FixedVector initially but then switches the storage to an allocated pool when the element count exceeds the array limit. This gives fast performance in the small case since no dynamic allocation is needed. It also handles the "slow" big case. Bug: angleproject:2763 Change-Id: Ib3cc7b652a14ed346528bf15820023ab0b5317ce Reviewed-on: https://chromium-review.googlesource.com/1233453 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Yuly Novikov dc8fb937 2018-09-19T01:35:59 Revert "Add FastVector for simple dynamic vector cases." This reverts commit 4d45e7dc7553b071b0c2a054bdb59bfd844012fe. Reason for revert: Memory leak detected during roll in https://ci.chromium.org/p/chromium/builders/luci.chromium.try/linux_chromium_asan_rel_ng/101750 Original change's description: > Add FastVector for simple dynamic vector cases. > > This optimized vector keeps an initial fixed size storage but has > unbounded growth like a normal std::vector. It operates like a > FixedVector initially but then switches the storage to an allocated > pool when the element count exceeds the array limit. > > This gives fast performance in the small case since no dynamic > allocation is needed. It also handles the "slow" big case. > > Bug: angleproject:2763 > Change-Id: I9c002b205bd4ac9fc171d1fdc42bc8ea5fe8dabe > Reviewed-on: https://chromium-review.googlesource.com/1227794 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Jamie Madill <jmadill@chromium.org> TBR=ynovikov@chromium.org,jmadill@chromium.org,syoussefi@chromium.org Change-Id: Iaec76244cc736a8469b80bfc8534fb0fd6c49e11 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:2763 Reviewed-on: https://chromium-review.googlesource.com/1232978 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill 4d45e7dc 2018-09-18T11:32:41 Add FastVector for simple dynamic vector cases. This optimized vector keeps an initial fixed size storage but has unbounded growth like a normal std::vector. It operates like a FixedVector initially but then switches the storage to an allocated pool when the element count exceeds the array limit. This gives fast performance in the small case since no dynamic allocation is needed. It also handles the "slow" big case. Bug: angleproject:2763 Change-Id: I9c002b205bd4ac9fc171d1fdc42bc8ea5fe8dabe Reviewed-on: https://chromium-review.googlesource.com/1227794 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>