src/libANGLE/renderer/vulkan/ContextVk.cpp


Log

Author Commit Date CI Message
Jamie Madill 21ad9b3c 2022-04-07T09:57:26 Vulkan: Add generic descriptors for DS cache. With the new design, the descriptor set cache keys include all identifying information needed to reconstruct the update descriptor sets calls except the specific resource handles. The places for the resource handles are held by serials intead. When we miss the cache, we no longer need a second step to then construct the update calls, and can build the update calls directly from the key structures in combination with a list of resource handles. Bug: angleproject:6776 Change-Id: If1660a557585a75e9aa2560d6a38c56b62f555c8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3484981 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill d8d396db 2022-04-07T09:57:25 Vulkan: Add shared descriptor set caches. This allows programs with the same sets of descriptors to share descriptor sets. Currently there is no cache eviction. This CL adds a new "Meta" class to manage the descriptor set caches. Each shared descriptor pool is unique to a descriptor set layout. The descriptor set cache is moved into the pool class. Now every instance of a descriptor pool in ANGLE has easy access to a descriptor set cache as well. Bug: angleproject:6776 Change-Id: I06982e0349f5a87e4578e769fa356ce8e7ab49f0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3424660 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 73cb1e6e 2022-05-11T12:53:46 Vulkan: Tag dynamic dirty bits with DYNAMIC Bug: angleproject:5906 Change-Id: Ia4294827f4c9f590448b791756ba7e95a90c8c09 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3642799 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 4ffab3bf 2022-05-10T16:17:54 Vulkan: Dynamic state for stencil reference Bug: angleproject:5906 Change-Id: I1aaf54208b173ca58ff1afd2900eca7ee78726cf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3638990 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Min Zhang 3d55cf0c 2021-12-30T11:27:26 Vulkan: Optimize the vkImage layout when used as GL_image If one vkImage has been used as GL_image in compute shader and as a GL_texture in fragment shader, no dependencies are needed for the fragment shader and other pre-fragment graphics shaders, like vertex/tess/geom. If we only assign the vkImage layout as writable when running GL executables that have Image Textures, we can specify more precise read-only barriers when running read-only GL executables. Bug: angleproject:6862 Change-Id: Iff37fdce13fea637751899253e535bf3f6663200 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3366014 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 1d8227da 2022-05-10T16:00:39 Vulkan: Dynamic state for stencil write mask Bug: angleproject:5906 Change-Id: I74adf56ec0b7b251ab3c5204b68b062d5fbc91eb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3638989 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi c3def6fa 2022-05-10T14:28:04 Vulkan: Dynamic state for stencil compare mask Bug: angleproject:5906 Change-Id: Ie581c6e9fe15c90c7a6d0c7c246dd5b1b30b6507 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3638988 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi dcaa18b9 2022-05-10T12:27:15 Vulkan: Dynamic state for blend color Bug: angleproject:5906 Change-Id: If450e0d84410069126027142414586181fd5f0de Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3638986 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 536d6f57 2022-05-10T11:44:58 Vulkan: Dynamic state for depth bias Bug: angleproject:5906 Change-Id: I8fd7e3262fddf3aec855afdd3e4c1b9801040da1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3638983 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 780f1a41 2022-05-10T00:30:35 Vulkan: Dynamic state for line width Bug: angleproject:5906 Change-Id: Iacf9c14d9d255c8048c71c725173e4764bcfe166 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3634733 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi 464f30f4 2022-05-09T16:33:08 Vulkan: Refactor UtilsVk dynamic state handling Dynamic state dirty bit handling is centralized in UtilsVk to reduce the risk of errors as more dynamic state is taken into account. Bug: angleproject:5906 Change-Id: Ib33554ff36f9249129a8f1650047dd987fe81982 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3634731 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 31321cb7 2022-05-09T16:17:25 Vulkan: Remove suppressions and workarounds for old AMD/Windows The old AMD/Windows bots are decomissioned. This change removes suppressions and workarounds that were added for that bot. Bug: angleproject:2463 Bug: angleproject:2809 Bug: angleproject:2847 Bug: angleproject:3243 Bug: angleproject:4720 Bug: angleproject:6123 Bug: angleproject:6652 Bug: angleproject:7144 Bug: angleproject:7227 Bug: chromium:1224996 Change-Id: I333ed6d76dfa2916b713ccb49127deceb5b1b551 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3634728 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao d075dfe2 2022-05-03T16:25:26 Vulkan: Reduce kMaxBufferToImageCopySize to 64M Bug: b/230538246 Change-Id: Id2ef9c35f74fb6f526744903402562f9354bfcdb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3625834 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 51dc3c3e 2022-05-02T18:11:26 Vulkan: Force prune when there are lots of suballocations destroyed If there are a lot of suballocations destroyed, there is bigger chance that some buffers become empty and we might able to trim down excessive empty buffers. This CL tracks the suballocations destroyed at each cleanupGarbage call and use that information to force immediate pruneEmptyBuffers call. Bug: b/230538246 Change-Id: Icca2ea731639545c635c09d58a8606d67405e1a6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3620981 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 5113ae8e 2022-04-29T22:42:59 Vulkan: Explicitly enable per-sample shading if `sample` used The Vulkan spec is not explicit about the `Sample` decoration implicitly enabling per-sample shading. While this is being corrected in the spec, the ARM Vulkan driver does not have this implicit behavior. A workaround is added such that the usage of the `sample` qualifier is reported, and used to explicitly enable per-sample shading through the API. Bug: angleproject:6876 Change-Id: Idb8345aacdcfa45cb37fefcd30aa5405168d21e3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3615738 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Amirali Abdolrashidi 3e05b93a 2022-04-12T19:39:19 Vulkan: MSAA swapchain resolve based on renderArea * Updated the MSAA resolve subpass so it can only be performed if the render pass is covering the entire area (e.g., not scissored). * Added test to make sure that the subpass resolve does not occur when the render pass does not cover the entire area. Bug: angleproject:6762 Bug: angleproject:7196 Change-Id: Iac3ab4b655dfeb7bff1348cc5e289a77a4dc0b83 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3584942 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Charlie Lao 1ef90012 2022-04-26T16:25:58 Vulkan: Remove API access for mTotalBufferToImageCopySizen Don't expose mTotalBufferToImageCopySize via API if it is unnecessary, for better encapsulation. Bug: angleproject:6354 Change-Id: If69a5a78cc40d54feee6f3474aef6292d60b89c5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3609016 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 7d31a47f 2022-04-23T00:19:15 Vulkan: Optimize away eglSwapBuffers for single buffer surfaces For single buffer surfaces, eglSwapBuffers serves two purposes: - Switch to/from single buffer mode - Implicitly issue a glFlush Simultaneously, for single buffer surfaces, glFlush serves three purposes: - Submit the commands - Call queue present (if necessary) - Throttle the CPU In this mode, ContextVk::flush() already redirects to the surface, calling WindowSurfaceVk::swapImpl() which calls back to ContextVk::flushImpl() (to submit the commands), calls queue present and throttles the CPU. If the application calls eglSwapBuffers(), the exact same thing happens (i.e. WindowSurfaceVk::swapImpl() is called to the same effect). Calling swapImpl() leads to an addition of the corresponding submit serial to the "swap history". The CPU throttling code always throttles the CPU to the serial of two swaps ago. Unnecessary calls to eglSwapBuffers() (when there is no command to be flushed) in single buffer mode would thus lead to the CPU throttled to the end of the last submission, effectively turning into a glFinish(). In this change, eglSwapBuffers() in single buffer mode, when not switching to/from this mode, is redirected to glFlush() as it's functionally equivalent. Simultaneously, ContextVk now tracks whether it has any pending commands for submission at all, and skips glFlush() altogether if there are none. Together, this results in the unnecessary eglSwapBuffers() to become no-op. Bug: b/229908040 Change-Id: I0e3b4a8b7eb4f6b0e0ed22260644825fc67dd330 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3603841 Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 9d6b3a7e 2022-04-22T21:43:14 Vulkan: Move overlay draw after swap's implicit flush While this introduces a render pass for drawing the overlay, it isolates it from the rest of code associated with the implicit flush on swap and relevant optimizations. This makes the overlay counters more accurate when it comes to said optimizations. Bug: angleproject:7084 Change-Id: I3298612923fe07139891a4252cd2a88de1783ee7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3602839 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 4aae5815 2022-04-22T13:21:03 Vulkan: Overlay widgets for submission statistics Bug: angleproject:7084 Change-Id: I68e69bda43862f9f2711c25a28dbe4745c19a45c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3602832 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 02b96848 2022-04-21T16:32:31 Vulkan: Add support for GL_QCOM_shading_rate Layer GL_QCOM_shading_rate over VK_KHR_fragment_shading_rate Test: ShadingRateQcomTest* Bug: angleproject:7172 Change-Id: I3f040dbfad3906facd4349937fed2ce9a464b824 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3599874 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Alexey Knyazev 62ca6449 2022-04-13T09:36:40 Reland "Fix BlendStateExt::mMaxColorMask initialization" This is a reland of commit 50d008a7efcab80f34eb742148d05389b2ed247e Besides fixing the BlendStateExt color mask initialization bug, the following changes were made: * All fields were made private with accessor functions. * A new assertion was added that ensures 64-bit storage for factors and equations. This allowed dropping one redundant mask. * Two new helper functions were added. * BlendStateExt::mMaxDrawBuffers was renamed to mDrawBufferCount. * The BlendStateExt class is now aligned to 8 bytes with an assertion. * Expanded test coverage. Also fixed incorrect usage of BlendStateExt fields in: * StateManagerGL::syncBlendFromNativeContext * StateManagerGL::restoreBlendNativeContext Original change's description: > Fix BlendStateExt::mMaxColorMask initialization > > This variable should not have its unused bits set. > > To avoid confusion with other masks of the same class, > the variable was renamed to mAllColorMask. > > Bug: angleproject:7200 > Change-Id: I72542d49ff8da3dbb8d61c5034ce37c1e8fcc6e1 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3581990 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Bug: angleproject:7200 Change-Id: I87a5fe0f9dfbbf5e525b9120f772aa9adb39ce5f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3593234 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Jamie Madill 2d6e42fc 2022-04-22T14:04:21 Update Program Pipeline TODOs. Bug: angleproject:3570 Bug: angleproject:7232 Change-Id: I0923e6b232b80ee26cb4c5788232c25a545ff87a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3600916 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org> Auto-Submit: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 2db718ed 2022-04-21T23:13:02 Vulkan: Skip empty submissions A number of places in ANGLE perform an implicit flush; eglSwapBuffers(), glFenceSync() etc. Sometimes these flushes are unnecessary because there is nothing to submit. Additionally, an application may unnecessarily issue glFlush() with nothing recorded. In this change, empty command buffers are automatically not submitted, optimizing these unnecessary flushes away. Bug: angleproject:7084 Change-Id: Iecb865b6b9ef8045dfecda7b5221874f7031b42e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3600837 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi b07a1156 2022-04-13T10:48:10 Split Context ResourceUseList to RP Commandbuffers * Finished splitting resourceUseList from ContextVk into that from each command buffer, mostly in UtilsVk.cpp. * Removed mResourceUseList from ContextVk. Bug: angleproject:7103 Change-Id: I6344f8144a38b13d7e5f599b2e935f0f92b22f98 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3585882 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Amirali Abdolrashidi 37c53684 2022-04-05T15:03:14 Split Context ResourceUseList to RP Commandbuffers * Split the resource use lists retained in context between the render pass command buffer and the outside render pass command buffer, mostly in vk_helper.cpp and ContextVk.cpp. Bug: angleproject:7103 Change-Id: Ib696bdec2c545cd7df9ae4ab86c54a294041d908 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3573581 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 2dd13ebb 2022-04-21T11:25:00 Track Surface color & depth/stencil init separately. This clears up some trace testing confusion due when robust resource init is enabled, and the app clears color but not depth on the default surface. Bug: angleproject:7221 Change-Id: Id97871aec32ad831b663aaa9116e04b582ab5a36 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3600375 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi c66de085 2022-04-19T23:56:50 Vulkan: Fix surface invalidate w.r.t shared present mode When in shared present mode (i.e. single-buffer rendering), surface shouldn't be invalidated on (the implicit) swap, because the application is expected to continuously draw to it. Bug: b/229689340 Change-Id: I006a954c558a5da1d9af631797546e4b76f4ff2c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3594801 Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Jeff Vigil <j.vigil@samsung.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill ff8a9f6a 2022-04-14T15:15:16 Vulkan: Renaming "ShaderBuffers" to "ShaderResources". This will match the functionality as we expand the descriptor set cache to non-buffer resources. Bug: angleproject:6776 Change-Id: I5597d074beea7d3b464802a2db9bcc2fcf84ca6b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3583359 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill b2a1f0d2 2022-04-14T07:58:32 Track total vs per-frame descriptor set counters. This will give more consistent measurements for descriptor set caches and descriptor set allocations. Bug: angleproject:6776 Change-Id: I584b8807ad19f8393ae54cc1d88b319c8f7f9f39 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3584636 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Charlie Lao 5014ce66 2022-04-18T18:05:20 Vulkan: Add orphaned list for non-empty BufferBlocks. In the fix for chromium:1299211, we added a new pool in the RendererVk and pick which pool to use at the getDefaultBufferPool() call. This CL fixes the original problem differently. In this CL we still uses the ShareGroup's pool. When display global texture is enabled, we orphan the non-empty buffer blocks into renderer and check and destroyed from garbage collection code. This way we still only deal with one buffer pool and all logic is mostly in context destroy code path, which I believe is a better solution. Bug: b/223428306 Change-Id: Ib465a11f7e3656df09cc891416ff57f086a8184b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3573390 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao cfc92ebf 2022-04-18T18:16:24 Vulkan: Encapsulate ShareGroup::mContexts Instead of return mContexts, this add addContext/removeContext API and changed getContexts to const function. No functional change expected, but clean up only. Bug: b/223428306 Change-Id: I020c4bc781f58352089980c9d8ff22bcb183dbe6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3590970 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi 5f7db775 2022-04-11T11:35:32 Vulkan: updateUniforms when commandbuffer is valid In order to change the resource use list from contextVk into that from one of its command buffers, we have to ensure the render pass command buffer is valid before potentially using its resource use list. * Added the dirty bit `DIRTY_BIT_UNIFORMS`. * Moved updateUniforms() and related functions in setupDraw() to the dirty bit handler where we have ensured that the render pass command buffer is valid. * Moved updateUniforms() and related functions in setupDispatch() to the dirty bit handler. Bug: angleproject:7103 Change-Id: I5435d16df543aa5a4c4be2b82586cb557ab53738 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3582979 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Shahbaz Youssefi c5271e8e 2022-04-04T23:28:35 Vulkan: Emulate GL_KHR_blend_equation_advanced Based on a change by Brandon Schade <b.schade@samsung.com> In the translator, when advanced blend is enabled, an input attachment is added. Based on the listed advanced blend equations, emulation code is added that performs those equations' functions. The blend equation itself is passed through a driver uniform. Note that the advanced blend extension only allows a single output to use advanced blend, and that should be at location 0. In the Vulkan backend, when advanced blend is used, the driver uniform to select the equation is updated and normal blending is disabled. Bug: angleproject:3586 Change-Id: Icc42e8be238d34fca149087eb9cfe616a7643a6b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3575738 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 4b381f41 2022-04-08T09:20:45 Vulkan: Fix descriptorSet perf counter values. Some counters were getting reset in multiple places, which could result in queries returning zero counts. Fix this by consolidating per-frame counter resets. Also updates how we compute cache hit/miss counters. This results in correct and consistent counts for cache accesses. Also includes a fix to not update the overlay when there are no enabled widgets. Also does away with some of the object- specific perf counters that were made to track descriptor set allocations. Bug: angleproject:6776 Change-Id: I769c715986defc50f0cfd0d997c338d34174e9f0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3573389 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Amirali Abdolrashidi 3cea7fcc 2022-03-16T16:33:43 Split Context ResourceUseList to RP Commandbuffers * Added mResourceUseList to each command buffer helper in an effort to move mResourceUseList away from ContextVk. * submitFrameImpl() renamed to submitCommands() * Moved the functions acquireResourceUseList() and onRenderPassFinished() in submitCommands() to the submitFrame functions calling it. Bug: angleproject:7103 Change-Id: I2487d5b86ea0a4d504f283aa7128501651317fe0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3531368 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Amirali Abdolrashidi 607d398e 2022-03-14T16:32:21 Vulkan: Optimize resolve of multisample swapchains * Resolves the multisampled image if the last render pass draws into the default framebuffer. * Added test to check the number of resolves in the optimization subpass (credit: Xinyi He) * Added test to check the number of resolves outside the subpass. * Added disabled test to see if the subpass resolve works. Bug: angleproject:6762 Change-Id: I86a8db3387851ab97d5f7a3d8a0ff26961254c14 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3523062 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Charlie Lao fe28a429 2022-03-30T15:34:49 Vulkan: Create buffer for vertex array if robust enabled If robust access is enabled (i.e., chrome), we want to ensure vulkan driver never access beyond that OpenGL buffer boundary. But with suballocation from BufferPool, we are using the same VkBuffer for all suballocations from the same BufferBlock. this combined with the fact that there is no size information in the vkCmdBindVertexBuffers, it means vulkan driver can not properly ensure vertex access not go beyond the subrange. It can only guarantee not access beyond the entire VkBuffer size. This CL creates a dedicated vkBuffer object and bind it to the suballocation of the vkDeviceMemory so that vulkan driver will see the exact range of the subrange instead of entire buffer. Since we may allocated more memory than actual requested size and the extra paddings are not zero filled , user size is used to create this vkBuffer. This is only enabled when robust access is enabled. This CL also ported webgl conformance test out-of-bounds-index-buffers.html and out-of-bounds-array-buffers.html to end2end test. Bug: chromium:1310038 Change-Id: I3499ae600028149b1039082e5011232b3e4e5e80 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3553940 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 041c4c6d 2022-03-25T16:30:03 Vulkan: Track color attachment usage like D/S in render pass That is in preparation for optimizing mid-render-pass clears, which requires an answer to the following query: "has this color image been read from / written to so far in the render pass?" With this change, a future CL will also be able to optimize color attachment invalidates, which currently break the render pass unconditionally, the same way depth/stencil is optimized. Bug: angleproject:5048 Change-Id: I3d3ee40d8444e6861c06340d5d52b17f5ee895b4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3542989 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Lingfeng Yang <lfy@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 3f331fae 2022-03-22T15:23:38 Vulkan: Dirty bits for depth/stencil access and feedback loop In preparation for doing the same for color, the depth/stencil render pass access and feedback loop modes are now updated with ContextVk dirty bits. This change also fixes clear after read-only depth/stencil feedback loop. The render pass wasn't broken in that case. Bug: angleproject:5048 Change-Id: I40f9b49593f9e6f35f42408e41c9d6267edb375e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3542988 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Yuxin Hu cdd97fb8 2022-03-24T17:41:30 Reland "Vulkan: Fix invalid access with display texture share group." This is a reland of 1099b5ef2279cfe1988a39c8e011aada59c650f1. Original change's description: > Vulkan: Fix invalid access with display texture share group. > Create bufferpool that owns by RendererVk. > If we are using EGL_ANGLE_display_texture_share_group > extension, use the bufferpool owned RendererVk, > otherwise, use the bufferpool owned by EGL::ShareGroup. > The bufferpool lifetime will remain consistent with > texture lifetime. > Bug: chromium:1299211 > Change-Id: Ie4e87cea1dfd20dabab24e2afed6ddd92e469888 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3531155 > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Geoff Lang <geofflang@chromium.org> Bug: chromium:1299211 Change-Id: I4b8f5bcb30297f2c5f24e02404fd96011f9d843b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3550038 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shrek Shao 73ec28af 2022-03-23T21:13:45 Revert "Vulkan: Fix invalid access with display texture share group." This reverts commit 1099b5ef2279cfe1988a39c8e011aada59c650f1. Reason for revert: suspect culprit of 1309304 Original change's description: > Vulkan: Fix invalid access with display texture share group. > > Create bufferpool that owns by RendererVk. > If we are using EGL_ANGLE_display_texture_share_group > extension, use the bufferpool owned RendererVk, > otherwise, use the bufferpool owned by EGL::ShareGroup. > The bufferpool lifetime will remain consistent with > texture lifetime. > > Bug: chromium:1299211 > Change-Id: Ie4e87cea1dfd20dabab24e2afed6ddd92e469888 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3531155 > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Geoff Lang <geofflang@chromium.org> Bug: chromium:1299211, 1309304 Change-Id: Ibdc119ef6bb52352858114d72a0f1c0edcd4da5e No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3546288 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Shrek Shao <shrekshao@google.com> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Yuxin Hu 1099b5ef 2022-03-17T17:20:44 Vulkan: Fix invalid access with display texture share group. Create bufferpool that owns by RendererVk. If we are using EGL_ANGLE_display_texture_share_group extension, use the bufferpool owned RendererVk, otherwise, use the bufferpool owned by EGL::ShareGroup. The bufferpool lifetime will remain consistent with texture lifetime. Bug: chromium:1299211 Change-Id: Ie4e87cea1dfd20dabab24e2afed6ddd92e469888 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3531155 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Amirali Abdolrashidi 730c1271 2022-01-07T13:41:08 Vulkan: Submit queue more often for texture data Outside command buffers should be flushed more often in order to prevent the texture data accumulation just before the first render pass when they are referenced. * Added a tracker next to copyBufferToImage() for texture size (in ContextVk). When its value passes kMaxBufferToImageCopySize, the outside command buffer operations should be submitted and the tracker would be reset. Currently, the threshold value is set to 1 << 28 = 256M. * Added a variation of submitFrame() to be used in outside command buffer submission. The main difference is that it copies mResourceUseList into GetShareGroupVk() rather than move it. * Refactored the two functions into submitFrameImpl(). * Added a helper function to submit the outside command buffer. * Added explicit copy functions for ResourceUseList and SharedResourceUse. The counter in the copied object is incremented by 1. * Added a test to make sure submitting the outside command buffer does not break the render pass. Bug: angleproject:6354 Change-Id: Ia1d4f857fcbd06934609c94622ccbf675b3b1c72 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3379231 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Jamie Madill e8ee847d 2022-02-23T12:25:39 Vulkan: Add UpdateDescriptorSetsBuilder. This helper class encapsulates the vkUpdateDescriptorSets caching. As part of the refactor, we switch passing a ContextVk to passing a vk::Context with some mutable variables. This helps encapsulate ContextVk. Since we use the perf counters in many places, this CL moves the perf counters to vk::Context, so we can access them everywhere. Refactoring change only. Bug: angleproject:6776 Change-Id: Id529962b2f425bece6f9b3bd0cd1698c692e58cb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3484980 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 98bb4f32 2022-02-23T16:51:32 Vulkan: Implement advanced blend through extension This change exposes GL_KHR_blend_equation_advanced if VK_EXT_blend_operation_advanced is supported. No emulation is yet implemented. Bug: angleproject:3586 Change-Id: Ie7a442c22e028e3aa45ccef52db320e205664d49 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3487951 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 349636a0 2022-03-15T09:39:36 Vulkan: Update mCurrentElementArrayBuffersync based on dirty bit The previous fix crrev.com/c/3513553 has run into corner case that requires more follow up change crrev.com/c/3522565. But with that, there is report that now we are hitting assertion in handleDirtyGraphicsIndexBuffer(). This becomes a bit fragile This new fix relies on the DIRTY_BIT_INDEX_BUFFER dirty bit and should be more reliable as long as the dirty bit is set properly (if not, then we have other bug that it won't even send down vulkan command to bind the correct element buffer). We could further optimize the code path and create a fast path for most common usages in the future. Bug: chromium:1299261 Change-Id: Ifa8f86d431798c9ca4c128ed71a3e9e0a3537ccb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3526021 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao e9d9d933 2022-03-14T09:33:28 Vulkan: Fix another corner case of mCurrentElementArrayBuffer mCurrentElementArrayBuffer is vertex array state. But it gets modified with different draw call parameters. When this changes, we always re-calculate mCurrentElementArrayBuffer. And we have added updateCurrentElementArrayBuffer call at various places where we need to reset mCurrentElementArrayBuffer to back to what bound to vertex array. There is still one more places missing such call, that when a different vertex array is been bound, the new vertex array may still have mCurrentElementArrayBuffer set to the special array for LineLoop. We need to reset it upon it gets bound. This CL also adds a new test case DrawElementsTest.LineLoopTriangles from Steven Noonan. Bug: angleproject:6955 Change-Id: Ida95062b071d25be26e59f886bfe3d61e6886c5c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3522565 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao b97aab3f 2022-03-09T17:36:24 Vulkan: resync mCurrentElementArrayBuffer when out of lineloop When glDrawElements is called with GL_UNSIGNED_BYTE type or LineLoop mode, we will internally allocate an element buffer and copy data to it. But when we switch out of that mode, we must re-sync mCurrentElementArrayBuffer to what it should be based on VertexArray buffer binding. This CL fix the bug that we were previously not updating it and end up using the wrong element buffer. Also added three tests: DrawWithSameBufferButDifferentTypes: that uses GL_UNSIGNED_BYTE data and GL_UNSIGNED_SHORT data in the same buffer and switch between these two data types without incurring buffer change. DrawWithSameBufferButDifferentModes: draw line mode followed by triangle without the same element buffer. DrawArraysLineLoopFollowedByDrawElementsTriangle: draw line mode with glDrawArrays and then followed by DrawElements. Bug: chromium:1299261 Change-Id: I5c471117d300e9fac9127a9d8fa66d48ac312f03 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3513553 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Jamie Madill a956162c 2022-03-01T13:05:29 Vulkan: Expose performance counters via extension. This CL rewrites the Vulkan perf counters test to work in the angle_end2end_test suite using the newly exposed AMD extension. Note that we implement only a subset of the extension. Instead of generating monitors and starting/stopping them we simply read back all performance counter data at once using the special montior value "0". The CL also enables these tests on SwiftShader. Bug: angleproject:4918 Change-Id: I5d8f6eecb1ccff448657cbdb65b51a225dfb90c0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3497538 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Mohan Maiya f9ade9fb 2022-02-18T15:08:54 Vulkan: Add feature to create pipeline during glLinkProgram Creating the pipeline will trigger the compilation of shaders to byte code thus warming up Vulkan shader caches. Typically most apps call into glLinkPrograms during app loadtime and the goal is to improve cache hit rate and reduce CPU workload during game play. Bug: angleproject:7046 Test: ProgramBinary*CreatePipelineDuringLink* Change-Id: I71351d45a9aa84e220ca38503735e94cff1dcf98 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3478354 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Yuxin Hu 1cef917c 2022-03-02T23:50:11 Reland "Remove ImageViewHelper from ResourceUseList" This is a reland of 126e967de3978f0dc4f6cf0fa3f9749366ea39ba Original change's description: > Remove ImageViewHelper from ResourceUseList > > Instead of keeping a dedicated SharedResourceUse mUse for > ImageViewHelper, let ImageViewHelper take ImageHelper.mUse > for lifetime tracking. ImageViewHelper no longer needs to > add its' own mUse in the ResourceUseList through retain() > calls, and this should cut the ResourceUseList size by > almost half. For instance, in the trace aztec_ruins, > the maximum ResourceUseList size before the change is 3643, > and the maximum ResourceUseList size after the change is 1694. > Since ImageViewHelper no longer needs to keep SharedResourceUse > mUse as a class memberWe can remove the inheritance from > Resource class, and make ImageViewHelper simply a NonCopyable class. > Bug: angleproject:6717 > Change-Id: I460e83f5f3c1d6ef9722b9f3c9a5ba9552563cb9 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3449450 > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Yuxin Hu <yuxinhu@google.com> Bug: angleproject:6717 Change-Id: I3aa9785d7dcdc8db82847f1586f8cd7d5c838d7c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3501194 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Yuxin Hu <yuxinhu@google.com>
Jamie Madill ef17f38a 2022-03-01T10:15:26 Vulkan: Add overlay widget for cache key size. Bug: angleproject:6776 Change-Id: I35ab18bc5919129b2decf58d541499f771140e47 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3472754 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Charlie Lao b72718d2 2022-02-22T16:18:45 Vulkan: Fix the data race for mUse from two threads A data race of mUse object between two threads can occur with the following sequences: 1) You use the buffer in the context, it adds into mResourceUseList 2) You release the buffer. Now it goes into mGarbageList, even though it is still in the mResourceUseList. Now this mUse object has references from two lists, the mGarbageList and mResourceUseList, and they do not use the same mutex lock. This means the race could happen and corrupt the mUse data. The same thing could happen with ImageHelper object as well. This quick fix also grabs mGrabageMutex while processing mResourceUseList. This CL creates a new garbage list to hold garbage that has not been submitted to vulkan. And this list will only accessed from submission thread and with mGarbageMutex lock held. The advantage of this is that mSharedGarbage will only have objects that already submitted, which means it is in FIFO order so that we can break out the loop as soon as we see an uncompleted garbage. This bug was exposed by MultithreadingTest.MultiContextClear/ES3_Vulkan_SwiftShader on linux-tsan-test Bug: angleproject:7045 Change-Id: I264c970579aaa53373a61ff067fa0e21eb410ae6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3482158 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 8390196a 2022-02-26T02:36:22 Revert "Remove ImageViewHelper from ResourceUseList" This reverts commit 126e967de3978f0dc4f6cf0fa3f9749366ea39ba. Reason for revert: Hits an ASSERT about too much garbage being accumulated. anglebug.com/7063 Original change's description: > Remove ImageViewHelper from ResourceUseList > > Instead of keeping a dedicated SharedResourceUse mUse for > ImageViewHelper, let ImageViewHelper take ImageHelper.mUse > for lifetime tracking. ImageViewHelper no longer needs to > add its' own mUse in the ResourceUseList through retain() > calls, and this should cut the ResourceUseList size by > almost half. For instance, in the trace aztec_ruins, > the maximum ResourceUseList size before the change is 3643, > and the maximum ResourceUseList size after the change is 1694. > Since ImageViewHelper no longer needs to keep SharedResourceUse > mUse as a class memberWe can remove the inheritance from > Resource class, and make ImageViewHelper simply a NonCopyable class. > > Bug: angleproject:6717 > Change-Id: I460e83f5f3c1d6ef9722b9f3c9a5ba9552563cb9 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3449450 > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Yuxin Hu <yuxinhu@google.com> Bug: angleproject:6717 Change-Id: Iea3d40458e2cc5be6ab0257ba6df8b82a4eeecda No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3491345 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Yuxin Hu 126e967d 2022-02-09T01:46:25 Remove ImageViewHelper from ResourceUseList Instead of keeping a dedicated SharedResourceUse mUse for ImageViewHelper, let ImageViewHelper take ImageHelper.mUse for lifetime tracking. ImageViewHelper no longer needs to add its' own mUse in the ResourceUseList through retain() calls, and this should cut the ResourceUseList size by almost half. For instance, in the trace aztec_ruins, the maximum ResourceUseList size before the change is 3643, and the maximum ResourceUseList size after the change is 1694. Since ImageViewHelper no longer needs to keep SharedResourceUse mUse as a class memberWe can remove the inheritance from Resource class, and make ImageViewHelper simply a NonCopyable class. Bug: angleproject:6717 Change-Id: I460e83f5f3c1d6ef9722b9f3c9a5ba9552563cb9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3449450 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi d3ded9aa 2022-02-22T23:02:59 Vulkan: Make Overlay init lazy So it's not done when overlay is not in use. Bug: angleproject:7051 Change-Id: Iae2ba20cf8c0825dc5f321e5b31dd278cd892066 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3481310 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao f996d4d8 2022-02-16T09:27:04 Vulkan: Fix DynamicBuffer cache reuse. There is a regression bug that the DynamicBuffer's BufferHelper's size is no longer the size of entire buffer block's size, but the size of suballocation. This caused buffer reuse logic to screw up since it relies on the size to make the decision to keep or free the mFreeBufferList. This CL fixes this bug by using the buffer block's size. This CL also removes DynamicBufferPolicy since it is not used any more since most of DynamicBuffer usages that triggered that DynamicBufferPolicy implementation have been switched to BufferPool. The remaining DynamicBuffer usage is only for attributes and uniforms which are generally small and per context. Bug: angleproject:6980 Change-Id: I9e013cbd67dd74f5e7fc5bb7d9c9696bd1f69965 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3469714 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Jamie Madill 8ade4c2f 2022-02-16T13:14:54 Vulkan: Add overlay and stats for descriptor set caches. This adds more overlay widgets for different metrics of descriptor sets, including for uniforms and for all sets. Bug: angleproject:6776 Change-Id: If1a053bd711454227e7ccbdb01202a712a5f9787 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3469228 Reviewed-by: Charlie Lao <cclao@google.com> Auto-Submit: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 8d966f7d 2022-02-08T11:05:09 Vulkan: Simplify SubAllocation data types. We no longer need to bootstrap on the wrapper classes because we use a separate garbage list. This simplifies the code for the allocation tracking considerably. Also we remove a few mutable accessor to fortify our OOP design. (Credit to Jamie since it is splited from his CL) Bug: angleproject:6980 Change-Id: I2025ec4d141531273e824bb586957a38efc30be1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3469715 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Charlie Lao 38723c28 2022-02-15T16:29:36 Vulkan: Allocate space for default attrib only if it is enabled When context's default attributes is dirty, we allocate space for the default attribute, regardless it is enabled or not. Then we call into VertexArrayVk::updateDefaultAttrib() which only update its state if the attribute is enabled. This causes a use-after-free scenario that if it is disabled, the vertex array may have a pointer to the buffer that is now becomes inflight which may gets deleted when DynamicBuffer code think the size no longer matches etc. Bug: chromium:1296467 Change-Id: Ib9ec8e60ebdb326f9bbfb215b3711c37631fce4b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3466776 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Jamie Madill 8cb58667 2022-02-16T13:47:22 Vulkan: Add uniform descriptor set caching test. This covers the case where we'd continually miss the cache due to buffer size mismatches. Bug: angleproject:6980 Change-Id: Ia58871f431b6241af52fa0c37ab51952bc1c4f97 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3469227 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Auto-Submit: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 5f3f13f6 2022-02-15T13:39:57 Vulkan: Invalidate D/S for multisampled EGL configs too Regardless of whether the EGL config is MSAA, depth/stencil should be invalidated at the end of the last render pass. Originally, optimizeRenderPassForPresent was gated on !MSAA because it was only affecting the layout of the color attachment. Bug: angleproject:7007 Change-Id: I7cd5497a9da6eeb168c3b55b91f2ff6f5674adb6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3465498 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Yuxin Hu e5045587 2022-02-11T22:29:55 Debug Overlay Demo Add a new debug overlay to display texture descriptor set cache size Bug: angleproject:6976 Change-Id: I8bb2d88d4550947f1c6cbd732f936e3e060b1b04 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3457356 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuxin Hu <yuxinhu@google.com>
Charlie Lao 527ceb73 2022-02-07T18:25:02 Vulkan: Switch XFB counter buffer to suballocation Bug: b/205337962 Change-Id: I2e26fa3ab150b858f07665459fa108440af988d5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3402333 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi d285d6a7 2021-11-23T23:12:00 Vulkan: Use VK_EXT_depth_clip_control Bug: angleproject:6679 Change-Id: Iea3b7a2d8db630dcea19836732de8f9e0a7a568f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3298356 Reviewed-by: mohan maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Hyunchang Kim fd378ce5 2022-01-25T18:06:31 Rebind program on glUseProgramStages Rebinding program causes all uniform resetting. And uniform resetting is required not to use wrong uniform for changed program stages. Bug: angleproject:6946 Change-Id: Ic969aa8fec2ff6e16f46b96a61c6d876bf37ff2f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3416791 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 038adcae 2022-02-08T16:46:40 Vulkan: Render the overlay in the graphics pipeline Bug: angleproject:6976 Change-Id: I388d429f0726b4d6a1c4ecd446ead93579a14a1b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3448643 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 6207fe88 2022-02-03T14:11:30 Vulkan: Minor cleanup to DynamicDescriptorPool. In preparation for future changes. Bug: angleproject:6776 Change-Id: I0a2ab004883ad482f4ed19075c5f5f4e9c451ae0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3437413 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 70c510eb 2022-02-03T07:54:29 Vulkan: Use common storage for descriptor set descs. This lets us avoid using templates when implementing descriptor set caches. As an added bonus, the key size now scales with the number of active items in the cache. In the case of using a smaller set of active textures, our keys now use sizeof(uint32_t) * (kFastBufferWordLimit) + sizeof(void *) bytes of storage (132/136) instead of sizeof(uint32_t) * 3 * 96 bytes (1152) per set. This reduction should improve cache coherency. Bug: angleproject:6776 Change-Id: I904fc5527ff033af927e25abe6d13d98142e3f14 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3436767 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 8b81742d 2022-02-03T07:41:16 Vulkan: Move shader resources descriptor set update. This is in preparation for adding shader serial information to the desc, to work around a bug with incorrect descriptor set cache hits. It could have some perf impact if we restart command buffers constantly while using UBOs/SSBOs. Bug: angleproject:6776 Change-Id: I24f5cefd329a1c36f7f60cb2a520cfdf5f127051 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3436765 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi d9fcebb8 2022-02-07T14:11:58 Vulkan: Make framebuffer fetch syncval errors more specific The errors are very generic, so now they are only suppressed if framebuffer fetch is used by the application. This change partially relands 2eeb87488. Bug: angleproject:6951 Change-Id: I55f444d19360d3066f1d4b0959d25e676dbb1a38 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3444341 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Ian Elliott 9208dcc6 2022-02-07T18:23:12 Revert "Vulkan: Enable framebuffer fetch on SwiftShader" This reverts commit 2eeb8748867c529474200d302f21f20ab461b9b4. Reason for revert: Breaks tests for ANGLE-to-Chromium autoroller Original change's description: > Vulkan: Enable framebuffer fetch on SwiftShader > > Bug: angleproject:6951 > Change-Id: I10eeb58be9e8639c0519fc47f327a0894155b755 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3437409 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:6951 Change-Id: I35eaf2b7411d1bf055484bbb32f7e681286edd42 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3442370 Reviewed-by: Ian Elliott <ianelliott@google.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Ian Elliott <ianelliott@google.com>
Shahbaz Youssefi 2eeb8748 2022-02-03T13:10:54 Vulkan: Enable framebuffer fetch on SwiftShader Bug: angleproject:6951 Change-Id: I10eeb58be9e8639c0519fc47f327a0894155b755 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3437409 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 1608a956 2022-02-02T13:54:53 Vulkan: Revert client vertex data streaming to use DynamicBuffer In early CL crrev.com/c/3352489, I switched client vertex data streaming from using DynamicBuffer to sub-allocating from the buffer pool. That caused CPU overhead regression due to extra cost of handling the suballocation object creating and garbage collection etc. Even after all other optimizations I did since then that significantly improved garbage collection performance, there is still 6% CPU time regression as measured with gardenscape. This CL moves StreamVertexData() back to use DynamicBuffer. In order to do that, I have cleaned up DynamicBuffer interface to be consistent with suballocation interface by storing the current allocated offset/size in the suballocation object. With that, the BufferHelper object that returned from DynamicBuffer will be able to pass around and referenced exactly like it comes from suballocation code path, and you can retrieve offset/size from that BufferHelper object instead of having to pass offset around between various function calls. Given that streaming vertex data from client memory is only possible for default vertex array and there is only one default vertex array for each context, this stream vertex data dynamic buffer is essentially a per context object. So the other change I made here is that I have merged mDynamicVertexData with default attribute (which uses per context dynamic buffers) code to use the same sets of dynamic buffers, since you will only use one or the other but not both. Bug: b/205337962 Change-Id: I0ceca5b854069f00afdb9544ee86953b9b773821 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3434645 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Cody Northrop e56f0e29 2022-01-26T19:46:01 Vulkan: Check program fetch status when switching framebuffers Before this patch, we only checked whether to update the framebuffer fetch status when the program changes. We also need to check when the framebuffer itself changes. Test: FramebufferFetchES31.FramebufferMixedFetchTest Bug: angleproject:6893 Change-Id: I92ff1f30dfb3f17aee362e5931fc4c94d18142ba Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3418842 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Cody Northrop <cnorthrop@google.com>
Charlie Lao 293c0b51 2022-01-21T15:53:38 Vulkan: Cache commonly used 6 ushorts stream index array data Looking at all app traces that we currently have, 16 out of 100 apps are making glDrawElements calls without element buffer. And among these usages, most of them are calling glDrawElements with 6 unsigned shorts, which makes sense for drawing a quad. This CL caches first four BufferHelper objects with 6 uint16_t indices in a buffer and reuse them if the data matches. With this we avoid create/destroy suballocations, we even save the time of data copy and set DIRTY_BIT_INDEX_BUFFER when called with same set of indices, which is the case for almost all apps that uses glDrawElements based on app traces research. In order to test the effect, I modified the `--minimize-gpu-work` to keep glDrawElements calls with (count=6, tye=ushort) to pass down count/type into angle, and only change the mode to point. That way this new optimization will gets activated with `--minimze-gpu-work` command line option (see crrev.com/c/3421377). With that, this CL sees cpu overhead reduced from 2.54ms to 2.37ms on Pixel6 with vulkan_offscreen_gardenscape. Bug: b/215768827 Change-Id: I9b682868978e3bef7b5b9d1a596500ead2738d3e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3404677 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 665ddccd 2021-12-09T23:06:39 Vulkan: Emulate dithering Dithering in OpenGL is vaguely defined, to the extent that no dithering is also a valid dithering algorithm. Dithering is enabled by default, but emulating it has a non-negligible cost. Similarly to some other GLES drivers, ANGLE enables dithering only on low-bit formats where visual banding is particularly common; namely RGBA4444, RGBA5551 and RGB565. Dithering is emulated in the fragment shader and is controlled by a spec constant. Every 2 bits of the spec constant correspond to one attachment, with the value indicating: - 00: No dithering - 01: Dither for RGBA4444 - 10: Dither for RGBA5551 - 11: Dither for RGB565 The translator appends code to the shader that, based on the format specified by the specialization constant, adds dithering to each color attachment output. A 2x2 Bayer matrix is used for dithering, indexed by gl_FragCoord.xy % 2. Bug: angleproject:6755 Change-Id: Ib45da5938e299b6626bff921119d63e7357dd353 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3374261 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 168e0ae5 2022-01-27T16:50:00 Vulkan: Refactor descriptor pool code. This uses vk::Context to init DynamicDescriptorPool, and removes some accesses to ProgramExecutableVk member variables so the methods can more easily be moved into another class. The changes should have no effective behaviour difference. Note that the immutable sampler descriptor count is entirely set by the format of the immutable samplers. However we can't determine this count by looking at the descriptor set layout desc with the current implementation. Bug: angleproject:6776 Change-Id: I0a323d19fa3720b5afd8300401ed9c30b105c0ef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3424657 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jeff Vigil e03f1753 2022-01-06T09:48:12 EGL: mutable_render_buffer deferredFlush fix When in SINGLE_BUFFER mode, need to get around deferredFlush and call Swapbuffers to force update This must do status check for OUT_OF_DATE. Bug: angleproject:6878 Change-Id: I34b7381f6799879bf6f6d490aba02feffc5c3748 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3373739 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Brandon Schade <b.schade@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 4e644b33 2022-01-22T16:17:46 Vulkan: Remove ProgramExecutableVk back-pointers. This removes the mProgram and mProgramPipeline back-pointers from ProgramExecutableVk. In order to fix this, we needed to refactor the VkPipeline init functions to call through ProgramExecutableVk only instead of passing through ProgramVk. We also needed to move the early fragment shader optimization boolean out from Program. This CL also fixes a few places where the early fragment test optimization boolean wasn't properly updated. Bug: angleproject:3570 Change-Id: Ie4c48087f6eb022e6f0a4dacc2710085165d49e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3408267 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 7c1346bd 2022-01-21T11:35:45 Vulkan: Consolidate uniforms code in ProgramExecutableVk. De-duplicates several methods. Refactoring change only. Bug: angleproject:3570 Change-Id: Ib68bc30b3e9b1087871bb268ea292677e0c9fe2e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3408061 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 0dc0dc2a 2021-12-30T11:35:40 Re-land: "Vulkan: Remove "fillProgramStateMap"." This copies additional shader info like uniforms from the Program to the Program Piplines. There is now a duplication between PPOs and Programs. There is no additional storage required for non-PPO Programs. Re-land fixes fragment in/out uniform updating with PPOs. Bug: angleproject:3570 Change-Id: I64b2db6fbc3a610f3b5e617301f94eb30d915939 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3412999 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Yuly Novikov 6a14e328 2022-01-25T00:49:45 Revert "Vulkan: Remove "fillProgramStateMap"." This reverts commit 38deffe40db83836588e0cd50864945a9ddba36b. Reason for revert: angle_end2end_tests failures on Pixel 6. Original change's description: > Vulkan: Remove "fillProgramStateMap". > > This copies additional shader info like uniforms from the Program > to the Program Piplines. There is now a duplication between PPOs > and Programs. There is no additional storage required for non-PPO > Programs. > > Bug: angleproject:3570 > Change-Id: I5ed6c946df945aaf2f65752f797b16e7649d5584 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3362297 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> > Commit-Queue: Jamie Madill <jmadill@chromium.org> Bug: angleproject:3570 Change-Id: I3a4822c8a65d024070a9fe5df103b88a3c8333d3 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3414024 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill 38deffe4 2021-12-30T11:35:40 Vulkan: Remove "fillProgramStateMap". This copies additional shader info like uniforms from the Program to the Program Piplines. There is now a duplication between PPOs and Programs. There is no additional storage required for non-PPO Programs. Bug: angleproject:3570 Change-Id: I5ed6c946df945aaf2f65752f797b16e7649d5584 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3362297 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 158ecba6 2022-01-07T16:40:26 Vulkan: Remove cached Impl pointers from ContextVk. These pointers were a common source of programming error, where sometimes they wouldn't be updated when they were needed. Instead we can pull the objects directly from the GLES state. We added them initially to attempt a performance improvement, but it's likely they didn't significantly decrease memory accesses or the number of instructions we process for GLES calls. Hence removing them should be an improvement in safety without a perf loss. Bug: angleproject:6864 Change-Id: I54107686992065a514077c71d173b804e295515e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3378904 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Amirali Abdolrashidi 9b1a6d8a 2022-01-06T10:38:25 Vulkan: Invalidate depth/stencil unconditionally * Moved depth/stencil content invalidation during swapImpl() to doDeferredAcquireNextImage(), so it can be done regardless of whether render pass optimization is done. Bug: angleproject:6861 Change-Id: I47fab18afe5b178bf55c2df3df712c40118aff1f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3370583 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Shahbaz Youssefi 9d11a341 2021-12-16T13:47:04 Vulkan: Fix Vulkan SCB vs multiple subpasses vkCmdNextSubpass must be called on the primary command buffer, so the render pass command buffers need to be split on subpass boundaries. This is only done when using Vulkan secondary command buffers. Bug: angleproject:6811 Change-Id: I087fff305c757c78e87bfde4410e7de6bd1a6ba6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3344774 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi acd8fc76 2021-12-16T01:05:02 Vulkan: Distinguish RP and outside-RP command buffer types What goes inside and outside a render pass command buffer is largely mutually exclusive. Moreover, the size and frequency of allocations is different between the two. This change distinguishes the C++ types used for inside and outside render pass command buffers: - The type now documents which command buffer a function is able to receive. - `isRenderPass` flag passing, checking and asserting is largely removed. - A follow up change experiments with using different (Vulkan vs ANGLE) secondary command buffers for inside and outside RP command buffers. - A future change could specialize the pool behaviors per command buffer type. Bug: angleproject:6811 Change-Id: Ia4bc669d26ac7e94e8a0dfb9b361666c82f42cc3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3344373 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 8589c456 2021-12-22T17:13:33 Vulkan: Remove mStagingBuffer from ImageHelper and ContextVk This CL removes ImageHelper::mStagingBuffer and ContextVk::mStagingBuffer and uses per shared group staging buffer pool instead. Bug: b/208323792 Change-Id: I46b5fd542697eb860def9c6d592dd147ad4dc973 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3354090 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao ad27d5d6 2021-12-21T11:22:30 Reland "Vulkan: Consolidate all vertex conversion buffers to shared pool" This is a reland of cca412cd8b349b7281727c50f2a59d115fd90a05 Further inspection shows it was red-herring. The original CL does not have the un-intended diff that I saw in the commit email. This is try to reland the original CL without any modification. Original change's description: > Vulkan: Consolidate all vertex conversion buffers to shared pool > > There are various conversion buffers that holds converted vertex or > element or index data. They are DynamicBuffer for now. This CL switches > them to use the shared group buffer pool. With this change, all > allocation is represented by a BufferHelper object instead of an offset. > I am able to remove the offset arguments from a lot of APIs. > > Bug: b/208323792 > Change-Id: Ib611beb0c16cddbdd9ddf7b8961c439da9fa5180 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3352489 > Reviewed-by: Tim Van Patten <timvp@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Charlie Lao <cclao@google.com> Bug: b/208323792 Change-Id: I90852ad38c2b9ac423800bb6854757bcc17cd166 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3370602 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Tim Van Patten a61a7f59 2021-12-28T18:16:40 Vulkan: Use correct aspectMask Update ImageHelper::stageSubresourceUpdateFromImage() to use the correct aspectMask flags based on the image's format, rather than assuming only color formats. Additionally, only call ensureMutable() for sRGB textures that indicate srgbDecode == GL_SKIP_DECODE_EXT. Bug: angleproject:6852 Test: DepthStencilFormatsTest.DepthTextureRender Change-Id: Iaf1f167612144f836c5574b0f561cc1b58c3cb6a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3360090 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Charlie Lao 4e85bdd9 2022-01-06T17:06:25 Revert "Vulkan: Consolidate all vertex conversion buffers to shared pool" This reverts commit cca412cd8b349b7281727c50f2a59d115fd90a05. Reason for revert: There is accidental code merge bug left in. Original change's description: > Vulkan: Consolidate all vertex conversion buffers to shared pool > > There are various conversion buffers that holds converted vertex or > element or index data. They are DynamicBuffer for now. This CL switches > them to use the shared group buffer pool. With this change, all > allocation is represented by a BufferHelper object instead of an offset. > I am able to remove the offset arguments from a lot of APIs. > > Bug: b/208323792 > Change-Id: Ib611beb0c16cddbdd9ddf7b8961c439da9fa5180 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3352489 > Reviewed-by: Tim Van Patten <timvp@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Charlie Lao <cclao@google.com> Bug: b/208323792 Change-Id: I18bba207d1d8bb76dff32d9855a744dba93bc6d6 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3370601 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao cca412cd 2021-12-21T11:22:30 Vulkan: Consolidate all vertex conversion buffers to shared pool There are various conversion buffers that holds converted vertex or element or index data. They are DynamicBuffer for now. This CL switches them to use the shared group buffer pool. With this change, all allocation is represented by a BufferHelper object instead of an offset. I am able to remove the offset arguments from a lot of APIs. Bug: b/208323792 Change-Id: Ib611beb0c16cddbdd9ddf7b8961c439da9fa5180 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3352489 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 43b0e92b 2021-12-13T15:38:32 Vulkan: Consolidate mHostVisibleBufferPool and mMapInvalidate BufferVk::mHostVisibleBufferPool is allocated when BufferVk::mBuffer is not hostvisible and we need to map it. In that case mHostVisibleBufferPool is allocated and data copied from mBuffer to it and the pointer to mHostVisibleBufferPool is returned to user. BufferVk::mMapInvalidateRangeStagingBuffer is used when map is called on a small range. In this case we allocate memory for the small range of buffer and return that intead of waiting for entire buffer for GPU to finish. Also when BufferSubData is called, we also needs to allocate a staging buffer and issue a copyBuffer from staging buffer to main buffer. This CL consolidate all these three usage cases into one mStagingBuffer. It removes mHostVisibleBufferPool and mMapInvalidateRangeStagingBuffer from BufferVk class. This makes overall logic of managing data consistency much simpler as well since we only have two buffers: The main buffer storage mBuffer or mStagingBuffer. And mIsStagingBufferMapped tracks if mStagingBuffer is the one actually mapped to user or not so that at unmap time we know if we should flush the data to mBuffer or not. Bug: b/208323792 Change-Id: I4f0c79a2d86da1a43844ed2ba83ddeb7dd4a5c0b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3335216 Reviewed-by: Lingfeng Yang <lfy@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Lingfeng Yang 6f1c39b5 2021-12-16T16:10:49 Vulkan: Restore color attachment mask-related blend states When we end up resetting blend state such as when changing to a depth-only FBO and back, we can end up adding attachment states. They need to be updated with the current GL blend state. Bug: b/210543392 Bug: angleproject:6828 Change-Id: I3419acb8081eb7d662576a75382bb8684cc0d29f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3346320 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Lingfeng Yang <lfy@google.com>
Shahbaz Youssefi 4114fe23 2021-11-20T22:05:56 Vulkan: Simplify transform feedback emulation logic In [1], the program is transformed to not output transform feedback logic when transform feedback is inactive. With that change, it's no longer necessary to dedicate a driver uniform to indicate if transform feedback is active. [1]: https://chromium-review.googlesource.com/c/angle/angle/+/3294661 Bug: chromium:1209285 Change-Id: Ica725d0da08e2676f442fe6307962d367b443535 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3294702 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 6c894e82 2021-11-04T14:49:41 Vulkan: Replace BufferVk::getBufferAndOffset() with getBuffer() Now BufferHelper class already keeps offset information. There is no reason for BufferVk to have that information any more. Bug: b/205337962 Change-Id: I6e014fb480bfcd5018ef9231b0fb87a50021f179 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3266147 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 83a670ab 2021-10-29T09:12:26 Vulkan: Implement BufferPool using VMA's virtual allocator VMA's allocation calls used to be sub-allocating a pool of memory. What we really want is sub-allocate a VkBuffer object. VMA recently added support to expose the underlying range allocation algorithm via APIs, which user can use it to sub-allocate any object. This CL uses that new virtual allocation API to sub-allocate from a pool of VkBuffers. In this CL we only switched BufferVk::mBuffer to sub-allocate from the BufferPool object. Bug: b/205337962 Change-Id: Ia6ef00c22e58687e375b31bc12ac515fd89f3488 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3266146 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Lingfeng Yang 83679716 2021-12-14T19:02:48 Vulkan: Dirty vertex buffers if default attrib values changed In the call_break_offline trace, attribute index 4 is disabled then enabled before a draw. This redundant operation is currently not blocked and makes it to the Vulkan backend, resulting in handleDirtyGraphicsVertexBuffers. However, at the same time, we change the default attrib value for index 3. Which makes handleDirtyGraphicsVertexBuffers not redundant. We'll need to take into account cases when other attribute indices are not dirty and yet the default attrib value changes. Bug: angleproject:6802 Change-Id: I4a3ec411aa42f73a209fd0f06976d7ef2d21e027 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3331412 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Lingfeng Yang <lfy@google.com>