src/common/bitset_utils.h


Log

Author Commit Date CI Message
Charlie Lao 352900dd 2025-09-08T11:54:22 Fix BitSetArray::bits for 32 bit Which was causing compilation issue on some platforms. Bug: b/439073246 Change-Id: I6863f28af3fa5364b7739f2ff61520c9e775752d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6925089 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 8bae2565 2025-08-22T14:38:23 Vulkan: Improve VertexArrayVk::syncState VertexArrayVk::syncState often time shows up the biggest single API in simpleperf. For example, in tower_of_fantasy it is 7.9% of all CPU time in libANGLE. This function also uses macros which made it hard to debug. This CL removes the usage of macros which makes code much easier to handle. The other real problem is that we are repeatedly calling syncDirtyAttrib() function for disabled attributes. This CL breaks the dirty bits into bindingDirtyBits and bufferDataDiryBits and attribDirtyBits. Only attribDirtyBits will end up doing the actual state sync. All other dirty bits will just turn them into attribDirtyBits. Also disabled attributes will be looped separately. This simplification makes it impossible to have duplicate state syncs since we only call sync*Attrib at the end of function. By splitting syncDirtyAttrib into syncDirtyEnabledAttrib/syncDirtyDIsabledAttrib/syncNeedsConversionAttrib, we also moved the if check from syncDirtyAttrib (which is called within for loop) to syncState. With this CL, simpleperf shows this function has reduced from 7.9% to 5.9%. Bug: b/439073246 Change-Id: I99b5ff0b34a5992e31541d2e9cd81ff5c9dda716 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6876527 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Sungyong Choi da5a5628 2025-08-11T10:53:06 bitset_utils: Fix GCC shift-count-overflow warning GCC triggers a -Werror=shift-count-overflow when kDefaultBitSetSize is 64, due to the constructor compiling a branch with `value >>= 64`. Although this path is never executed at runtime, GCC still inspects the code and emits the warning as an error. Refactored the constructor to: - Move common reset() into a single place - Split initialization into initFromValue<S>() overloads enabled only for S < 64 or S >= 64 via std::enable_if_t - Avoid generating any shift code when S >= 64 This change ensures GCC does not instantiate invalid shift operations and keeps the initialization logic cleaner. BUG: angleproject:438226513 Change-Id: I1ed0b42540f1bfce469d5738757045bc6d92ac61 Signed-off-by: Sungyong Choi <sywow.choi@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6845475 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Charlie Lao 2269011c 2025-06-30T14:08:11 Remove BitSet::to_ulong and BitSetArray::to_ulong BitSet::to_ulong() is a bit redundant with bits(), and has a risk of losing upper bits on windows platform where unsigned long is 32 bit. This CL removes the usage of it and replaced with bits(). BitSetArray::to_ulong() method only captures up to 64 bits, all other bits are dropped silently which is wrong. This CL fix this and serialize it as a vector of uint64_t. BitSetArray::to_ulong() is removed in this CL. Bug: angleproject:42264163 Change-Id: I663b2cdacc0e930ee616e333131e831ec124a9d4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6691283 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi d193d51b 2024-06-17T22:46:08 Replace issue ids post migration to new issue tracker This change replaces anglebug.com/NNNN links. Bug: None Change-Id: I8ac3aec8d2a8a844b3d7b99fc0a6b2be8da31761 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5637912 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev 74af31ad 2024-02-28T00:00:00 GL: Add ClearsWithGapsNeedFlush workaround Enabled on older Adreno drivers to avoid clear/draw race conditions in certain cases. Fixed: angleproject:8374 Change-Id: Ifc30f66ece562027ae4dd7672fcb121f91ec4696 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5335662 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Charlie Lao b8d5a423 2023-08-21T14:43:42 Add static_assert(std::is_trivially_copyable<LinkedUniform>(),"") Since we are using memcpy for LinkedUniform, it is desirable to utilize compile time assertion to ensure that in future if anyone modifies POD struct (and the class of data members of POD struct) and made it that no longer memcopy-able, we would immediately caught at compile time. std::is_trivially_copyable<>is exactly for this reason. In order to make this work, the POD struct and any data it uses can not have user defined copy constructor. The problem is that right now ANGLE is using clang_use_chrome_plugins=true, and chrome-style generates warnings if the complex struct (has more than 10 data members) does not define a copy constructor, and that warning causes build failure with -Werror. So clang_use_chrome_plugins=true and std::is_trivially_copyable have this conflicting requirements that I can not apply both. This has been raised to compiler team, but before we get a solution from them, if we have to make a choice, I think the better choice is to disable clang_use_chrome_plugins and apply std::is_trivially_copyable, since the later is more critical to ensure safety, while chrome-style is mostly trying to minimize the code size, but won't affect correctness/robustness. This CL sets clang_use_chrome_plugins to false, and removes the copy constructor and copy assignment operator from BitSetT and LinkedUniform and added static assertion is_trivially_copyable for LinkedUniform. Same thing applied to ProgramInput as well. In future once we have a better solution from compile team, we can re-enable clang_use_chrome_plugins and disable only for structs that requires is_trivially_copyable assertion. Bug: b/275102061 Change-Id: If33415ea61deda568d855a7dd6a4fd6042058be5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4799342 Reviewed-by: Roman Lavrov <romanl@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 76fa3806 2023-05-04T10:19:35 Vulkan: Expand BufferOnly path for VertexArray binding change VertexArrayVk has a fast code path for attribute change where the only change is buffer (i.e, no format or relativeOffset change). It will pass in bufferOnly to syncDirtyAttrib() call and will avoid invalidate graphics pipeline. This CL expands DIRTY_BIT_BINDING_n change and will also try to detect the bufferOnly case. This CL and crrev.com/c/4507978 together seeing Gfxbench driver overhead score improves 1.48% (from average 6804 before CLs to 6905 after CLs) on pixel 7 pro. Bug: b/277644512 Change-Id: I71da1b886bb26ba2629b83af3aeaba4d45c3d3c2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4504919 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Auto-Submit: Charlie Lao <cclao@google.com>
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>
Shahbaz Youssefi 68b47e58 2022-11-16T10:46:59 Vulkan: Initial support for VK_EXT_graphics_pipeline_library When available, this change uses VK_EXT_graphics_pipeline_library to create pipelines. Currently, it is only used when graphicsPipelineLibraryFastLinking is available. This restricts the use of this extension to devices where monolithic pipelines are not any more performant than linked libraries. A future change adds support for other implementations by providing async pipeline creation. Bug: angleproject:7369 Change-Id: I1e3b7ac4aa56e75c7d6f4d0d5ea91cb0b862e581 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4031489 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Steven Noonan <steven@valvesoftware.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 7fb1a25d 2022-11-16T11:40:55 Make BitSetT::Mask return a bit set This allows a Mask function to be implemented for BitSetArray, which is added in this CL. When using larger bitsets on 32-bit systems, the current Mask implementation prohibits its use. This is in preparation for a follow up change that uses Mask on such a bitset. Bug: angleproject:7369 Change-Id: If995d96ec1583a546f20bff277f3223e2f2490f5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4031493 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 135022e4 2022-10-11T00:03:11 Vulkan: Create robust pipelines based on context state Previously, pipelines were made robust based on whether any context in the share group has so far been made robust. This means that pipelines created on non-robust contexts would still be compiled as robust. Inefficiency aside, this was buggy because robustness was not part of the pipeline cache key, so if a pipeline was created as non-robust first, then recreated in a robust context, it would reuse the non-robust variant. With VK_EXT_pipeline_protected_access, a similar situation arises for context protected-ness. However, it is incorrect in that case to create pipelines as protected unnecessarily. This change makes pipeline robustness a part of the pipeline cache key, in preparation for protectedness to be added similarly. Compute programs may now generate multiple pipelines as a result too. Bug: angleproject:7629 Change-Id: Ie95f10eff878f8c8b221c1018da44385c7aad15e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3943534 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 20820bb4 2022-05-13T10:50:47 Make BitSetArray constexpr Bug: angleproject:5906 Change-Id: If1ccacfc81e3e01b4bdbd10d47cf4ec860e3fe0b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3645494 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 171bc07e 2021-12-20T13:10:33 Don't silently drop out-of-range bits in BitSetT Notes: - std::bitset's constructor accepts out-of-range bits (and drops them) - std::bitset with initializer list doesn't exist and is a BitSetT feature - |=, &= and ^= with non-bitset is a BitSetT feature - std::bitset's set(pos), reset(pos) and flip(pos) throw an exception if pos is out of the range of the bitset. This change adds an ASSERT in the functions that std::bitset would throw an exception, as well as functions that are only in BitSetT. Bug: angleproject:6840 Change-Id: Iab5bac40b05d4f7f29e0242ea0baa093721e3339 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3349980 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 00d0b79f 2021-11-26T14:38:20 Bug fix in BitSetArray iterator Account for gaps spanning multiple BaseBitSet while iterating. Bug: angleproject:3877 Tests: BitSetArrayTest*IterationWithGaps* Change-Id: I64a0393bf117678b0a7855904a6ac328a13bb40c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3304108 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 49ac15a5 2021-09-20T11:29:01 Optimize VAO bindings. This CL makes the XFB binding tracking WebGL-only. That will speed up VAO binding changes in non-WebGL considerably. Also has a few inline micro-optimizations that may not have a large effect. Bug: angleproject:6371 Change-Id: Ib0a26a3b956dcd6ff78626e5cd6514b46270d882 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3170116 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 971ba359 2021-06-23T16:45:33 Add angle::BitMask for creating bit masks angle::BitMask(n) implements the common pattern of angle::Bit(n)-1. Bug: angleproject:6048 Change-Id: Icd56ef1504804add59d0804a7249b3035c96f9c2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2984099 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill cfc21345 2021-04-21T09:42:51 Add first() and last() to BitSetArray. These helper functions return the bounds of the 1 bits in the array. Also required implementing ScanReverse the same way we implemented ScanForward. Bug: angleproject:5736 Change-Id: Ied945c57cd85ca7bc91dcc7a1168a74b3a59fce4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2842347 Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 0c77f3ad 2021-03-10T15:58:00 Vulkan: Implement shader buffers descriptor cache. Implements a descriptor set cache for UBOs, SSBOs, and atomic counter buffers. Storage Images and framebuffer fetch input attachments are not yet included. Requires moving the buffer barrier handling into ContextVk, similarly to how we handle the barriers for Textures. The packed description key for the descriptors uses a "fast" vector with a basic minimum size. For most cases of a few buffers this will fit easily in stack memory, but for larger programs with many buffers we fit this into heap memory. The key has a large upper bound due to the high ES 3.2 requirements and the need to index several values such as the offset and binding size. We use dynamic offsets for uniform buffers when possible. This ensures applications like Manhattan 3.1 that use sets of common buffers with changing offsets hit the cache most of the time. Because of resource limits we pick at compilation time whether to use dynamic or static descriptor sets. Mostly this applies to tests that use a large number of uniform buffers. A future implementation could be smart and would recompile the program with heuristics to use a minimal number of dynamic indices. Reduces the number of descriptor set updates from ~300 -> ~30 per frame in Manhattan 3.1 and in Asphalt 9 from 900+ to as low as 0 per frame. Bug: angleproject:5736 Change-Id: I5c2a3881bec90d301dab15cc86c8a70e60674ad7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2757515 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi e8c0aa81 2021-01-26T23:40:36 Vulkan: Clean up transform feedback extension pause/resume 1. The xfb counter buffer barrier issued was wrong, following a typo in the spec. This barrier is now correctly issued using the usual barrier APIs. 2. A mechanism was added to automatically pause/resume transform feedback when a program pipeline needs to be rebound. This is incorrect as it misses the xfb counter buffer barrier. The render pass is broken instead if transform feedback is active/unpaused and the program pipeline is changed. 3. The transform feedback counter buffers are now disposed of when transform feedback is ended. This avoids an unnecessary barrier that this change would have otherwise incurred (and hence render pass break) in Manhattan which repurposes the same transform feedback object. Bug: angleproject:5528 Change-Id: I1ffe8b4b8975645ba43afd70e9cdbb0765529da5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2651647 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 3500b434 2021-02-13T09:14:08 Update assert in BitSetArray::Iterator::prepareCopy Prior to a mutation of the bitset, mCurrentIterator would have been from mParent but post-mutation subsequent iterators are obtained from mParentCopy. Assert that the end() markers for both containers are the same. Bug: angleproject:3877 Change-Id: Ia29abd2acc0014522ef5856a88d8ec227cf9f19d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2693813 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 12990d73 2021-02-11T11:37:03 GetBitSet now uses BitSetArray instead of IterableBitSet Remove the now unused IterableBitSet class. Bug: angleproject:3877 Change-Id: I161e5d062c8183e30a7eb9040f3018116fe6e69e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2683494 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya dfd2a881 2021-02-11T11:26:18 Add more functionality to BitSetArray class Add support for more unary and binary operators. In order to support setLaterBit and resetLaterBit in BitSetArray::Iterator there were 2 choices - 1. Make a copy of BitSetArray only if it is a mutating usecase 2. Always perform a copy in the constructor BitSetIteratorPerfTest was run with both patches - 1) Copy only when necessary - RESULT BitSetIteratorPerf.wall_time: run = 116.1067374961 ns 2) Copy always - RESULT BitSetIteratorPerf.wall_time: run = 242.7446459439 ns We settled on the copy only when necessary path. Bug: angleproject:3877 Change-Id: If1d3cc428c68c84857952b46237aa5f206f080cd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2690912 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 8b624c6d 2021-02-05T15:33:52 Use constexpr initializer list for bitsets Allows setting/resetting multiple bits to be coalesced into one operation. Bug: angleproject:5528 Change-Id: Ibf2dff8c81441a75c268d95066d23da1b2a3c810 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2678885 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mohan Maiya 224e3c14 2021-02-08T13:00:16 Support optimized bitsets that need more than 64bits For usecases that needed more than 64bits we were using std::bitset container. This has slower perf compared to the BitSetT container. Add a new class that can support large bitsets by wrapping an array of BitSet32/BitSet64 objects, depending on CPU bitness, as the container. Bug: angleproject:3877 Tests: angle_unittests.exe --gtest_filter=BitSetArrayTest* angle_white_box_perftests.exe --gtest_filter=BitSetIteratorPerfTest* Change-Id: I3f4a635f9e6974a99db7a4b592ab206aad754760 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2664733 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi c07ef602 2021-01-05T12:26:05 Vulkan: Move xfb buffer decl to translator in emulation path This makes @@ XFB-DECL @@ empty on this path. Ultimately, this is working towards removing both @@ XFB-DECL @@ and @@ XFB-OUT @@ macros for both the emulation and extension paths, allowing the shaders to be compiled at compile time rather than link time. Bug: angleproject:3606 Change-Id: If16e9d92c419a04ecd3094481ed546d0708cdb43 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2611305 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 43163491 2020-09-22T11:45:06 Vulkan: Unresolve depth/stencil MSRTT attachments Using the same shader that unresolves color, this change allows depth/stencil to be unresolved as well. In turn, this allows the depth and stencil loadOp/storeOp of the implicit multisampled image associated with a multisampled-render-to-texture renderbuffer to be set to DONT_CARE. Stencil unresolve depends on VK_EXT_shader_stencil_export. In the absence of this extension, the stencil aspect is not unresolved and must continue to use loadOp=LOAD and storeOp=STORE. This is not ideal, but the expected use-case of depth/stencil MSRTT renderbuffers is that they get invalidated, so that load and store wouldn't happen in practice. Bug: angleproject:4836 Change-Id: I9939d1e15e10fa8ed285acdd6fe6edb42c59054f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2427049 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
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>
Jamie Madill 26ae42cf 2020-08-09T00:11:18 Vulkan: Clean up handleDirtyTexturesImpl. Adds a new bitset helper and changes a check to an ASSERT. Refactoring change only. Bug: angleproject:4959 Change-Id: I0de9f1b707c87cfb6fed8a110654783059e55c99 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2345025 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi dcc56215 2020-07-19T01:12:09 Vulkan: Implement GL_EXT_multisampled_render_to_texture This change allows the use of resolve attachments in the Vulkan backend. GL_EXT_multisampled_render_to_texture is implemented using this feature. The infrastructure for specifying resolve attachments is designed with eventual support for GL_EXT_multisampled_render_to_texture2 in mind as well as optimizations to glBlitFramebuffer() and multisampled backbuffers. Proper support for glRenderbufferStorageMultisampledEXT is still missing from this change. All tests use this for the depth/stencil attachment and don't read back the data. Currently, the depth/stencil attachment is created as a normal multisampled image. Bug: angleproject:4836 Change-Id: I110a7f63312ae61a657b6094adf7d97c92bd5843 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2304170 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 69c011ef 2020-06-25T23:51:42 Assert no undefined behavior with left shift in angle::Bit (uintN_t)1 << M has undefined behavior when M >= N. For example, the following: shift = 64; value = 1 << shift; Gives a value of 1 (instead of the arithmetically expected 0) on (some?) Intel CPUs. Bug: None Change-Id: I5fbb01eff812a62eb778474cec25a25b80052bac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2269857 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 6b49449d 2020-06-25T12:25:33 Vulkan: Fix mipmap generation and level redefinition When generating mipmaps, the non-base levels are redefined to be compatible. mRedefinedLevels was not updated to take this into account, resulting in invalid copies to the image. Additionally, noted a few spots where ImageDesc is used to respecify the image, but those are not up-to-date when the backend functions are called. Changed those to directly get the necessary information from the allocated image. Bug: chromium:1094644 Bug: chromium:1094599 Change-Id: I2afc9e5a53f24ef56836c5d7eec2e3e11df0ef61 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2267423 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev d6c7bac9 2020-04-18T01:41:14 Add BlendStateExt helper structure It provides compact storage and comparison operations for per-drawbuffer blend states. Added BitSetT::Zero() static constexpr. Bug: angleproject:4394 Change-Id: I66d6275facb7b28022fc24ff9cc0d8c3c976c99d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2154669 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Alexey Knyazev e6519445 2020-03-12T19:02:03 Implement ScanForward64 on 32-bit platforms This unlocks opt-in usage of BitSet64 on 32-bit platforms. It is slightly faster than IterableBitSet when the amount of bits is greater than 32. Bug: angleproject:4473 Change-Id: I230784acc871e13b1f94c87503f6bb869dcd3a68 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2100969 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 375ddfc5 2019-07-12T11:12:14 Signal different dirty bit for vertex buffer change. We use new logic to compare if the attribute format changes before setting dirty bits. This improves performance of VBO-only state changes significantly. On the VBO change Vulkan microbenchmark gives about a 30% improvement. Bug: angleproject:3256 Change-Id: Ifaf1c92ed7a09422156ef79b5983e7349de63346 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1684294 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Qin Jiajia 3f2b4e7f 2019-06-11T14:47:59 Fix the crash in angle_deqp_gles31_tests This crash only happened on a compute test which following a render test. This root case was that after the render test, mVertexArray11 became an invalid pointer. However, compute test still went to the common path to use mVertexArray11. mVertexArray11 is never updated since compute shader doesn't need to triger DIRTY_BIT_VERTEX_ARRAY_BINDING. This patch adds checking to avoid compute test to use mVertexArray11. Besides, more ASSERT checking are added to convenient debugging. Bug: angleproject:3518, angleproject:1663, angleproject:2619 Change-Id: I446214110d762fc259899cef7635f369fa1f59a7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1652866 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jiajia Qin <jiajia.qin@intel.com>
Shahbaz Youssefi 90b1865e 2019-03-29T00:00:27 More unittests for BitSet Bug: angleproject:2361 Change-Id: Icca49086d95ddb0d2d50e5ba71ae9b748eeabf3f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1545203 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Markus Tavenrath 957eb07f 2019-01-01T12:36:48 Remove redundant masking of the bits in angle::BitSet when using ternary operators. Bug: angleproject:3040 Change-Id: I59e69ddb27ec9c5723aff04858ac5c052e2775da Reviewed-on: https://chromium-review.googlesource.com/c/1392806 Commit-Queue: Markus Tavenrath <matavenrath@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Markus Tavenrath f7f8c518 2018-11-18T15:56:45 Optimize State::syncDirtyObjects Create a function table for State::syncDirtyObjects to avoid the costly switch and inline calls along the Context::syncDirtyObjects calling hierarchy. Bug: angleproject:2975 Change-Id: I1ec797452af41bc767578e4017c8eccb7d83628b Reviewed-on: https://chromium-review.googlesource.com/c/1340222 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@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 0cc11c68 2018-10-12T18:07:18 StateManagerGL: Remove setGenericShaderState. We can mutate the BitSetIterator as it clears dirty bits. This removes the risk of doing a double state update. Improves the proformance of the GL back-end state update. Also do an early-out before calling syncDrawArraysState. Bug: angleproject:2763 Change-Id: Idd25bdd67a6aceff05529a533260b661b07c2928 Reviewed-on: https://chromium-review.googlesource.com/c/1262740 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jiawei Shao 0661eb89 2018-06-13T10:51:54 Fix compile error in iterating ShaderBitSet This patch fixes a compile error when we do iteration on ShaderBitSet. Now we can directly get a ShaderType variable in a range-for iteration on a ShaderBitSet. BUG=angleproject:2169 Change-Id: I23e38f2ebd1c72145a2e54be374f7dcd9f5fb9e2 Reviewed-on: https://chromium-review.googlesource.com/1100312 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jiajia Qin <jiajia.qin@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jiawei Shao 3dd8d291 2018-03-30T09:39:09 Use ShaderBitSet for active use bits on uniforms BUG=angleproject:2169 Change-Id: I192c2e3c453540c8a6d7b0d066218ea3c9fbaab2 Reviewed-on: https://chromium-review.googlesource.com/989411 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
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>
Jiawei Shao 385b3e03 2018-03-21T09:43:28 Use packed enums on shader types in ANGLE renderer This patch uses a packed internal enum ShaderType everywhere we need a shader type instead of the GLenum value of the shader type. This patch also uses program::getAttachedShader(type) everywhere we need to get gl::Shader from a program in ANGLE. BUG=angleproject:2169 Change-Id: I28a7fa1cfe35622c57a486932911110688eaadec Reviewed-on: https://chromium-review.googlesource.com/972844 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez e4477001 2017-12-01T14:39:58 Add PackedEnumBitSet, use it for buffer binding validation Includes angle::BitSetT changes from jmadill@chromium.org BUG=angleproject:2169 Change-Id: I9f896613f5c6cdc91281cb9a00134f67291870d9 Reviewed-on: https://chromium-review.googlesource.com/804177 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Jeff Gilbert 5e5438fe 2017-10-31T14:44:06 Make operator bool() explicit, and remove explicit from move ctors. Gecko bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1371190 BUG=angleproject:2211 Change-Id: I10b866728a844668de6373c3a0968ea4e8256ff7 Reviewed-on: https://chromium-review.googlesource.com/747841 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Yuly Novikov c4f1dd83 2017-10-25T17:02:29 Use angle::BitSetIterator optimizations on arm64 as well Previously were enabled only on x86_64. Also change from using target_cpu to current_cpu, as the doc recommends. BUG=angleproject:1814 Change-Id: Ia7e8e930c76aab5cfb47b75e0ec78902ab313237 Reviewed-on: https://chromium-review.googlesource.com/737438 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Shao 37219c87 2017-04-26T10:59:48 Fix missing return values in bitset_utils.h This patch adds the missing return value *this in the operator= of class BitSetT BUG=angleproject:1814 Change-Id: I758d62e80e4ade92aac64315f1808ca1eabdc787 Reviewed-on: https://chromium-review.googlesource.com/487423 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>