src/libANGLE/renderer/vulkan/vk_helpers.cpp


Log

Author Commit Date CI Message
Jamie Madill 68a5baeb 2020-09-23T22:13:03 Revert "Vulkan: Implement a SharedResourceUse pool" This reverts commit de335c16855f11d1f0a6f0b37bee30c8a09a6c1d. Reason for revert: Might actually regress CPU overhead perf. Unsure but it's possible the reported perf improvement was due to variance. Original change's description: > Vulkan: Implement a SharedResourceUse pool > > When adding a Resource to the ResourceUseList of ContextVk > we constructed a new SharedResourceUse object for tracking > and update of the Resource's Serial. We would then delete > it after releasing the resource. This incurs repeated > memory operation costs. > > Instead we now allocate a pool of SharedResourceUse objects > and acquire and release from this pool as needed. > > VTune profile of the Manhattan 30 offscreen benchmark > shows the CPU occupancy of bufferRead decrease from an > average of 0.9% -> 0.6% and imageRead decreases from > an average of 0.4% -> 0.3%. The bottleneck for both > these methods is the retain() method that leverages > the new SharedResourceUse pool. > > Bug: angleproject:4950 > Change-Id: Ib4f67c6f101d4b2de118014546e6cc14ad108703 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2396597 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> TBR=syoussefi@chromium.org,jmadill@chromium.org,m.maiya@samsung.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: angleproject:4950 Change-Id: I40081551c3db67d6e55182fea40119946ed16ac3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2426479 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Brandon Schade cd83b608 2020-09-18T14:54:54 Use ImageHelper staging buffers for copyImageDataToBuffer Revert change from using context staging buffers for copyImageDataToBuffer. There are scenarios where the staging buffer will become invalid before flushing the staged update. Added a test for this case. Bug: angleproject:5092 Test: angle_end2end_tests --gtest_filter=*ETC1CompressedImageDraws* Change-Id: I41c457fda919938600c20336f65836952d73748a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2425250 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Brandon Schade 6c394220 2020-09-09T18:55:48 Vulkan: Fix bug in compressed texel block computation When performing a staged update to compressed images, ensure that the bufferRowLength and bufferImageHeight is a multiple of the compressed texel block Bug: angleproject:5017 Test: angle_end2end_test --gtest_filter=*ETC1CompressedImageNPOT* Change-Id: I54327ec610d1050465d112c7eff385d19dc0c390 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2393754 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Tim Van Patten ed899835 2020-09-11T21:21:55 Vulkan: Allocate descriptor pools with layouts Descriptor set layouts and pools are very tightly coupled, since their binding types and counts must match to ensure the number of available descriptor sets within a pool remains accurate. To enforce this, the descriptor pools will now keep a copy of the VkDescriptorSetLayout that the pool was created for, which is verified when a descriptor set is allocated from the pool. If the handles don't match, an ASSERT() will fire. Bug: angleproject:5033 Test: CQ Change-Id: I4faf82c24f31052e57b656c968788bb0c131b619 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2407282 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Ian Elliott a7e03ed7 2020-09-21T14:56:00 Vulkan: Further refine invalidate for depth/stencil Bug: angleproject:5079 Change-Id: Idc732b1e6729b2776d66c63c3ae2bd94e11bdbb5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2422684 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Ian Elliott <ianelliott@google.com>
Mohan Maiya de335c16 2020-09-14T12:04:20 Vulkan: Implement a SharedResourceUse pool When adding a Resource to the ResourceUseList of ContextVk we constructed a new SharedResourceUse object for tracking and update of the Resource's Serial. We would then delete it after releasing the resource. This incurs repeated memory operation costs. Instead we now allocate a pool of SharedResourceUse objects and acquire and release from this pool as needed. VTune profile of the Manhattan 30 offscreen benchmark shows the CPU occupancy of bufferRead decrease from an average of 0.9% -> 0.6% and imageRead decreases from an average of 0.4% -> 0.3%. The bottleneck for both these methods is the retain() method that leverages the new SharedResourceUse pool. Bug: angleproject:4950 Change-Id: Ib4f67c6f101d4b2de118014546e6cc14ad108703 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2396597 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Jamie Madill 357caadb 2020-09-16T21:44:56 Vulkan: Optimize Attribute Change Perf (2/5) This patch series optimizes programs that use the pattern: for (;;) { glVertexAttribPointer(...) glDraw(...) } Change 2: Micro-optimize XFB resume CPU overhead. We don't need to set resume on every new command buffer. We only need to set the dirty bit when we have an unexpected pause. In total the patch series reduces test iteration time by 25%. Test: DrawCallPerfBenchmark.Run/vulkan_attrib_change Bug: angleproject:5045 Bug: b/168493024 Change-Id: I8f6c68ff0513be4f405276e395d80bc1a185a061 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2409174 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 37457d08 2020-09-15T14:38:53 Vulkan: Support MSRTT color renderbuffers Color renderbuffers are similar to multisampled-render-to-texture textures, but much simpler. The same mechanism is used to implement them. Bug: angleproject:4836 Change-Id: I298529c9fd1b03e78b1e37cdbe595e66166ee130 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2412847 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Tim Van Patten f12e4123 2020-08-25T12:01:12 Vulkan: Match descriptor pool sizes to descriptor set layouts When a descriptor pool is created, a list of descriptor types and counts are given to vkCreateDescriptorPool(). Later, when allocating a descriptor set from the pool, we pass along a descriptor set layout to vkAllocateDescriptorSets() which is used to determine how many of each type of descriptor (i.e. binding) to allocate from the pool. In order for our "free descriptor set" counts to be accurate for each pool, the descriptor pools need to be created with descriptor counts that match the descriptor set layout binding counts. This change fixes a bug where the descriptor set layouts were created with more bindings than the descriptor pool sizes, causing the "free descriptor set" count to be inaccurate, leading to allocating too many descriptor sets from a pool. Bug: angleproject:3570 Test: VulkanDescriptorSetTest Change-Id: I660bf02d29a1291391fb15f39e6479bf348d0f83 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2391114 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 22d30378 2020-09-15T23:19:48 Vulkan: Change VK suffix to Vk For consistency with the rest of the backend. Level index variables were using the VK suffix while color index variables used Vk. Bug: angleproject:4881 Change-Id: I0c2799da34cdfe19cb04adbebba042ac8876af96 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2413155 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao 06b4fb92 2020-09-11T21:24:46 Vulkan: Fool proof packed attachment index to vulkan and from OpenGL ANGLE packs FBO attachments from OpenGL and uses packed attachments to create VkFramebuffer and renderpass. When we use attachment index into the attachment array, we must be very careful to use packed index for vulkan objects. It is easy to make mistakes here and introduce hard to debug bugs. This CL defines a PackedAttachmentIndex class that uses that to index into vulkan attachments and pass around APIs so that compiler would catch the error when wrong index is used. This also introduces PackedClearValuesArray that stores clear value in packed attachment index so that it is impossible to mix it with ClearValuesArray that stores clear value in GL attachment index. Bug: b/167301719 Change-Id: I68680522c60beeb5096e5211eaef89da28c7097e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2410366 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 7870cf3f 2020-09-10T17:30:13 Vulkan: Fix RAW hazard with storage images Semantic revert of 78304b470 and 7bce5194d. 7bce5194d assumed that a read transition between same layouts is a noop, but that's not true if said layout is GENERAL. This is only possible if an image is simultaneously bound as storage and sampled image. This bug was discovered by the new syncval VVL warning. Bug: b/156661359 Change-Id: I05f94160ca1b05b715701564e27fccee31a8aa45 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2404742 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Courtney Goeltzenleuchter ef315fdc 2020-09-10T14:56:35 Vulkan: Use current commandBuffer pointer We were using a passed in commandBuffer in ImageHelper::flushStagedUpdates which became invalid during the process of handling the flush upon which subsequent uses could cause problems when threading is enabled (and maybe when it's not as well, just harder to see.) Have ImageHelper::flushStagedUpdates use the current OutsideRenderPassCommandBuffer and the code will use the proper one. Bug: b/168144059 Change-Id: Ib9849efe9366cf61df5e68fd25d17df165dbd3a0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2402354 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
Jose Dapena Paz cee57483 2020-09-09T18:18:07 GCC: init kImageMemoryBarrierData with initializer constructor GCC fails to automatically map the initializer assignment for initializing the angle::PackedEnumMap. So this change adds the type hint ImageMemoryBarrierData to the second part of the pairs passed to construct the PackedEnumMap. GCC error: ./../third_party/angle/src/libANGLE/renderer/vulkan/vk_helpers.cpp:387:1: error: could not convert ‘{{rx::vk::ImageLayout::Undefined, {"Undefined", ...}}}’ from ‘<brace-enclosed initializer list>’ to ‘const angle::PackedEnumMap<rx::vk::ImageLayout, rx::vk::{anonymous}::ImageMemoryBarrierData>’ 387 | }; | ^ | | | <brace-enclosed initializer list> Bug: chromium:819294 Change-Id: I314c43c0795e54cabd891205ee935c6354d11658 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2401778 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Ian Elliott 4a41204d 2020-09-02T05:04:33 Vulkan: Improve invalidate for depth/stencil Improve state tracking when the depth and/or stencil attachments are invalidated. Since no draw-time tracking is done, we use the number of command-buffer commands to determine when an attachment is drawn to. That allows all cases to be handled for store ops. Still need to handle mContentDefined at endRP time (we have the data, just not the plumbing). Test: angle_white_box_tests --gtest_filter=VulkanPerformanceCounterTest.*Invalidate*/* Test: angle_deqp_gles3_tests --gtest_filter=dEQP.GLES3/functional_fbo_invalidate_* --use-angle=vulkan Bug: b/167276207 Change-Id: Iae10857dbb4d43b934c51ad7e400b71ae0db4f55 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2378670 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
Charlie Lao c0dda021 2020-08-26T11:20:06 Vulkan: release the ImageHelper's staging buffer after flush For mutable textures, right now glTexImage call and some of other cases, we are still using the ImageHelper's staging buffer. This will release the staging buffer after flush to reduce memory footprint. Bug: b/164511310 Change-Id: Ie1e52865a1c3a8f235c88331c4bb83c50d3f04da Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2378179 Reviewed-by: back sept 10 - Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi a0d048a4 2020-08-27T12:03:02 Vulkan: Fool-proof usage of GL and VK level indices Using boxed types, this change allows the compiler to catch errors when a level index in one space (e.g. GL) is mistakenly used in another space (e.g. VK). This change uncovered a number of bugs due to such mistakes which are fixed. Mistakes are still possible when the index is explicitly extracted, for example to be given to a Vulkan command, or when it's created, for example when retrieved from gl::ImageIndex::getLevelIndex. Future work can include using gl::LevelIndex in gl::ImageIndex directly to alleviate the latter at least. Bug: angleproject:4880 Change-Id: I6427c68c3bc096f771402f51c8554d8171758aa9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2380232 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Jamie Madill b4efc051 2020-08-28T14:45:18 Enable -Wdeprecated-copy. This is another warning turned on in Skia. It enforces an explicit copy assignment operator in some implicitly-generated cases. It caught one potential error in SubresourceUpdate. Bug: skia:7647 Change-Id: Ia501f619cf7f3d2e8647cdbbda2936f51f9721ba Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2381953 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Charlie Lao fbafb46c 2020-08-26T10:56:33 Vulkan: Use context staging buffer for CopyTexSubImage This will avoid allocate staging buffer if there isn't one already. Bug: b/164511310 Change-Id: Ieb5ef12fa58c52c0a62276cab6de135fdd62780c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2377121 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Charlie Lao 5ac807b2 2020-08-26T10:18:00 Vulkan: Let stageSubresourceUpdateAndGetData use ctx staging buffer stageSubresourceUpdateAndGetData call are made and then flush the commands out, so they could just switch to use context's staging buffer instead of use per object's staging buffer. Bug: b/164511310 Change-Id: Iff7944a37073bb3641498e334847f599903858b1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2376895 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao 9e544a84 2020-08-24T18:37:59 Vulkan: Fix alignment issue with context staging buffer Context's staging buffer is shared for all kind of usages. We should pass in alignment requirement for allocate call whenever it is different from the default alignment. This adds allocateWithAlignment call to DynamicBuffer call and switch ImgeHelper's usage of it to allocateWithAlignment Bug: b/164511310 Change-Id: Idcb6b6f95d6862ee6cb8fca9c164910b7e085a17 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2373590 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Courtney Goeltzenleuchter a08495d9 2020-08-27T13:47:19 Revert "Vulkan: restore mContentDefined at endRP()" This reverts commit 53ee431e3d36692cbe50a96ebbf0ff898ec4d523. Bug: chromium:1122621 Change-Id: Ifd63aa0694e00ed6ef74b385466b874604355e79 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2380610 Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
Shahbaz Youssefi 68c8ed7a 2020-08-25T22:16:17 Vulkan: More perf warnings Perf warnings added in the CPU path for unpack buffers, as well as CPU readback of images. Bug: angleproject:3461 Bug: angleproject:4900 Change-Id: I0f716a1ea6110ba8e779903a7d5913d5f6df0ce9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2376905 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Ian Elliott 1ea22c31 2020-08-25T20:55:54 Vulkan: Fix TRex performance regression TRex invalidates depth but doesn't disable depth before the render pass ends. The render pass isn't ended, but a storeOp of STORE was used instead of DONT_CARE, which causes a performance regression. Bug: b/163854287 Change-Id: Iebd9999ef66c11ff334db3eef2943f58eb2d5053 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2377105 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
Jamie Madill c5b9c49c 2020-08-25T18:01:29 Vulkan: Fix optimizeRenderPassForPresent regression. gfxbench clears the depth buffer right before the swap. Even though the last draw call that presents the frame didn't ever read or write to depth, the tracking we added thought this depth write meant we had to keep the LOAD_OP as CLEAR. Instead we can refine our check to treat clears specially when enabling the depth-stencil read-only mode instead of changing how the tracking works for clears. This way the tracking can not affect other apps that don't use depth-stencil read-only loops. Also adds a regression test that counts the clears after a swap. Bug: angleproject:4959 Bug: angleproject:4979 Change-Id: I12ece6474019f7519a467f827110ad817f7d4df7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2370364 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Ian Elliott 53ee431e 2020-08-21T12:40:03 Vulkan: restore mContentDefined at endRP() CommandBufferHelper will keep a pointer to the depth-stencil RenderTargetVk, and use this to set RenderTargetVk::mContentDefined to true at the end of a render pass. Test: angle_white_box_tests --gtest_filter=VulkanPerformanceCounterTest.InvalidatingAndUsingDepthDoesNotBreakRenderPass/* Test: angle_deqp_gles3_tests --gtest_filter=dEQP.GLES3/functional_fbo_invalidate_* --use-angle=vulkan Bug: b/163854287 Change-Id: I891381825ee01e141dfa4f9099d07d9ffc943f77 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2368194 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
Shahbaz Youssefi 295d2ccd 2020-08-24T14:46:31 Vulkan: Generate perf warnings on suboptimal paths Using KHR_debug features, this change creates a performance-warning-generation macro and employs it in a handful of locations to provide useful feedback to application developers. The warnings added in this change are not exhaustive. Bug: angleproject:3461 Bug: angleproject:4900 Change-Id: Id62435d170d90c5be9c1c5cab2d6779ccb58345e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2372628 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 78304b47 2020-08-23T00:39:28 Vulkan: Remove BarrierType This was only used for one ASSERT, which is changed to use a correlated variable. Bug: angleproject:4959 Change-Id: I0eccd2c06c52fcfbff4c533e661735bf1213125d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2371222 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 7bce5194 2020-08-22T23:52:51 Vulkan: Simplify image read barrier necessity check RAW hazards were being tested for if the layouts were identical, but that's impossible. Bug: angleproject:4911 Change-Id: I73f568b1df2cbffe943217e19b115561e48a56c9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2370862 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Mohan Maiya f9a062c9 2020-08-16T14:09:41 Vulkan: Add FastIntegerSet and FastIntegerMap class Add FastIntegerSet container to enable fast contains operation for a set of integer keys. The class uses a BitSet vector to achieve performance. Add FastIntegerMap container to improve buffer serial tracking performance. FastIntegerMap uses FastIntegerSet container to track buffer serial keys. It also provides an ensureCapacity method to reserve space, for the expected buffer count, upfront. CommandBufferHelper::mUsedBuffers and ContextVk::descriptorSetCache are now FastIntegerMap CommandBufferHelper::mRenderPassUsedImages is now a FastIntegerSet Based on a CL by Jamie Bug: angleproject:4950 Test: angle_unittests.exe --gtest_filter=FastInteger* Change-Id: Ib58be20143f588baab99acadac796f2435f72d54 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2369466 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Charlie Lao 1d331c91 2020-08-19T10:30:14 Vulkan: Use context staging buffer for copyImageDataToBuffer ImageHelper::copyImageDataToBuffer() is called from glCopyTexture*. It allocate staging buffer and write the copy command into command buffer right away. This uses context staging buffer instead of ImageHelper's staging buffer. This has the benefit of able to share staging buffer with other objects (including buffers etc). Bug: b/164511310 Change-Id: I3f680b1cd95df172a442aac573a8cc8d48972b1b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2364717 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Ian Elliott 296d3bfd 2020-08-21T10:38:32 Vulkan: do not end render pass when invalidating Initially, FramebufferVk::invalidateImpl() was very conservative and always ended a render pass (if the framebuffer is part of the current render pass). This adversely affects PUBG Mobile, which invalidates the depth buffer every frame, causing the render pass to be split. Test: PUBG MOBILE on Android Test: angle_white_box_tests --gtest_filter=VulkanPerformanceCounterTest.InvalidatingAndUsingDepthDoesNotBreakRenderPass/* Test: angle_deqp_gles3_tests --gtest_filter=dEQP.GLES3/functional_fbo_invalidate_* --use-angle=vulkan Bug: b/163854287 Change-Id: I343dee1db3ebaf039ff92557f9ef25b24bcdcc93 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2352627 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
Jamie Madill d3e800e9 2020-08-15T17:26:04 Vulkan: Restart RenderPasses in DS read-only mode. We can combine an initial RenderPass with a read-only RP if the first RP never writes to depth. We can check the depth-write tracking in CommandBufferHelper and substitute in a new Framebuffer/RP Desc in this case as well as issue new layout barriers. We need to disable barrier merging in this special case. This reduces the RenderPass count in the Manhattan trace from 15->13. The performance on the Pixel 4 benchmark goes to ~82% of native for the on-screen version and ~88% for off-screen. There's also a ~5% bump in speed for the desktop trace. Bug: angleproject:4959 Change-Id: I70241824f75eaa1e11b50370f826abc36e91686e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2358772 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Charlie Lao 552f0f76 2020-08-14T16:37:03 Vulkan: Use context staging buffer for immutable texture update This uses context's staging buffer for immutable texture TextureVk::setSubImageImpl call and flushes update right away. Bug: b/164511310 Change-Id: I04fee0a9afe0e84617a461fb6cd7137e853adf8b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2357971 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill e689d316 2020-08-14T22:51:03 Vulkan: Don't end RenderPass on DS feedback loops. Instead of always switching the Framebuffer to mask out depth/stencil loops we now switch the RenderPass to a "read-only" depth/stencil mode. Reduces the RenderPass count in Manhattan from 18->15. There are still a couple extra RenderPasses inserted that we can get rid. We can merge a few RenderPasses by retroactively changing a started RenderPass to "read-only" when there are no prior recorded depth writes or clears. Also adds a test to count the number of RenderPasses ANGLE generates in DS feedback loop situaions. Bug: angleproject:4959 Change-Id: I1855a45959655fc27ccd47a3469c1c672fc8fd9e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2357973 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Tim Van Patten dff47d5f 2020-07-14T19:10:12 Vulkan: Optimize MSAA using subpass resolve attachments If a user is performing a blit to resolve a multisample color buffer into a single attachment, ANGLE can use subpass resolve attachments to resolve directly into the destination buffer as part of the render pass. This allows the data to remain in tiler memory and reduce the extra bandwidth required to write the multisampled data back to perform the copy. This work also requires restoring/reopening a render pass if it has been finished already, assuming the finished render pass was started and for the framebuffer that is the source for the blit command. Other objects that were created when the render pass was started need to be updated as well, such as the source FramebufferVk's resolve attachment, the CommandBufferHelper's vk::Framebuffer and vk::RenderPassDesc, etc. While this is better than performing vkCmdResolveImage(), there is still another major part of optimizing MSAA using resolve attachments not implemented here: discarding the multisampled image rather than writing it to GMEM, which requires the user to invalidate the read FBO after the blit. This CL was verified with AGI to make sure there are no explicit blits to resolve the multiple sampled image. Bug: b/159903491 Test: FramebufferTest_ES31.*Blit* Test: VulkanPerformanceCounterTest_ES31.MultisampleResolveWithBlit Change-Id: I320a26088d8f614a295e7feec275d71310391806 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2298663 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Jamie Madill 27a24f6d 2020-08-17T19:02:09 Vulkan: Check aggregate barrier feature instead of caching. Bug: b/157508684 Change-Id: I6c98cb017d44c1279439d815e77f6ad1a32133e2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2360903 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Jamie Madill ea1bda26 2020-08-17T14:21:26 Vulkan: Name image layouts. Can be useful for debugging logging. Bug: angleproject:4959 Change-Id: I4bdb72b4c07979fecc2af0ca2a2b2e7cdab36b9f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2360902 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill d286daf1 2020-08-16T23:53:31 Vulkan: Track RP's read/write access for depth/stencil. This generalizes the read tracking into read/write. Knowing the write access can let us determine if we can switch a RenderPass to a read- only mode. And switching to read-only will let us combine some RenderPasses in Manhattan. Bug: angleproject:4959 Change-Id: Ic97547e84fef4a2670437677000d4525006ef69f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2358771 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com>
Jamie Madill 594e0e14 2020-08-15T16:35:55 Vulkan: Add DS ReadOnly mode to Framebuffer/RP caches. Allows ANGLE to create Framebuffers and RenderPasses with a read- only depth/stencil layout. Also allows us to transition our Images to this new DepthStencilReadOnly layout. Internal code redesign. No functional change to our command stream. Bug: angleproject:4959 Change-Id: I9b80063bdaec8f5d6c89037e0618c85e1c11b78d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2354280 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill ee0a9a34 2020-08-13T15:39:49 Vulkan: Clean up ImageLayout enum. Remove the redundant manual numbering. Also rename AllGraphicsShadersReadWrite to AllGraphicsShadersWrite for consistency. Refactoring change only. Bug: angleproject:4959 Change-Id: I2e7ca00993f192897bbf88f4bdc3f1610bcb345f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2354279 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Jamie Madill dceaabb1 2020-08-08T17:03:47 Vulkan: Clean up ImageHelper barrier functions. We don't need to explicitly check if a barrier is required for write barriers. Write barriers always require a barrier and read barriers need the layout change check. We introduce a new enum encoding ReadOnly vs Write layout types and call specialized write/read functions instead. Also renames the helper APIs to be more consistent. Refactoring change only. Bug: angleproject:4959 Change-Id: I0ce39ceaca6be588327c381194a580dc6b11f036 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2344744 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 693d0e0b 2020-08-07T21:28:08 Vulkan: Minor cleanup to vk_helpers. Moves some checks into helper functions. Refactor only. Bug: angleproject:4959 Change-Id: I08053a96f99baff75eb3954ecbb77e83483eba0f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2343406 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill eb85c021 2020-08-05T15:07:15 Vulkan: Refactor Context CommandBuffer query. getOutsideRenderPassCommandBuffer returns the command buffer directly since it's now stateless and cannot throw an error. All the RenderPass begin/end and flushing are done by the dependency functions (buffer/ image read/write). Bug: angleproject:4911 Change-Id: I5e7806be9d0e1b5e358524bd485298d660fac942 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2339544 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Jamie Madill d201ed8b 2020-08-02T16:29:35 Vulkan: Track used Images in RenderPass. Adding a simple ImageSerial tracking map in our RenderPass allows us to know when we do or do not need to close the RenderPass on a new Image access. This simple tracking scheme improves Manhattan performance by up to 25% on Android. The improved perf comes from reducing our RenderPass count (23->18 RenderPasses in our capture scene). Adds a FastUnorderedSet class to manage the used RP Image serials. Updates the Query helpers to explicitly flush the RP before inserting queries. Bug: angleproject:4911 Change-Id: I0c34fc8e307514ebdf3e81e08d8e5aedb70ebe8f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2334346 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 5e5b7537 2020-08-10T21:02:50 Vulkan: Optimize resource tracking in CommandBufferHelper. Introduces a FastUnorderedMap class that uses FastVector. This type uses static storage for up to a small fixed number of elements and uses dynamic storage for anything larger. Local testing shows this almost fully solves the regression from using unordered_map. It's still slightly slower than using no tracking (<5%). Very degenerate cases which track dozens or more buffers will still have significant overhead. For almost all applications that use only a few buffers per RenderPass this will be very fast. Test: angle_perftests, *vulkan_null_index_buffer_changed_ushort Bug: angleproject:4950 Bug: angleproject:4429 Change-Id: I39edeaaa159124167f1ea23ad2e6eac5e9220d0b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2348108 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 275a495d 2020-08-10T16:11:59 Vulkan: Remove TODO. Bug: angleproject:3200 Change-Id: Iaa5fb596a29b5488e45dec5636266e24ab4d97b2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2347118 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 5921a040 2020-08-06T17:39:56 Vulkan: Refactor image dependency commands. Uses commands similar to the Buffer APIs. Also updates docs. Bug: angleproject:4911 Change-Id: I1f2ec9bdd1d725d4ec3d6601e63bcb0c045e2121 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2342287 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Jamie Madill 23daea2f 2020-08-06T10:40:00 Vulkan: Rename CommandBuffer get method. This method will no longer end the RenderPass in a following CL. Renaming it in a split CL makes the review diff simple. Bug: angleproject:4911 Change-Id: Id48257884dccb7c86f7de2cc9ca95e651fb68df7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2340788 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Jamie Madill 135a5843 2020-08-02T23:03:44 Vulkan: Remove redundant vk prefixes in vk_helpers. Cleanup/refactoring only. Bug: angleproject:4911 Change-Id: I4fe06a86a6ecaafa16fd900b6f6229f09ab56a9f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2334092 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Jamie Madill e26c5e07 2020-08-02T16:04:17 Vulkan: Add Image serial. This is owned by the ImageHelper. We'll use it in tracking used images in RenderPasses. Bug: angleproject:4911 Change-Id: Ic71cef2b16eefb86c73c9c5e1e38ee7cd6a60adb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2332895 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill f9dd2c15 2020-08-02T18:03:16 Vulkan: Accumulate Buffer barriers. Uses an unordered_map in the CommandBufferHelper to track buffer reads and writes. Buffer barriers are tracked specially in the CommandBufferHelper class as a barrier we execute immediately when we execute the commands into the primary. So when we run into an incompatible buffer access we must start a new command buffer. The rules for an incompatible access are: - when we are reading a buffer, any prior write in the same command buffer is incompatible. - when we are writing a buffer, any prior read or write in the same command buffer is incopatible. Also adds a regression test using a new performance counter. Bug: angleproject:4429 Change-Id: I393a4ed87314f955eb998940b877ba76ea15a7b8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2334091 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 50442fac 2020-08-05T14:15:12 Vulkan: Fix ImageHelper's move constructor Bug: angleproject:4913 Change-Id: Ic78a26be4c2f3fa96ef77deffc239dbb7310065e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2339543 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 25b0de6b 2020-08-01T13:45:11 Vulkan: Squash Texture+ImageView Serial and improve caching. Previously we regenerated TextureSerial on Texture state changes such as base/max level changes. This caused ANGLE to update descriptor sets even though it was using the same image view handles. This change instead uses an ImageViewSubresourceSerial which includes both a serial for the ImageView and a 32-bit packed subresource range. The CL speeds up NBA2k because ANGLE no longer writes new descriptors for Texture max level changes. Local testing showed up to a 40% speedup. Also adds a regression test with a counter for the number of descriptor set writes in a frame. This change will also be useful in upcoming changes that track Image serials in the RenderPass. Bug: angleproject:4911 Change-Id: I66249634aa56288079acf2c0eb8aa3391103533c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2333396 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill b9b5fa55 2020-08-02T00:17:20 Vulkan: Redo Sampler Serials. Instead of refreshing sampler serials every time the SamplerVk or TextureVk has a state change we can give a VkSampler a unique serial. The serial is unique to this VkSampler and repeated state changes will fetch the same Serial from the SamplerCache. This allows for more cache hits. We store the the new Serial together with the VkSampler in a SamplerHelper class and store references to a SamplerHelper in SamplerVk and TextureVk instead of the VkSampler directly. In a follow-up change we will improve image view caching by also improving how we store serials for ImageViews. Bug: angleproject:4911 Change-Id: I9168c2700e383bca796cca925b38cfd30132d982 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2333988 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill adc250c3 2020-07-31T21:11:05 Vulkan: Refactor ImageViewHelper serials. Instead of storing a dictionary of serials to specific image views we now store a single 32-bit serial combined with subresource info. The serials combined with a subresource info (level/layer) gives a unique identifier for each ImageView in the ImageViewHelper for the descriptor set cache and the Framebuffer cache. Also moves ImageView serial allocation to initialization and release. This means we no longer need to use "getAssign" methods and instead we use a few init methods to ensure the serials stay allocated. Bug: angleproject:4911 Change-Id: Ia6af76ae16b3ff5d4a83974bde05cc704064b079 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2333395 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 22e6fc03 2020-07-31T15:58:28 Vulkan: Move Resource Serial gen into Renderer. Putting Serial allocation in the Renderer allows the Helper classes to manage allocating its own Serial. The init functions for ImageViewHelper only have access to a vk::Context/RendererVk, not a ContextVk. This will be updated in a future CL. Re-uses the Serial Type X-Macro to do more code generation. Serial allocation now uses an atomic because of its now Renderer shared location. Bug: angleproject:4911 Change-Id: I2d5d3d0bbf613d5468de795a700f66164291bc79 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2332884 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Charlie Lao 4e1abc75 2020-07-24T10:38:40 Vulkan: Set depthStencil loadOp to DontCare when not used and stored If depth stencil buffer is disabled during entire renderpass, and at the end of renderpass we are not storing the data back to memory, then force the loadOP to DontCare to avoid unnecessary depth stencil load or clear. Bug: b/162080462 Change-Id: I30905a6d45bec038de68e7f363ec699eb2be09ab Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2317726 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6c5ad2e9 2020-08-01T15:43:43 Vulkan: Remove ImageHelper::mSerial. This serial is no longer used by any code. Bug: angleproject:4911 Change-Id: Id82ef697b81b5738333f3280c58fd613615b6e09 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2333397 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Ian Elliott 1c1c6b4e 2020-07-29T13:17:16 Vulkan: Cache/re-use vkImageView's per max level For applications that frequently switch a texture's max level, cache and re-use "read view" vkImageViews per max-level. Test: NBA 2K20 Test: angle_deqp_gles3_tests --gtest_filter=dEQP.GLES3/functional_texture_mipmap_*_max_level_* --use-angle=vulkan Bug: b/161993151 Change-Id: I9a6a81d5234196040bc6c264ec627a073ba73293 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2321370 Commit-Queue: Ian Elliott <ianelliott@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Cody Northrop cc846039 2020-07-27T21:05:11 Capture/Replay: Fix GetTexImage on Luminance GetTexImageANGLE and GetRenderbufferImageANGLE use ReadPixels to pull texture data. Luminance is not a renderable format, so it is not supported by ReadPixels. To support this, override Luminance formats to their underlying internal format. Test: angle_end2end_test --gtest_filter="*GetTexImage*" Bug: b/160014453 Bug: angleproject:4058 Change-Id: Id19344c2e2c06386a871338833e35b7747cb966b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2321740 Reviewed-by: Manh Nguyen <nguyenmh@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Cody Northrop <cnorthrop@google.com>
Shahbaz Youssefi 8adc5469 2020-07-02T10:15:17 Vulkan: Generate mipmap in compute An initial implementation based on AMD's FFX SPD (Single Pass Downsampler). Apart from requiring STORAGE_IMAGE support for the image format, the following limitations are in place due to FFX SPD: - Image must be 2D or 2D array (including cube maps) - Image must be single-sampled The following _can_ be supported, but not yet implemented: - sRGB formats - Integer formats - depth/stencil formats Bug: angleproject:4551 Change-Id: Ibc4d5cea701cca31e55e3d651540872bbd3b473f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2278713 Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi d8ce865b 2020-07-19T00:20:17 Vulkan: Make room in RenderPassDesc for resolve attachments Data in RenderPassDesc is packed better to make room for resolve attachments (9 bits made available; 8 for color and 1 for depth/stencil). mColorAttachmentRange contains values in [0, 8). The right side of the range is made inclusive (i.e. [0, 7]) so it will fit in 3 bits. The number of samples is always a power of 2, and below 128 (for the foreseeable future), so its log is stored instead in 3 bits. This change doesn't add support for resolve attachments yet, but is split off the one that does to simplify it. Bug: angleproject:4836 Change-Id: I2856286d5239499d0ab0c78b8154881c003309bc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2306515 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao 234be194 2020-07-15T14:55:18 Vulkan: Move mEmptyBuffer from program to ContextVk And merge that with TheNUllBuffer as well so that you only have one dummy buffer per context. Bug: b/161391337 Change-Id: I75fddb5c48393876e745ff237e11d9c5672ae10e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2300707 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Courtney Goeltzenleuchter 9a9ef0ae 2020-07-15T16:50:32 Vulkan: Fix RTs attached to textures with non-0 mip Cleared confusion between GL level indices and VK level indices by adding the corresponding suffix to variables and function arguments. A handful of places that sent one index and expected the other are fixed. A couple more places needed this adjustment that were missed in the first CL. Also included a test to provoke those situations. The conversion between the two is given by: levelIndexGL = levelIndexVk + baseLevel; Bug: angleproject:4695 Change-Id: I3b8e5699abee1b011e52b666e6e245f44cb8ad6f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2302549 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
Charlie Lao 67980f13 2020-07-08T08:51:02 Vulkan: add Buffer/Texture/ImageViewSerial class In a few places we need a unique ID to represent that object and use that to compute hash key. Right now we are using Serial for that purpose but it creates confusion with QueueSerial which we are using Serial to track GPU progress. This CL changes these usage of Serial to TextureSerial, SamplerSerial, ImageViewSerial type so that compiler can perform type checking. It also adds BufferSerial in preparation for next CL. Bug: b/159457348 Change-Id: I8e2da69c2029e4ddbcf163981ae46f85e19f751b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2287426 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 22e1f3e2 2020-06-26T14:26:50 Vulkan: Let all shader stages share one buffer for default uniform Right now each shader stage has its own vk::DynamicBuffer for default uniform storage. This is less efficient than just share one buffer. This CL moves the storage from per shader stage into its ProgramVk object. Bug: b/159457348 Change-Id: If47248ea23c4e48407d3b211583ae2b048d4d10f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2265281 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao fe36a647 2020-07-08T18:27:21 Vulkan: Add driverUniform's buffer to mResourceUseList There is a bug with mDriverUniforms' dynamicBuffer that we never add it to context's mResourceUseList to let it hold onto it until GPU completes. This causes old buffer gets recycled prematurely and gets overwritten, result in rendering corruption. This CL adds current buffer to the mResourceUseList so that it will be waited properly before gets recycled. Bug: b/160777679 Change-Id: I7707442e0f5ba408f5f28337422274e0c23b6bfb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2288325 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Courtney Goeltzenleuchter f61272fb 2020-06-17T11:38:37 Add support for VK_KHR_sampler_ycbcr_conversion This adds ability for applications to import Android Hardware Buffers (AHBs) as OpenGL images which in turn can be sampled from and/or written. This was specifically tested with the common use case of importing a buffer created by an media decoder and using that as a texture source to include that video content on the screen. Tested with: - Angry Birds 2 video player (for ads) requires YUV conversion. - Basic Media Decoder example: https://github.com/android/media-samples/tree/master/BasicMediaDecoder Bug: b/155487768 Change-Id: I9255450f81aa4daa2aace7205d4f6c3f225abcca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2175103 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi cf63d872 2020-07-02T09:59:58 Vulkan: Use mipmap hint when generating mipmaps If the application asks for GL_FASTEST, this uses VK_FILTER_NEAREST instead of VK_FILTER_LINEAR. Bug: angleproject:4551 Change-Id: I6c10758104bd63dd477ea853a3b0464665f371ed Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2279132 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 34eb401b 2020-06-19T15:36:18 Vulkan: Skip repeated VkCmdClear call with the same value Some apps actually do this. One of them is gfxbench. This helps performance by dropping the redundant clear calls. Bug: b/159489614 Change-Id: Ib7958042f081b8fd58c5bc912fbb45bb223aec0f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2255643 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Mohan Maiya 58ff77a8 2020-06-27T09:30:00 Vulkan: Set new layout based on VkImageUsageFlags When transferring vkImages between queues, the new layout needs to be set based on the usage flags of the vkImage instead of hardcoding it to AllGraphicsShadersReadWrite Bug: angleproject:4791 Change-Id: I3b543a6280e6c2317cc11bf65dc4c337bc5f90b1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2271563 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi b0245f68 2020-06-23T22:38:12 Vulkan: Remove superseded updates when flushing to image Especially with emulated formats and robust resource init, a clear is staged that's often superseded by a data upload to the same subresource. This change ensures that superseded updates are dropped to avoid unnecessary GPU work. Bug: angleproject:4691 Change-Id: I697ccd438b92fd2fff17a5800550694658c95c54 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2262574 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi c81da1c8 2020-06-19T22:05:38 Vulkan: Avoid double-copy when generating mipmap If the image needs to be redefined with mips, level 0 was copied to a buffer which was then copied to the new image. This change instead stages the old image directly for copy to the new image. Bug: angleproject:4551 Change-Id: I7625f140ddadde0a2b439c5e91c519ad49ae2fd7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2257264 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 62a2f513 2020-06-23T13:16:19 Vulkan: Remove DispatchHelper This class is no longer used. Bug: angleproject:4029 Change-Id: I2758b286ae10856a5dff3decbb1cf9c58b44e354 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2260936 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi b772a955 2020-06-16T23:32:47 Vulkan: Make texture syncState aware of upcoming generateMipmap By letting TextureVk::syncState know it's being called for generateMipmap, it can make a better decision to initialize the image: - Staged updates to mips that are going to be overwritten are dropped - The image is created with full mipchain to avoid a redefine in the following generateMipmap() call. Bug: angleproject:4551 Change-Id: Ic70ee6c0a0b29c7bd62beaff612b2f2d5276defb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2249340 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Tobin Ehlis 34ca1ac7 2020-06-16T12:05:12 Vulkan: Fix FramebufferVk cache Migrate Serial from Image to ImageView. Imageviews are what are utimately used in FramebufferVk, so move the Serials into the ImageViewHelper class. Since that class also knows the level/layer of the imageView, we can revert to using a single Serial per ImageView instead of the AttachmentSerial that included the layer and level. ImageViewHelper caches Serials per layer/level combo. Bug: angleproject:4651 Change-Id: I3741d7d03523eada84295cb712c1cc1e6e3c3867 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2248203 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 3589d9a0 2020-06-16T15:32:18 Add a test for generateMipmap after modify To make sure TextureVk::syncState is called before generateMipmap. Bug: angleproject:4551 Change-Id: Ibce0738b72fc81270e07617f04ffee57f1c8ed20 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2248209 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 6cb8345f 2020-06-17T23:22:57 Vulkan: Non-zero memory initialization for all images This was only implemented for single-level, single-layer, single-sample color images. This change implements clear for all images. Additionally, the move to VMA broke the initialization of the staging buffer, so even for the supported case, the image was being initialized with uninitialized data. Bug: angleproject:4092 Bug: angleproject:4551 Change-Id: Ic2eee3f8454a93f1bcf3ca725afabcdc693047e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2249376 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi e7ae237e 2020-06-12T23:52:09 Vulkan: ANGLE_copy_texture_3d support Bug: angleproject:4748 Test: CopyTexImage*Vulkan:Texture3DCopy*Vulkan:Texture2DArrayCopy*Vulkan Test: dEQP.KHR_GLES3/copy_tex_image_conversions_required_cubemap*cubemap* Change-Id: Ifdc3d455ca8c9e732d0adf4afa9e2809d780ae18 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2246320 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tim Van Patten 68fcfea3 2020-05-29T12:34:08 Vulkan: support format aliasing in texture images glBindImageTexture specifies the format which should be used to interpret the texture data and this format is independent from the texture's own internal format. This change allows the VkImage's format to be mutable to handle glBindImageTexture calls with different formats. Bug: angleproject:3885 Test: dEQP-GLES31.functional.image_load_store.*.format_reinterpret.* Change-Id: Ia1ad762b4ccae0f510c8b4918781234fcf51c5f1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2222610 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Jamie Madill 959037e0 2020-05-25T15:40:38 Vulkan: Preserve RPs on XFB changes when possible. Instead of unconditonally ending the RenderPass we keep a set of active XFB buffers in the ContextVk. This lets us re-use RPs when we don't write to the same buffer repeatedly. Reduces the RenderPass count in our Manhattan capture from 29->23. Bug: angleproject:4622 Change-Id: I28c2d4d3db1490e5d07be3c48d21fd2cc6ff85d6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2196957 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 7005248b 2020-06-11T16:00:23 Vulkan: Fix glCopyTextureCHROMIUM if source is swizzled A no-swizzle view is added for this use-case. Bug: angleproject:4004 Change-Id: Id654af9a4f520357c91bf2b06501c9e1ea169f11 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2241623 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 0eae0d6c 2020-06-11T08:53:39 Vulkan: Set external image's tiling mode based on AHB usage flags For external images which can be accessed by CPU, the tiling mode should be linear. So, query the usage of the Android Hardware Buffer and derive the tiling mode based on AHB usage flags. Bug: angleproject:4735 Change-Id: I1b91c6800d414d73091032e40d8e4f1e8f6c101b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2241780 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 000a79f1 2020-06-04T23:06:58 Vulkan: Better handling of texture level redefinition If a texture level is being redefined, there are two scenarios to consider: 1. The level is outside the base/max level, for which the image was allocated. 2. The level is within the base/max level, but it's being redefined to a different size or format. In the former case, we simply don't need to release the image. The latter case itself has two possibilities: 2.1. There is only one level in the image. 2.2. There are multiple levels in the image. In case 2.1, the whole image is being redefined (as it has only a single level), so the image can (and should) be released. Prior to this change, this behavior was adopted for all cases. This change retains this behavior for this case only. In case 2.2, the texture is becoming incomplete. However, the image shouldn't yet be released because another one of its mips may be bound to a framebuffer. In such cases as glCopyTexImage2D(), that framebuffer may in fact be the source of the copy operation (which would be destroyed if the image is released). If the base/max level of the texture doesn't change, redefining the level and making the texture incomplete doesn't make the framebuffer incomplete; this is achieved at the same time by not releasing the image. This change ensures that updates to the redefined level are staged in cases 1 and 2.2. Bug: angleproject:4274 Change-Id: I3fac3203c2fbbc16e8e4a35b1334b767120b2dcf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2230853 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 3d2de99e 2020-06-09T01:14:42 Vulkan: Fix RTs attached to textures with non-0 mip Cleared confusion between GL level indices and VK level indices by adding the corresponding suffix to variables and function arguments. A handful of places that sent one index and expected the other are fixed. The conversion between the two is given by: levelIndexGL = levelIndexVk + baseLevel; Bug: angleproject:4695 Change-Id: I84ecbaf867d00a40fb39b6db7ad79658016f4d9a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2235362 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Cody Northrop 15328f69 2020-06-04T16:59:22 Capture/Replay: Don't assert when reading combined depth/stencil We can't actually read them back at the moment, so this needs a proper fix. In the meantime, the apps we are tracking don't need this value at the beginning of the trace. Test: Angry Birds 2 MEC Bug: angleproject:3662 Bug: angleproject:4688 Bug: b/157672184 Change-Id: I67190092bcce7080edc69714f1ca1194c37d54fb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2231802 Reviewed-by: Manh Nguyen <nguyenmh@google.com> Commit-Queue: Cody Northrop <cnorthrop@google.com>
Shahbaz Youssefi da958a59 2020-06-04T13:56:47 Vulkan: Fix clear of non-zero-base-level images The staged resource updates adjusted their level to take base level into account, but clear updates used a cached unadjusted value. Bug: angleproject:3148 Change-Id: I9a49d5341083b2f870baa1ee6053e54baef35086 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2230786 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Jamie Madill 6c158164 2020-05-28T15:19:51 Vulkan: Fix XFB invalid accesses in buffer OOM. This uses the "null" buffer in the Renderer to bind an empty buffer handle so ANGLE can maintain a consistent state. Bug: chromium:1086532 Change-Id: I1912a1d1cb64433a285fcfced80a675619690a0b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2219140 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Jamie Madill b947498b 2020-05-28T13:06:13 Vulkan: Clean up VMA wrapper classes. Make these more consistent with the rest of the wrapper classes. Also handle some VkResult errors that were being ignored. Will pave the way for better handling of buffer allocation error conditions. Bug: chromium:1086532 Change-Id: Idc5b3f0e2945b1f44f152d33e8cc572f83a6b658 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2219136 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Mohan Maiya <m.maiya@samsung.com>
Jamie Madill 558882a1 2020-05-28T15:26:37 Vulkan: Pass vk::Context to BufferHelper::init. This is necessary so we can initialize a "null" BufferHelper in RendererVk which does not have access to the ContextVk. This in turn will allow us to use a single global "null" Buffer instead of instantiating them all over ANGLE. Also removes a TODO that was sticking in the code. Bug: angleproject:2162 Bug: chromium:1086532 Change-Id: Ica48d5b886e885ebfe0f8e3abfbe8169a8eaa5b2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2219139 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Antonio Maiorano 9905f7f5 2020-05-29T11:25:33 Fix CopyTextureTestES3.ES3FloatFormats for VK When enabled, this would crash in debug because mFormat would be nullptr on the target VkTexture, and the ASSERT would access mFormat via getAspectFlags(). Fixed this by only calling getAspectFlags() if mFormat is valid. I'm not sure this was the original reason this test was disabled, but they pass now on SwiftShader. Bug: angleproject:4092 Change-Id: I9b04bbc61dde14f722d3a510f3d38776f4f6c7ac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2221420 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Tobin Ehlis 02fa7313 2020-05-05T17:01:18 Vulkan:Initial worker thread disabled by default Created new CommandProcessor class that can be run as a worker thread. Running CommandProcessor within RendererVk as a worker thread that takes a CommmandBufferHelper (CBH) ptr as the interface and processes that CBH into a primary command buffer. Main thread has a queue of CBH to draw from. After submitting a CBH to the worker, it pulls next CBH from the queue. Worker thread releases CBH back to the main thread queue when done. Synchronization goes two ways: 1. Work submitted to worker thread is managaed with a mutex and condition variable based around the work queue. 2. Available CBH ptrs for the main thread have a mutex and condition variable that manages the CBH queue. The worker thread is disabled by default, and, when enabled, it will currently behave and perform as the non-threaded code. This is because the kNumCommandBuffers const in ContextVk.h is set to 2. With only 2 command buffers, they will be assigned to the inside and outside RenderPass command buffers respectively. Then, as soon as one is submitted, the main thread will stall waiting for it to be completed and put back into the queue mentioned in #2 above. The next step is to move command submission to the worker thread and update the number of command buffers so that processing/submission will occur in parallel with the main thread. Right now there is a race condition issue when attempting to run in parallel because the main thread updates and submits the same primary command buffers that are used in the worker thread, which is in violation of the Vulkan spec. The follow-on CL will fix this issue as the main thread will only touch SecondaryCommandBuffers and the worker thread will be the only thread touching the primary command buffers. Bug: b/154030730 Change-Id: Ib0c518bbd7ca9a3a7e789f4e1f2f7131ddc0509e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2174719 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao 30298dc2 2020-05-15T15:21:04 Vulkan: Optimize out barrier needs for transition between shaderReadOnly If we are transition between different kind of shaderReadOnly, there is no actual layout change or accessType change. Instead of always insert a barrier, this will track what shaderStage has made read access and only insert barrier if the read is from new shader stage. The barrier inserted will be always from last non-ShaderReadOnly transition. There is no read to read barrier generated. Bug: angleproject:4550 Change-Id: I4aeb7d4bddf2d072b60839f98e7af1aa23f977b5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2204480 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Tobin Ehlis d3d7b95b 2020-05-19T17:27:50 Vulkan:Migrate timer sync functions to one-off cmd buffer ContextVk's getTimestamp() and synchronizeCpuGpuTime() were the two places that mCommandQueue was used outside of processing SecondaryCommandBuffers. Migrating those functions to use the one- off command buffer instead. This will allow for the removal of mCommandQueue from ContextVk as we migrate it to RendererVk instead for threading phase2 development. Bug: b/154030730 Change-Id: Ic00ce56739dadcdc4b5a1b1839e0e18603bfe0eb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2209312 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tobin Ehlis <tobine@google.com>
Tobin Ehlis 1a4f6e1f 2020-05-20T10:37:24 Vulkan:Migrate command buffers to pointers This is an intermediate CL as we move to a worker thread. With the worker thread there will be a pool of more than 2 command buffers so the current command buffers in use on the main thread will be pointers that are assigned from that pool. This CL isolates the command buffers as pointers to make review simpler. Bug: b/154030730 Change-Id: I3fc91222b07d5f3bf60f92a4c01b0910daad7df6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2207812 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Mohan Maiya cf8422c2 2020-05-19T10:14:02 Vulkan: Acquire a new BufferHelper from the pool based on a threshold We acquire a new BufferHelper from the pool when the app updates the data of the entire buffer. In scenarios where the app updates say, 60% of the buffer it would still be benificial to acquire a new buffer and copy over the remaining 40% of data from the old buffer to the new one. This reduces the transfer workload from 60% to 40% of buffer size. Currently the threshold is set to 50% of buffer size. Bug: angleproject:4380 Change-Id: I12576c585230e771d4c1a4352fab93dd3db2ecef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2204655 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao 258d94f6 2020-05-18T16:21:50 Vulkan: Add workaround for nvidia to always merge barriers into one vkCmdPipelineBarrier call Nvidia preferes one barrier call than multiple calls with fine grained stage dependency information. They do not care much about stage dependency. This adds a feature flag that sets to true on nvidia and will merge all barriers into one call. Bug: angleproject:4633 Change-Id: I204484aa4c5989655f74d70a0eaa235c3c83f548 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2207635 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Charlie Lao 8a90905c 2020-05-16T17:35:03 Revert "Vulkan: Try to merge barriers if possible" This reverts commit 153c14cbd6e9f095c09dc1e6c938b1656bc56159. Reason for revert: The dependencyStrongerThan logic is incorrect and causing perf regression on ARM. Original change's description: > Vulkan: Try to merge barriers if possible > > This is try to reduce the number of vkCmdPipelineBarrier API calls into > driver. It should not affect the actual barriers. > > Bug: b/155341891 > Change-Id: I57b8b8cdad50d494c76a008006bd54961170c8bc > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2194841 > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> TBR=courtneygo@google.com,timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: b/155341891 Change-Id: I8ebe7481b299af446dfd488874e64e6e60b4f764 No-Presubmit: true No-Tree-Checks: true No-Try: true Change-Id: I8ebe7481b299af446dfd488874e64e6e60b4f764 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2205433 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Jamie Madill 8270ebbd 2020-05-08T14:00:18 Vulkan: Refactor and clean up XFB code. This is a refactor-only change mostly. It makes the classes work more similarly to how the other classes in the Vk back-end work. Also removes some redundant code. Moves the buffer caching into begin for a more dirty-bits like approach. Bug: angleproject:4622 Change-Id: I34ac13e1d05b48e3267937c760d195493a76ed02 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2191172 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>