src/libANGLE/renderer/vulkan/vk_helpers.cpp


Log

Author Commit Date CI Message
Charlie Lao a1f8049a 2022-07-06T13:12:20 Vulkan: Remove VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT Some virtual machine drivers have performance cost with VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT. This CL keeps the individually freed descriptorSet in the pool and try to reuse rather than free it. This CL also removes descriptorSetCount from some API since it always allocate one at a time. Bug: b/237848471 Change-Id: I029d651101fa1050770eba9e733a166e56a69684 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3749797 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 81a69da6 2022-06-30T09:56:54 Vulkan: min/mag filters follow chroma filter value The Vulkan spec states that for those formats lacking support for VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT the min and mag filter must be equal to the sampler YCbCr conversion's chroma filter. Having the min/mag filters follow the chroma filter leads to simpler and more efficient code. Also update getPreferredFilterForYUV function to return existing filter value when preferLinearFilterForYUV feature is disabled. Bug: angleproject:7382 Bug: angleproject:7392 Tests: Texture2DTestES3YUV.TexStorage2DYuvFilterModes* Tests: ImageTestES3.SourceYUVAHBTargetExternalYUVSampleLinearFiltering/ES3_Vulkan Change-Id: I550ef8feede1dc6c3a0d8e32f790113e90ef7a4b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3739582 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Charlie Lao 723cc880 2022-06-10T17:55:54 Reland "Reland "Vulkan: Destroy DescriptorSet cache when it becomes invalid"" This is a reland of commit 551a26aeedbfd971d6199c8eddb433a4f4ff871c Original change's description: > Reland "Vulkan: Destroy DescriptorSet cache when it becomes invalid" > > This is a reland of commit 0779ccbcd427dcb00e53afa6385fb4e8e2377993 with > the fix for angleproject:7466. When DescriptorPoolhelper gets > release/destroyed, we ensure all sharedCacheKeys are destroyed. > > Original change's description: > > Vulkan: Destroy DescriptorSet cache when it becomes invalid > > > > When a new texture descriptorSet is allocated, we store one reference of > > the cache key in ProgramExecutableVk and all TextureVks that it > > associated with. When any of the TextureVk is destroyed or its view > > destroyed, we immediately erase the descriptorSet from the cache and > > track GPU progress and free the descriptorSet when it's GPU completed. > > That way we delete the dead descriptorSet that will for sure never been > > reused ASAP so that its space is avialable for reuse. > > > > Bug: b/235523746 > > Change-Id: Ib1b9662a254eea5a3f410dc6d5d89fca6727a647 > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3700226 > > Reviewed-by: Lingfeng Yang <lfy@google.com> > > Commit-Queue: Charlie Lao <cclao@google.com> > > Reviewed-by: Ian Elliott <ianelliott@google.com> > > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > > Bug: b/235523746 > Bug: angleproject:7466 > Change-Id: I4413bec27ea0ca830010e2ca15036c2e667141c0 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3726964 > Reviewed-by: Ian Elliott <ianelliott@google.com> > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: b/235523746 Bug: angleproject:7466 Change-Id: I6b88b884841c5dbc625ee7e0c52c45af09dec199 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3741027 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com>
Ian Elliott 4b745c2b 2022-07-01T01:25:36 Revert "Reland "Vulkan: Destroy DescriptorSet cache when it becomes invalid"" This reverts commit 551a26aeedbfd971d6199c8eddb433a4f4ff871c. Reason for revert: Blink test failures at: https://ci.chromium.org/ui/p/chromium/builders/ci/WebKit%20Linux%20MSAN/15546/overview Original change's description: > Reland "Vulkan: Destroy DescriptorSet cache when it becomes invalid" > > This is a reland of commit 0779ccbcd427dcb00e53afa6385fb4e8e2377993 with > the fix for angleproject:7466. When DescriptorPoolhelper gets > release/destroyed, we ensure all sharedCacheKeys are destroyed. > > Original change's description: > > Vulkan: Destroy DescriptorSet cache when it becomes invalid > > > > When a new texture descriptorSet is allocated, we store one reference of > > the cache key in ProgramExecutableVk and all TextureVks that it > > associated with. When any of the TextureVk is destroyed or its view > > destroyed, we immediately erase the descriptorSet from the cache and > > track GPU progress and free the descriptorSet when it's GPU completed. > > That way we delete the dead descriptorSet that will for sure never been > > reused ASAP so that its space is avialable for reuse. > > > > Bug: b/235523746 > > Change-Id: Ib1b9662a254eea5a3f410dc6d5d89fca6727a647 > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3700226 > > Reviewed-by: Lingfeng Yang <lfy@google.com> > > Commit-Queue: Charlie Lao <cclao@google.com> > > Reviewed-by: Ian Elliott <ianelliott@google.com> > > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > > Bug: b/235523746 > Bug: angleproject:7466 > Change-Id: I4413bec27ea0ca830010e2ca15036c2e667141c0 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3726964 > Reviewed-by: Ian Elliott <ianelliott@google.com> > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: b/235523746 Bug: angleproject:7466 Change-Id: Icdde2752c462b7ebbb51d46fd35ce749b5caf377 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3739585 Reviewed-by: Ian Elliott <ianelliott@google.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Auto-Submit: Ian Elliott <ianelliott@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
Charlie Lao 551a26ae 2022-06-10T17:55:54 Reland "Vulkan: Destroy DescriptorSet cache when it becomes invalid" This is a reland of commit 0779ccbcd427dcb00e53afa6385fb4e8e2377993 with the fix for angleproject:7466. When DescriptorPoolhelper gets release/destroyed, we ensure all sharedCacheKeys are destroyed. Original change's description: > Vulkan: Destroy DescriptorSet cache when it becomes invalid > > When a new texture descriptorSet is allocated, we store one reference of > the cache key in ProgramExecutableVk and all TextureVks that it > associated with. When any of the TextureVk is destroyed or its view > destroyed, we immediately erase the descriptorSet from the cache and > track GPU progress and free the descriptorSet when it's GPU completed. > That way we delete the dead descriptorSet that will for sure never been > reused ASAP so that its space is avialable for reuse. > > Bug: b/235523746 > Change-Id: Ib1b9662a254eea5a3f410dc6d5d89fca6727a647 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3700226 > Reviewed-by: Lingfeng Yang <lfy@google.com> > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Ian Elliott <ianelliott@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: b/235523746 Bug: angleproject:7466 Change-Id: I4413bec27ea0ca830010e2ca15036c2e667141c0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3726964 Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jose Dapena Paz 1dc3385a 2022-06-27T18:13:33 libstdc++: move FramebufferHelper to cache utils vk_helper.h includes vk_cache_utils.h. FramebufferHelper was declared in vk_helper.h. And FramebufferCache, in vk_cache_utils.h, requires FramebufferHelper for its payload hashmap. This was solved with a forward declaration. But, with std::pair definition in libstdc++ this is not enough. Bug: chromium:957519 Change-Id: I32e3e247c3c8bef8b52806aa2601e4012e6aa79e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3727671 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Yuly Novikov f8690429 2022-06-27T13:50:44 Revert "Vulkan: Destroy DescriptorSet cache when it becomes invalid" This reverts commit 0779ccbcd427dcb00e53afa6385fb4e8e2377993. Reason for revert: crashes in blink_web_tests on linux-rel https://ci.chromium.org/ui/p/chromium/builders/try/linux-rel/1051045/overview Original change's description: > Vulkan: Destroy DescriptorSet cache when it becomes invalid > > When a new texture descriptorSet is allocated, we store one reference of > the cache key in ProgramExecutableVk and all TextureVks that it > associated with. When any of the TextureVk is destroyed or its view > destroyed, we immediately erase the descriptorSet from the cache and > track GPU progress and free the descriptorSet when it's GPU completed. > That way we delete the dead descriptorSet that will for sure never been > reused ASAP so that its space is avialable for reuse. > > Bug: b/235523746 > Change-Id: Ib1b9662a254eea5a3f410dc6d5d89fca6727a647 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3700226 > Reviewed-by: Lingfeng Yang <lfy@google.com> > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Ian Elliott <ianelliott@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: b/235523746, angleproject:7466 Change-Id: I7e5067de2f2add08af1f9804cc2e952238b2e942 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3726097 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Eddie Hatfield 91976352 2022-06-21T15:41:02 Use C++17 attributes instead of custom macros Bug: angleproject:6747 Change-Id: Iad6c7cd8a18d028e01da49b647c5d01af11e0522 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3718999 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 0779ccbc 2022-06-10T17:55:54 Vulkan: Destroy DescriptorSet cache when it becomes invalid When a new texture descriptorSet is allocated, we store one reference of the cache key in ProgramExecutableVk and all TextureVks that it associated with. When any of the TextureVk is destroyed or its view destroyed, we immediately erase the descriptorSet from the cache and track GPU progress and free the descriptorSet when it's GPU completed. That way we delete the dead descriptorSet that will for sure never been reused ASAP so that its space is avialable for reuse. Bug: b/235523746 Change-Id: Ib1b9662a254eea5a3f410dc6d5d89fca6727a647 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3700226 Reviewed-by: Lingfeng Yang <lfy@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 878bbfaa 2022-06-17T11:48:14 Vulkan: Account for 2DArray textures during robust resource init Correctly handle layer count and depth when the texture type is 2Darray. Vulkan requires depth of 1 for 2Darray textures. This also reverts commit c59a22e587e63cbe9942a7f0b78681ee25084cc4. Bug: angleproject:3189 Bug: angleproject:4691 Bug: angleproject:7389 Bug: angleproject:7438 Test: DXT1CompressedTextureTestES3.CompressedTexSubImage3DValidationPerSlice*Vulkan Change-Id: Ifb3b9cabd4786dcced750e3c2db90e350d455098 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3712220 Reviewed-by: Lingfeng Yang <lfy@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Charlie Lao 72e457fe 2022-06-03T15:36:01 Vulkan: Promptly destroy cached framebuffer when it becomes invalid When Texture gets respecified, the VkFramebuffer cache created out of it becomes invalid and will never possibly get used. Before this CL, we never clear such invalid framebuffer objects from the cache. This CL keeps a reference to the cache key in each attachment and will immediately destroy the cached VkFramebuffer object when one of the attachment has become invalid. Bug: b/234769934 Change-Id: Ib01f6dffe9211084b1ada340081daf905e3f1bef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3682164 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 0bc70e96 2022-06-10T22:27:04 Vulkan: Rename getShareGroupVk to getShareGroup + other miscellaneous clean up Bug: angleproject:7375 Change-Id: I25690860478a2fd181a67ce2b6cb4d7aac7dbaa7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3700197 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mohan Maiya 8a8b9665 2022-06-08T14:54:37 Vulkan: Prune superseded staged updates in a texture Add support for pruning superseded staged updates from a client buffer to the texture. If the staged update count or the cumulative staged updates' size exceeds a threshold we check for superseded updates and prune the list. Bug: angleproject:4691 Bug: angleproject:7389 Test: Texture2DTest.InterleavedSupersedingTextureUpdates* Texture2DTest.ManySupersedingTextureUpdates* Change-Id: I4b84f13fa20004a3dc68baa552a0af656d92c0a1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3691092 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Yuxin Hu 5fbb0417 2022-05-26T15:05:52 Vulkan: Handling VK_EXT_load_store_op_none on ARM There is a bug on at least one ARM device when either depth or stencil load op is none. Add a temporary work around to avoid this case for ARM driver until angleproject:7370 is addressed. Also add a test to reproduce the deqp test failures with simiplied draw calls. Bug: angleproject:7370 Bug: angleproject:7351 Change-Id: I74ac49a75f85b1e006ed3b1d77f234f63d314ae0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3671696 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Dan Field 4b9eb4ba 2022-06-03T09:22:41 Optionally support vulkan_memory_allocator 3.x Incompatible API is guarded behind a new define, ANGLE_VMA_VERSION. This allows a soft migration for Chromium and Fuchsia, while allowing clients like Flutter to roll to a new version that is compatible with its revision of Skia. Bug: chromium:1332566 Change-Id: I68cafde13e50445aa8eea2f18203143659a1c627 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3688835 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Dan Field <dnfield@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Amirali Abdolrashidi 3b988fef 2022-06-01T10:54:03 Vulkan: Remove enableLineRasterEmulation * Removed the Bresenham line raster emulation specialization constant, along with related variables and functions. Bug: angleproject:7366 Change-Id: If17c8ce9b459ad801bae8e887e5674bd9a3ff2bf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3680860 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi a9516865 2022-06-01T22:48:04 Vulkan: Output cache look up feedback in pipeline graph Bug: angleproject:6565 Change-Id: I12bb9ab5756860de9ba26d6b4a9429a78b65df39 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3686029 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 53ec886e 2022-05-30T16:49:11 Vulkan: Externally synchronize the pipeline cache In preparation for a future change that requires this as it may perform pipeline cache merges during creation of pipelines. Bug: angleproject:5881 Change-Id: Ic7921b781aa773ae23b60a0bb6fa2111b1fc401e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3679479 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Brandon Schade eb282de0 2022-05-20T18:36:46 Vulkan: Add feature to use VK_FILTER_LINEAR for YUVConversionInfo VK_FILTER_NEAREST is default for chromaFilter in ConversionInfo. Add feature to allow VK_FILTER_LINEAR to be used instead. This feature controls the quality when sampling YUV images. Bug: angleproject:7382 Change-Id: I3f67d7620d94b5b33c42754adfef84b97c798637 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3684351 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Trevor Black <vantablack@google.com> Reviewed-by: mohan maiya <m.maiya@samsung.com> Commit-Queue: Brandon Schade <b.schade@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Faye Zhang 32a0ee92 2022-05-31T10:51:06 Code Cleanup In validationES.cpp, the framebuffer is required to have 0 depth bits (to conform to OpenGL ES 3.2 specifications). That is, ImageHelper::copyImageDataToBuffer() will not be called on a buffer with combined depth and stencil format. Replacing the lines relating to testing combined depth and stencil format ImageHelper::copyImageDataToBuffer() with an assert. Bug: angleproject:6856 Change-Id: I911500910b2065eb21c72d7f2d8ff481f4afa304 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3680862 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Faye Zhang <ffz@google.com>
Shahbaz Youssefi 28b4c378 2022-05-27T15:45:59 Vulkan: Pipeline creation feedback in perf counters Bug: angleproject:5881 Change-Id: I42917cab3c97abb50a14035972a96728dcb990b9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3672851 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Jamie Madill da30caec 2022-05-26T13:35:24 Vulkan: Switch resource tracking. CommandBufferHelpers now determine if a Resource is busy by looking at the "ResourceCommandBuffers" list in each ResourceUse. This reduces CPU overhead in the Aztec Ruins trace by up to 3%. Bug: angleproject:5664 Change-Id: I8d927af7f39db38c98d746ca4cc01f343d0df2e8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3668836 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 1ce69722 2022-05-18T13:05:22 Vulkan: Track used command buffers in ResourceUse. The list of command buffers to ResourceUse will replace tracking resources in a CommandBufferHelper. Currently the two tracking methods live side-by-side, and the old method will be removed in a future CL. Bug: angleproject:5664 Change-Id: Ia04d77e72c508e10b549db8c8dd5f0472e4edc83 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3656069 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 9f4b9c65 2022-05-18T14:39:18 Vulkan: Refactor command buffer retain calls. This removes "getResourceUseList" from the command buffers, and instead we pass around the command buffer helpers. Since future CLs will change the way we track resources, this provides for a more stable interface for tracking. Bug: angleproject:5664 Change-Id: I7118788570eaa3c0ddb6d5ef523e050ad7be00ad Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3645814 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 23f213d1 2022-05-26T23:43:44 Vulkan: Make drawable size uniform As a specialization constant, it's impossible to predict the value the drawable size may take, which in turn makes it impossible to warm up the Vulkan pipeline cache at link time. Bug: angleproject:7366 Change-Id: Ia3d1860a4fcb8e3078fdcb8d02a2e0cd173ea028 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3671976 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Antonio Caggiano 6e258863 2022-05-09T18:45:02 Vulkan: Use packed enum for present modes This will be useful for cases where ANGLE would need a non-Vulkan present mode. Bug: angleproject:7217 Change-Id: I3428ac9fb20788543cb24a0aa5f140e992e94001 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3636057 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi 8701f53a 2022-05-17T13:54:53 Vulkan: Fix clear value for incomplete MS textures * Added initializeContentsWithBlack() for the cases we wish to use opaque black. * Added stageResourceClearWithFormat(), which also takes an initial clear value. stageRobustResourceClearWithFormat() is included as a special case. Bug: angleproject:7151 Change-Id: I32d7a9af53b51499fe46d6e397301744dbf3c236 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3652995 Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 2abf9adf 2022-05-17T12:06:02 Vulkan: Bug fix in YUV descriptor pool allocation The commit d8d396dbc0c88 refactored descriptor set and pool logic but introduced a bug where it did not account for multiple immutable sampler descriptor count. Tests: Texture2DTestES3*Yuv*Vulkan Bug: b/155487768 Bug: angleproject:5033 Bug: angleproject:5773 Bug: angleproject:6141 Bug: angleproject:6776 Change-Id: I8f5d88ff829b8d0be4c73ff7aa33a76931581f1c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3652249 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Trevor Black <vantablack@google.com>
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>
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>
Jamie Madill 18089dff 2022-05-09T07:09:46 Vulkan: Clean up flag passing in ImageView init. Refactoring change only. Bug: angleproject:7269 Change-Id: I7323c3171d669a20858dc48863ee1d715bd126ec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3634719 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Charlie Lao 2b8172b9 2022-05-09T14:20:25 Vulkan: Add missing initialization for mTotalMemorySize Looks like a bad merge. Bug: b/230538246 Change-Id: I66869ebb856606dc6acd5da4e919024efe62aa79 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3635159 Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 0b0744f3 2022-05-05T16:22:28 Vulkan: Fix VVL error for black desert mobile When a depth stencil attachment is sampled in fragment shader and followed by sample from vertex shader, we are not hitting the readOnly to readOnly but with different shader stage code path. This is because IsShaderReadOnlyLayout is not counting VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL as shader read only, even though we are picking this layout for depth texture texture sampling just to avoid renderpass break when transit depth texture from read only depth attachment to shader read. Bug: angleproject:7186 Change-Id: I98c782ce85125a2ade953440145d6cc71d2c1dc1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3629953 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill e1de0950 2022-05-04T09:37:50 Vulkan: Always init image views using image format. The same format is already in the image helper. Refactoring change only, no functional change. Bug: angleproject:7269 Change-Id: Ifdd1d71045602ed41cf642ec0b3e1282fcbd6e49 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3625522 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Lingfeng Yang <lfy@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill e0d00563 2022-05-03T17:02:06 Vulkan: Simplify external format Chroma code. The prior code used a const_cast and some other twiddling when we really just needed to add a separate small setting function. Also encapsulates the YcbcrConversionDesc string into a class with private data. The end goal is to refactor image view init and caching. The const_cast and the SamplerState were getting in the way. Bug: angleproject:7269 Change-Id: Ie2fb4ba848c46adc63618f313f7a68a1df5cef8f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3625492 Reviewed-by: Trevor Black <vantablack@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
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>
Charlie Lao 2fae9482 2022-05-02T11:05:36 Vulkan: Use heuristic to decide how many empty buffers to keep Instead of rely on static information (16 max empty buffers and not been used for a given period of time), this CL keeps track of how many new buffers are needed (either reused from empty buffer list or allocated new) since last prune. We use this heuristic information to decide how many empty buffers to keep around and trim the excessive empty buffers. Combined with the next few CLs, on pixel6 I am seeing 11.7M reduction with vsync_angry_birds_2_1500. The memory_max minus memory_median reduced from 49M to 38M. Bug: b/230538246 Change-Id: I51da745afe4bfdbff0ba165418531803bdce681b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3622264 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao 802504ad 2022-04-29T20:22:53 Vulkan: Add log for buffer pool stats For debugging purpose, this will calculate stats of buffer pool and output string to log. Set ANGLE_ENABLE_BUFFER_POOL_STATS_LOGGING to 1 will log stats into INFO() stream. Bug: b/230538246 Change-Id: I68f83af547e782ca7cb6cb222967ba02b8005083 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3617229 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 3eb2bcf7 2022-04-27T16:13:04 Vulkan: Fix syncval errors with DONT_CARE for unused attachments DONT_CARE is a write operation for synchronization purposes. ANGLE doesn't synchronize depth/stencil attachments that are not written to, as it uses the read-only layout. This change makes sure LOAD/STORE_OP_NONE are used instead of DONT_CARE for attachments that are not used, even if they don't have defined contents. This allows ANGLE to continue to not do additional synchronization. Bug: angleproject:5371 Bug: angleproject:5962 Bug: angleproject:6411 Bug: angleproject:6584 Change-Id: I539379aa34f6655f00e798e8c4a5c57f40f7a12d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3612182 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@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>
Shahbaz Youssefi fcec6904 2022-04-13T14:18:06 Generate feature variable names from display names The json file now only contains the feature display name. The variable name is automaticaly derived. For consistence with Chromium and other Chromium-based projects, the display name is now always snake_case, and that's what's specified in the json files. This also makes camelCase variable name generation trivial (as opposed to the other way around). Feature overrides now accept both snake_case and camelCase names to ensure compatibility with existing scripts. This is done by removing _ and comparing override names with feature names in lower case. Bug: angleproject:6435 Change-Id: I0b6ed2bbf5c312bc4f4be7b3c7d55dbaca2a9886 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3584630 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@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>
Charlie Lao 19710088 2022-04-08T15:33:13 Vulkan: Call into vulkan directly for big size allocation. When size is big, if we go down suballocation path, we end up with big size allocation and stuck with it (because some other allocation also suballocate from it). This CL force it down to vulkan driver to allocate VkBuffer and VkDeviceMemory directly for big size allocations, bypassing suballocator. Bug: b/223428306 Change-Id: Idd9f551322331f899036f73bab0489f8249eaadf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3550039 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 957f8297 2022-04-08T15:44:55 Vulkan: Change ContextVk to Context for BufferPool APIs These APIs only needs information from Context, not ContextVk. This CL changes to Context for better encapsulation. Bug: b/223428306 Change-Id: I4f50aaa4065eff62ca32e9049f5a891d8814e511 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3578587 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Lingfeng Yang <lfy@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@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>
Shahbaz Youssefi a16491d9 2022-04-05T16:47:32 Vulkan: Fix invalidation of non-existing aspects If the app uses a stencil-only attachment but invalidates depth, UNREACHABLE was hit. If the app uses a depth-only attachment but invalidates stencil, ANGLE was proceeding with an attempt to invalidate it (with no side effect). Bug: angleproject:7178 Change-Id: Idc177bdb66b2d0b3b3c2d36f5cadc7b9126a42c4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3573383 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
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>
Mohan Maiya 078da78f 2022-03-17T13:06:58 Vulkan: Support GL_EXT_EGL_image_storage extension This extension provides a mechanism for creating texture objects that are both EGLImage targets and immutable and removes the possibility of implicit orphaning. EGL images created from external sources now support types other than 2D. Tests covering the new feature were added to ImageTest.cpp. Bug: angleproject:6346 Change-Id: Id3e328f352deb1af47062be232384229a8b1c341 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3530489 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Shahbaz Youssefi 2d54b68e 2022-03-22T17:32:06 Vulkan: Use storeOp=None more opportunistically Previously, storeOp=None was used when the attachment was in "read-only mode" and storeOp=Store. With this change, storeOp=None is used more opportunistically when it's deemed that the attachment was not written to, regardless of if it was put in "read-only mode" (a construct added to support read-only depth/stencil feedback loops). Bug: angleproject:5048 Change-Id: I10832d4e2b97793ea1347a47175cbf8ce9af57d6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3556368 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Cody Northrop ce964d66 2022-03-26T18:56:50 Vulkan: Add tessellation to GetPipelineStage helper The tessellation stages were missing from a helper, which was silently returning an invalid value. Add a test and an assert, which fires before the fix. Test: GFXBench Car Chase Test: GLSLTest_ES31.TessellationTextureBufferAccess Bug: angleproject:7135 Bug: b/218314686 Change-Id: I2bc8d374300fc1470e52affabab7491698c99cee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3554575 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Cody Northrop <cnorthrop@google.com>
Steven Noonan a02fa8a0 2022-03-24T22:14:44 Vulkan: mark image contents defined on clear-invalidate-clear The backend was ignoring "repeated clears" with an Invalidate between them, which marked the image contents as undefined. When a clear happens after invalidate, verify that the clear parameters were the same, and simply mark the image contents defined if they aren't already. For example, in this scenario: - glBindFramebuffer(fbo) - glInvalidateFramebuffer(color + depth) - glClear(color + depth) - depth only render - glInvalidateFramebuffer(depth) - glBindFramebuffer(0) The color clear got skipped entirely because it was cleared with that color in a previous frame and no other color draws happened since. This caused sampling from the FBO's texture to return garbage data. Bug: angleproject:7127 Change-Id: I4ffe65c67375931ab63f07f27fa59ed0a4b90cd9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3551297 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
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>
Shahbaz Youssefi 20e7bbb7 2022-03-18T17:03:18 Vulkan: Fix invalidate of attachments with emulated format Some image formats may be emulated such that the emulated format has more channels than the original. ANGLE clears the image once so that these extra channels contain valid values, and carefully ensures they are never modified. For swapchain images with such formats, as they are automatically invalidated at the end of the frame, a workaroud was added to make sure they are re-cleared in the beginning of the next frame. This however doesn't fix the issue of glInvalidateFramebuffer resulting in the contents of attachments with such formats to be discarded (even if the following render pass clears it, the contents are invalid in between). This change instead makes sure invalidate of images with emulated formats that have extra channels are handled appropriately: - On IMR hardware, the invalidate is dropped altogether as it provides little to no benefit. - On TBR hardware, a clear is automatically staged on the invalidated image. The latter replaces the workaround that was added to make the following render pass use loadOp=CLEAR, by adding a clear that's respected regardless of what the future usage is. This change also paves the way for a future change where the invalidate of color attachments is tracked in render passes similarly to how depth/stencil currently is. With this change, the image is no longer in an inconsistent state where its contents are considered invalid, even though some channels are meant to remain valid. Bug: angleproject:6860 Change-Id: Iec5b4854dfbe3a0bf93cd5aa82c19fe116065744 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3536389 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@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>
Shahbaz Youssefi b74d6768 2022-03-17T16:48:21 Vulkan: Refactor D/S usage tracking in render pass This is in preparation for doing the same for color images. That is in turn in preparation for optimizing mid-render-pass clears, which require an answer to the following query: "has this color image been read from / written to so far in the render pass?" Bug: angleproject:5048 Change-Id: I8abe97919897b8fbf644482071bf7326ca3325d6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3533143 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
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>
Charlie Lao fe4fa1cb 2022-03-08T11:10:16 Vulkan: Tune pruneEmptyBuffers() to be a bit more aggressive Right now we check every second and if we find a buffer is empty and remains empty for 4 checks, we free the buffer. This means we may keep peak memory usage for 4 seconds. This CL reduces the check to 1/4 seconds, so that a buffer will gets freed if not used for 1 second. Also added a threshold to keep maximum count of empty buffers to 16. This CL also optimizes pruneEmptyBuffers() function to avoid erase calls on each empty buffer block. We set the pointer to null as we free the empty buffer and a new loop is added at the end to remove all null elements at once. Bug: b/223428306 Change-Id: Iff93d6eb404ca22399b26c7adb7efe5c4b87270d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3511311 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Jamie Madill ea70300b 2022-03-01T14:55:00 Fix base level changes not updating FBO completeness check. Bug: chromium:1299264 Change-Id: I0881a4916c3eeb9ee023d28d207795899417d530 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3498282 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Auto-Submit: Jamie Madill <jmadill@chromium.org>
Charlie Lao 36ce2646 2022-03-04T11:37:08 Vulkan: Align the size before calling into VMA's allocator The size we saved in BufferSuballocation object may used for vkFlushMappedMemory() call. This will ensure that we save the aligned size to avoid VVL error for unaligned size in that flush call. bug: b/219974369 Change-Id: Iccf3199f43cd346dab80083d5494fbaeee39948f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3504000 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Charlie Lao <cclao@google.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>
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>
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 1315bc81 2022-02-09T11:25:58 Vulkan: Refactor DynamicBuffer::allocate. Reduces duplicate code by re-using allocateFromCurrentBuffer. Bug: angleproject:6980 Change-Id: I3f1126a53136be8f68a3a79008dd9adae45c86b8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3449279 Reviewed-by: Charlie Lao <cclao@google.com> 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>
Lubosz Sarnecki b1075951 2022-02-09T17:35:56 vk_helpers: Adjust CopyImageToBuffer extent to block size. When using readPixels with compressed formats, the VkBufferImageCopy bufferRowLength and bufferImageHeight need to be a multiple of the block size. This prevents the following Vk validation errors: VUID-vkCmdCopyImageToBuffer-bufferRowLength-00203 VUID-vkCmdCopyImageToBuffer-bufferImageHeight-00204 Add tests with texture sizes that are not multiple of block size. Test: angle_end2end_tests --gtest_filter="GetImageTest.CompressedTexImageNotBlockMultiple*" Test: angle_end2end_tests --gtest_filter="GetImageTest.CompressedTexImageCubeMap*" Test: angle_end2end_tests --gtest_filter="GetImageTestES32.CompressedTexImageCubeMapArray*" Bug: angleproject:6177 Change-Id: I34c788efece285753857500801e88abeaa6a8a78 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3452111 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
Lubosz Sarnecki bdedf146 2022-01-14T13:35:30 TextureVk: Implement getCompressedTexImage. Extend ImageHelper::readPixels to support compressed formats. Implement readPixelsForCompressedGetImage. Add compression tests to GetImageTest. Implement CaptureGetCompressedTexImageANGLE_pixels in capture_gles_ext_params. Test: angle_end2end_tests --gtest_filter="GetImageTest*.CompressedTexImage*" Bug: angleproject:6177 Change-Id: I6e5b6d746b9c6cc9b885fa44f75a985660d8fb58 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3452110 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Lubosz Sarnecki <lubosz.sarnecki@collabora.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>
Charlie Lao f7f26956 2022-02-10T13:33:32 Vulkan: Fix two bugs exposed by moving mEmptyBuffer to suballocation There are two bugs exposed when I try to switch mEmptyBuffer to use suballocation. 1) BufferHelper::initializeNonZeroMemory() for device local memory uses GPU to do zero fill, but it is missing an vkEndCommandBuffer call. 2) glTexSubImage2D call try to pick glCopyuBufferToImage code path and we are not checking against pixel format. Vulkan spec requires offset must be number of pixel size and we are using "4" for pixel size which does not work for RGB format. Bug: b/205337962 Change-Id: Ibca6a60ebd6afc5e2bca07b9cc6a43ebdd240f15 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3449348 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 419bca3f 2022-01-19T18:22:56 Vulkan: Use Vulkan API directly for BufferPool's buffer allocation There are two motivations in this CL. 1) There are two layers of suballocator right now. BufferPool provides first suballocation. It tries to allocate from one of the buffers in the pool. If that failed, it try to create a new BufferBlock (i.e, a VkBuffer). Right now that calls into VMA which creates another pool to allocate a buffer. We really only need one layer of suballocation. And 2) Because we uses VMA to do actual VkBuffer allocation, we have to use Allocator object. But VMA can not handle external buffers, so we end up having a BufferMemory class just to handle two different cases. This CL attempts to clean up this by let ANGLE calling into vulkan driver directly for the actual buffer allocation, just like we did for VkImages. By doing so, we able to remove BufferHelper::mMemory data member as well as BufferMemory class all together. External memory is now treated exactly the same at BufferHelper. Bug: b/205337962 Change-Id: I7c183ab0fd7d9aceb6cf416b0214c300798bc010 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3402740 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Steven Noonan 734365a7 2022-01-27T06:05:56 Vulkan: improve command buffer reset performance When trying to profile why a game's framerate was decreasing over time, I found that memset() was taking the most self time out of any function in the process. The top two callers of memset() were: RenderPassCommandBufferHelper::reset OutsideRenderPassCommandBufferHelper::flushToPrimary Profiling specifically called out mUsedBuffers.clear() and mRenderPassUsedImages.clear() as being the worst offending lines. The problem is that FastIntegerSet (and by proxy, FastIntegerMap, where FastIntegerSet manages the keys) perform best when all keys are close to zero. With large key values (in this case, large image and buffer serials), significantly more memory gets allocated, causing mUsedBuffers.clear() and mRenderPassUsedImages.clear() during command buffer reset to take more and more time the longer the process runs. This change is essentially a partial revert of f9a062c9754. Bug: angleproject:6954 Change-Id: Id2542f6425f0845fe81d393ecf6b614b474c53c8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3420925 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: mohan maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@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>
Mohan Maiya f65e7c3c 2022-02-02T14:23:31 Vulkan: Take base level into account in image views Similarly to how max level changes are handled, this change also handles base level changes. In either case, the old views are retained and new views are created for the [base, max] level range. Test provided by m.maiya@samsung.com Bug: angleproject:6967 Test: MipmapTestES31.UpdateBaseLevel/* Change-Id: Iee8b2f035c1cc0fa916b987a91939b8ae65d27c5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3441074 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@google.com>
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>
Charlie Lao bc3be5a8 2022-01-27T12:12:58 Vulkan: Add a dedicated suballocation garbage list Suballocations are the most common garbage objects in most usage cases. The current garbage collection code will construct a garbage object from suballocation and then construct a SharedGarbage object with a std::vector that holds only one element. And then it adds this SharedGarbage to the garbage list. This CL tries to avoid create std::vector with just one element and avoid the cost of switch statement for each garbage object by adding a new dedicated garbage list that only holds the suballocation garbages, which is the most common garbages in the system. With gardenscapes running offscreen with --minimum-gpu-work, it reduces CPU overhead from 2.55ms to 2.20ms on Pixel6. Bug: b/215768827 Change-Id: Ia2872442462917c0caadb263769a1cbf3dd7366f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3414356 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Jamie Madill 945a09d1 2022-01-30T13:57:32 Vulkan: Fix off-by-one in DynamicBuffer. allocateFromCurrentBuffer was using >= when it should have been using >. This prevented filling a buffer to the exact maximum. Bug: angleproject:6776 Change-Id: I9656e398080381f97d06912ff10fe62e7e7333ac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3426882 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
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>
Charlie Lao 701d51b1 2022-01-25T15:44:39 Vulkan: Add SmallBufferPool for small allocations The small pool uses buddy algorithm that is much faster. The only downside is that it rounds size to power of two. For small allocations that rounding does not generate much waste and avoid fragmentation as well. This CL adds a small pool for host visible non-coherent pool. My testing with gardenscape shows that on top of other CLs, this reduces CPU overhead from 1.77ms to 1.55ms as measured with --minimize-gpu-work with offscreen. Bug: b/215768827 Change-Id: I68434931f238c4e980b77d3df46d762260ef1db5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3415211 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Jeff Vigil d6dd0cb5 2021-09-21T15:26:13 EGL: EGL_KHR_lock_surface3 backend Add vulkan implementation Add test: EGLLockSurface3Test Test: angle_end2end_test --gtest_filter=EGLLockSurface3Test Bug: angleproject:6062 Change-Id: Id5bfe37895b550392d11e9e9cc1262c1f0288c42 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3174323 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao d2354968 2022-01-20T10:59:05 Vulkan: Rename BufferHelper::initFor* to allocateFor* Simply name change per feedback from other CL's review. Bug: b/205337962 Change-Id: Ieb53ed9a2922d09716a1219eb340fe273e5f1807 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3402882 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 1b5efe51 2022-01-19T14:04:35 Vulkan: Rename SubAllocation to Suballocation Simply a name change to make it one word. No functional change is expected. Bug: b/205337962 Change-Id: Ic505536821f18141c0d036b13d9aa81554a8bafd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3403158 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 15439f8e 2022-01-13T14:58:41 Vulkan: Remove BufferMemoryAllocator This class was added in crrev.com/c/3036256. The original intention was to use VMA to implement buffer suballocation. Because VMA itself does not support buffer suballocation, I was thinking to use VMA custom pool to implement it and this class was intended to wrap all these functionality into one class. But now thanks to Jamie's effort, VMA exported generic suballocation algorithm via API and we have implemented buffer suballocation using that virtual allocation API. So this BufferMemoryAllocator class is really no longer useful. This CL mostly reverted that CL and flatten out the buffer allocation call to directly use VMA's Allocator object. Bug: b/205337962 Change-Id: I0336056e440f39e2ff49fee8e0ff4b1f355cefe4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3244022 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@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 caf6433a 2022-01-04T14:37:29 Vulkan: Rename releaseStagingBuffer to releaseStagedUpdate There is no more per ImageHelper dynamic buffer for staging, and this function is not just removing staging buffer, but removing all staged updates. Rename it to reflect what it actually does. Bug: b/208323792 Change-Id: I5a2182291848a9e137ed29b888f31215664b46fd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3367078 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 93159c02 2021-12-30T16:01:52 Vulkan: Remove DynamicShadowBuffer implementation This is no longer used since mShadowBuffer was removed from BufferVk in https://chromium-review.googlesource.com/c/angle/angle/+/3313333 Bug: b/208323792 Change-Id: I0bb1d66c2f0f58bac74139a274c957681edf2ad4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3362504 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 3263eb01 2021-12-28T10:10:50 Vulkan: Switch GPU translated vertex buffer to NonHostVisible When we translate using GPU, there is no need to use host visible memory. Use device local memory instead. Bug: b/205337962 Change-Id: Ic76dcb28bde2f079f6ac406d846518bf5f369d74 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3340553 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
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 6da1ac81 2021-12-22T10:13:43 Vulkan: Switch ReadPixels from DynamicBuffer to shared pool FramebufferVk::readPixelsImpl() and ImageHelper::copyImageDataToBuffer() use per FramebufferVk DynamicBuffer. This CL removes this and uses shared buffer pool to allocate a temporary staging buffer for readPixels as needed and frees it immediately afterwards. Bug: b/208323792 Change-Id: I65ddf9bf9f1f14578d9def63f5287cb1a4121dff Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3354038 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> 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>
Tim Van Patten fd014271 2021-12-16T20:44:42 Vulkan: Match chromaFilter to min/mag for YUV AHBs From the VVL: VUID-VkSamplerCreateInfo-minFilter VkCreateSampler: VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT specifies that the format can have different chroma, min, and mag filters. However, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT is not supported for VkSamplerYcbcrConversionCreateInfo.format = VK_FORMAT_UNDEFINED so chromaFilter needs to be equal to minFilter/magFilter. We don't know what the min/mag filters are when the AHB is imported, so we need to update the YcbcrConversionDesc with the current min/mag filter value before creating the VkSamplerYcbcrConversion when the ImageView is created. Additionally, if the min/mag filters are updated later, TextureVk::syncState() needs to recreate the ImageViews to ensure the chromaFilter matches the new min/magFilters. Test: atest android.media.cts.DecodeAccuracyTest#testGLViewDecodeAccuracy[0] Test: ImageTestES3.SourceYUVAHBTargetExternalYUVSampleLinearFiltering Bug: b/210526871 Change-Id: I95dbd9738f6e3fd0870e484518eee105e995f93a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3346394 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Charlie Lao 0e49a3dd 2022-01-04T11:23:54 Vulkan: Add std::move support for BufferHelper There are needs to support std::move for BufferHelpers in other CLs (See crrev.com/c/3352489). Without this support, we can not store BufferHelper into std::vector. This CL adds move support for BufferHelper class. Bug: b/208323792 Change-Id: I93f79490715750abc1bcedd41b683ad0c2460ebb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3366855 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>