src/libANGLE/renderer/vulkan/vk_utils.cpp


Log

Author Commit Date CI Message
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>
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 a83f7e91 2022-01-19T14:14:16 Vulkan: inline some of the BufferSuballocation APIs These are simply get* calls and frequent used ones. The measurement I have on Pixel6 shows there is 0.01ms out of 2.28ms on CPU overhead with asphalt_8 app trace measured with --minimize-gpu-work. Bug: b/205337962 Change-Id: I746a1ccc67c589d1aba25495601ad874ddc034a4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3403159 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>
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>
Charlie Lao bc9d2d7d 2021-12-07T16:16:47 Vulkan: Consolidate BufferHelper's code paths into one There are cases that BufferHelper may not sub-allocate from the pool. For example, when buffer is created from external memory. Right now we have two different code paths in the BufferHelper object and checking if suballocation object is valid or not and pick different code path. This CL consolidates both code path into one by making non sub-allocated case also creates BufferSUbAllocation object and owns a BufferBlock object. Bug: b/205337962 Change-Id: Iac82bdb0b69d424e4147b52d458ced6274e106a1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3322100 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao eca427b2 2021-12-20T10:55:41 Vulkan: Add mutex to protect mVirtualBlock mVirtualBlock could be accessed from multiple thread when asyncCommandQueue is enabled, where the free call could come from the submission thread. This CL adds a mVirtualBlockMutex in BufferBlock and always take the lock when mVirtualBlock is been accessed. This CL also adds ConditionalMutex class for the general usage that a mutex is only used based on a boolean. Bug: angleproject:6840 Change-Id: Ib647b4ff12ebfc08f2a70192d39f16e15a1fc5f5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3350798 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 83a670ab 2021-10-29T09:12:26 Vulkan: Implement BufferPool using VMA's virtual allocator VMA's allocation calls used to be sub-allocating a pool of memory. What we really want is sub-allocate a VkBuffer object. VMA recently added support to expose the underlying range allocation algorithm via APIs, which user can use it to sub-allocate any object. This CL uses that new virtual allocation API to sub-allocate from a pool of VkBuffers. In this CL we only switched BufferVk::mBuffer to sub-allocate from the BufferPool object. Bug: b/205337962 Change-Id: Ia6ef00c22e58687e375b31bc12ac515fd89f3488 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3266146 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Ian Elliott 24241724 2021-11-22T13:26:53 Reland: Vulkan: Use vkResetQueryPoolEXT when available This is a reland of 97aa5187ed164f1e9a22b64c966f2a747f651bfb Original change's description: > ANGLE currently uses vkCmdResetQueryPool to reset a query pool. As > reported by Arm, this can cause GPU bubbles. It is better to use > vkResetQueryPoolEXT() when available (either by Vulkan 1.2 or by the > VK_EXT_host_query_reset extension). > > Bug: angleproject:6692 > Change-Id: I650d7d0f55bdf6587b75be43cc7bed2dc3eb935a > Reviewed-on: > https://chromium-review.googlesource.com/c/angle/angle/+/3294061 > Commit-Queue: Ian Elliott <ianelliott@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Charlie Lao <cclao@google.com> Bug: angleproject:6692 Change-Id: Idff87977bd39ccd1d05684e48929f4cd3fa733c7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3313382 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
Peng Huang a5e391d7 2021-11-19T17:35:06 Add GL_ANGLE_vulkan_image extension glAcquireTextures & glReleaseTextures are added for sharing texture ownership with an external API. Bug: chromium:1264439 Change-Id: If46d8d230b4f611768b5ff1187674509e42f01e0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3293921 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Peng Huang <penghuang@chromium.org>
Ian Elliott 2fa1adf0 2021-11-24T18:29:13 Revert "Vulkan: Use vkResetQueryPoolEXT when available" This reverts commit 97aa5187ed164f1e9a22b64c966f2a747f651bfb. Reason for revert: This apparently caused crbug.com/1273344 Original change's description: > Vulkan: Use vkResetQueryPoolEXT when available > > ANGLE currently uses vkCmdResetQueryPool to reset a query pool. As > reported by Arm, this can cause GPU bubbles. It is better to use > vkResetQueryPoolEXT() when available (either by Vulkan 1.2 or by the > VK_EXT_host_query_reset extension). > > Bug: angleproject:6692 > Change-Id: I650d7d0f55bdf6587b75be43cc7bed2dc3eb935a > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3294061 > Commit-Queue: Ian Elliott <ianelliott@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Charlie Lao <cclao@google.com> Bug: angleproject:6692 Change-Id: I70d5eeb0b98f016fd262935194f8f4abee2a72b9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3300309 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Lingfeng Yang <lfy@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
Jeff Vigil 8b60855b 2021-09-15T15:16:10 EGL: implement EGL_KHR_mutable_render_buffer Pass render buffer mode change to WindowSurfaceVk. On mode change trigger OUT_OF_DATE. Then in CreateSwapchain, if new mode, set the Presentation mode and the Image count. OffscreenSurfaceVk ignores mode change. Add MUTABLE_RENDER_BUFFER_BIT to GenerateDefaultConfig. Test: dEQP-EGL.functional.mutable_render_buffer.* Bug: angleproject:3966 Change-Id: I7b59708514bcda10f8d45ce5f9528aa840fcccfa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3171822 Commit-Queue: Brandon Schade <b.schade@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Ian Elliott 97aa5187 2021-11-22T13:26:53 Vulkan: Use vkResetQueryPoolEXT when available ANGLE currently uses vkCmdResetQueryPool to reset a query pool. As reported by Arm, this can cause GPU bubbles. It is better to use vkResetQueryPoolEXT() when available (either by Vulkan 1.2 or by the VK_EXT_host_query_reset extension). Bug: angleproject:6692 Change-Id: I650d7d0f55bdf6587b75be43cc7bed2dc3eb935a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3294061 Commit-Queue: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Jamie Madill 5f755c29 2021-11-17T16:29:37 Vulkan: Lock around handle counter. TSAN showed we could have a data race when multiple threads were releasing objects because of the singleton handle counter. Bug: angleproject:6714 Change-Id: I23b5d343bec421a663198e7efc30c78dab2bde8f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3288328 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 421dbf20 2021-10-26T19:06:19 Revert "Vulkan: Use different strategy for buffer memory allocation" This reverts commit 0dbe308d91a3526e28fecd9014d873c649f4ef71. Reason for revert: crbug.com/1253325 Original change's description: > Vulkan: Use different strategy for buffer memory allocation > > This CL uses different memory allocation strategy based on the requested > size. If the requested size exceeds 1M, we use dedicated memory > allocation to avoid memory waste associated with the sub-allocator. > Otherwise we uses VMA's sub-allocator pool. This CL creates two sets of > customized pool so that we uses different allocation strategy for each > set of pool: the small pool uses buddy algorithm which favors speed over > memory and large pool uses default algorithm that favors memory saving > over speed. This CL also replaces vmaFindMemoryTypeIndexForBufferInfo > with vmaFindMemoryTypeIndex to avoid create and destroy VkBuffer object > just try to find memoryTypeIndex. > > Bug: b/195588159 > Change-Id: I2bddbfffd77ba2ce6b9389d83a31051c4b748c4d > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2939490 > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> Bug: b/195588159 Change-Id: I2c8fe8cb2930d16f5212570d32be68e7c6a6e5f3 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3244258 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Charlie Lao 0dbe308d 2021-07-16T14:26:20 Vulkan: Use different strategy for buffer memory allocation This CL uses different memory allocation strategy based on the requested size. If the requested size exceeds 1M, we use dedicated memory allocation to avoid memory waste associated with the sub-allocator. Otherwise we uses VMA's sub-allocator pool. This CL creates two sets of customized pool so that we uses different allocation strategy for each set of pool: the small pool uses buddy algorithm which favors speed over memory and large pool uses default algorithm that favors memory saving over speed. This CL also replaces vmaFindMemoryTypeIndexForBufferInfo with vmaFindMemoryTypeIndex to avoid create and destroy VkBuffer object just try to find memoryTypeIndex. Bug: b/195588159 Change-Id: I2bddbfffd77ba2ce6b9389d83a31051c4b748c4d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2939490 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao 22ecd454 2021-07-19T17:28:05 Vulkan: Move BufferMemory class from vk_helpers.h to vk_utils.h In preparation for the StagingBuffer may also use BufferMemory, this CL moves the class to vk_utils.h so that it can be used by any class without create kinks on header file inclusion. Bug: b/195588159 Change-Id: I97ab136be691322fe6284fd1b4b7336fdf1f904f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3040106 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao 8ef1b2a2 2021-07-15T15:27:15 Vulkan: Add BufferMemoryAllocator class BufferMemoryAllocator class will be responsible for memory allocation for vkBuffers. The original Allocator class remains the wrapper for vmaAllocator. Bug: b/195588159 Change-Id: I26d016e2f8d13ba459d0aa0bd4e1ebf4d0d48251 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3036256 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 2f1d503b 2021-09-16T21:49:14 Vulkan: Fix Vulkan secondary command buffers This change abstracts initialization, begin/end, reset and recycle of command buffers such that both Vulkan and ANGLE secondary command buffers are supported. Bug: angleproject:6100 Change-Id: I8c79764ac98b599fda08fe45cf8c4f0a6573f0f9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2987873 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi dc99db91 2021-09-16T21:45:35 Vulkan: Allow Vulkan secondary CBs to count their commands This is used by render pass related code to determine if some command has been issued since a previous event. With ANGLE SecondaryCommandBuffer, the memory pointer where the commands are being written to are used for this purpose. For Vulkan secondary command buffers the code simply increments a counter. Bug: angleproject:6100 Change-Id: I85320f8453bd3325793df85aabde3d42b1eeb22a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3167214 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 2d79918f 2021-09-16T16:43:53 Vulkan: Pass command pool around Preparatory work for re-enabling support for Vulkan secondary command buffers. The command pool being passed around is not yet used. Additionally, the work to allocate, initialize, reset and recycle command buffers has been refactored to a helper class for better abstraction. The CommandBufferHelper class now holds a pointer to the pool it was allocated from for clean up. Each ContextVk has its own command pool, where Vulkan secondary command buffers are allocated from. The command pool that CommandProcessor had was unused and is removed by this change. Bug: angleproject:6100 Change-Id: I0d4fa6a76ef06e88779145ffe9c613518a8eb390 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3167213 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 458389f2 2021-09-02T22:41:40 Vulkan: Support Linux dma-bufs This change adds support for EGL_EXT_image_dma_buf_import and EGL_EXT_image_dma_buf_import_modifiers on top of Vulkan's VK_EXT_external_memory_dma_buf and VK_EXT_image_drm_format_modifier. Bug: angleproject:6248 Change-Id: I581987f88e9ddcf351dc721f499f63912dca05f9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3145610 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao cf24931a 2021-08-17T10:48:23 Vulkan: Add ImageHelper::getActualFormat() This is preparation for future CLs. In the future vk::Format may not tell you what actual format is. This CL adds a new method of ImageHelper::getActualFormatID() and ImageHelper::getActualFormat() so that we can use these two APIs and avoid using vk::Format, thus reduce reliance on vk::Format. Bug: b/196456356 Change-Id: Ic50e664e033feb5e066f40269c33cffe96024172 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3100319 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Shahbaz Youssefi 971ba359 2021-06-23T16:45:33 Add angle::BitMask for creating bit masks angle::BitMask(n) implements the common pattern of angle::Bit(n)-1. Bug: angleproject:6048 Change-Id: Icd56ef1504804add59d0804a7249b3035c96f9c2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2984099 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Cody Northrop 851fbedb 2021-06-10T21:27:01 Vulkan: Switch viewport and scissor to dynamic state Heavily based on http://crrev/c/1316888 Some apps are creating a large number of viewport combinations and are running out of graphics memory. This CL drops their graphics pipeline use from tens of thousands to tens. Performance testing shows little impact to application traces. Bug: b/190026813 Bug: angleproject:3143 Change-Id: Ib7415be1128f8fedae4a7ca72e067b2815201223 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2954925 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 84d22197 2021-04-26T17:11:27 Vulkan: Add device local fallback in findCompatibleMemoryIndex(...) When finding a compatible memory index for an external buffer, we need to have a fallback path that requires just the VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT property. Bug: angleproject:5909 Change-Id: Id3faffb3e357be2e5e6f5fce9e64f0f2889d199a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2862561 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Mohan Maiya 80a4223e 2021-01-28T17:51:31 Vulkan: Handle changes to viewport when clip origin is modified The expected view port is different from current viewport translation when the clip origin is the upper left. So now, it has four different view port translations based on clip origin and y-flip of framebuffer. - add query and state management for EXT_clip_control - add dirty bit for clip control - change viewport, scissor and cull face when clip origin changes Bug: angleproject:5471 Tests: dEQP-GLES2.functional.clip_control.* Change-Id: I78dc752c3287b09f25496034e0d0d2724138010c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2615863 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Peng Huang 53105997 2021-01-28T07:42:15 Initialize some missing vulkan function pointers Those methods are used by VMA. However VMA can get those methods by itself, if null function pointers are provided for creating the VMA. But it will cause problem, when ANGLE & Chromium are sharing one VMA implementation, since the VMA implementation in chromium will be built with VMA_STATIC_VULKAN_FUNCTIONS=0 & VMA_DYNAMIC_VULKAN_FUNCTIONS=0. Bug: chromium:1170339 Change-Id: I5bf435698e4e361bfa7a6afce84390ccc4355b53 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2655795 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 2e9706d8 2021-01-08T17:29:42 Vulkan: Use angle::FormatID instead of VkFormat. This change switches the internal enums we pass around from VkFormat to FormatID. The end goal of the refactor is to allow the Vulkan back-end to store packed tables indexed by FormatID. Because VkFormat has large gaps in its enum space we'd otherwise need to use unordered data structures like unordered_map. The change removes the redundant VkFormat storage from vk::Format and uses a new table query to return the VkFormat that 1:1 matches an angle::FormatID. We also include a reverse mapping for use with native Vulkan get functions for Android. Also moves sRGB conversion functions into renderer_utils. A couple sRGB formats that don't exist in GL are no longer handled by the sRGB conversion functions. These formats should be extremely rare. Bug: angleproject:5438 Change-Id: Id8b49773ca0c556f9f5a6a10fcf0d9762b93bbea Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2618204 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Jamie Madill e91097bf 2020-12-29T14:05:56 Vulkan: Clean up "actual"/"intended" naming. Clarifies that the GL internal format is an "intended" format and the Vulkan formats are "actual" formats. This makes all the format fields use the same consistent naming pattern. Bug: angleproject:5438 Change-Id: I935a49895109e9e06eae5ef98d5614dfd1128ff8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2605728 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi b35a468a 2020-12-04T12:14:37 Vulkan: Support geometry/tessellation primitive topologies Bug: angleproject:5406 Change-Id: Ifb7553e87164c204353e1ed94b8d64f5fb4b7206 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2574822 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi a5da17cd 2020-11-26T17:09:37 Vulkan: Remove vk:: inside namespace vk Bug: angleproject:5404 Change-Id: I51df1ad69a65b17621a3cbe4e5d55621cc9ae6ec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2562683 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya f197ebac 2020-11-16T15:16:56 Vulkan: Add EXT_external_buffer support Addition of buffer support for external memory Also adds new end2end tests for these usecases * SubData update * map/unmap buffer * dispatch compute with external buffer Bug: angleproject:5073 Test: ExternalBufferTestES31.*Vulkan Change-Id: Ib3cccaca77b76830effe49d3731782552e7424ec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2525105 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 9e7f08fc 2020-11-06T16:55:51 Vulkan: Fix incorrect reordering of barriers Take the following situation, a simple copy from image to buffer: ANGLE_TRY(contextVk->onBufferTransferWrite(buffer)); ANGLE_TRY(contextVk->onImageTransferRead(aspectFlags, image)); CommandBuffer &commandBuffer = contextVk->getOutsideRenderPassCommandBuffer(); commandBuffer.copyImageToBuffer(imageHandle, layout, bufferHandle, 1, regions); Both `onBufferTransferWrite` and `onImageTransferRead` may flush either the outsideRP or insideRP command buffers. If buffer is not previously used, but image is used: - onBufferTransferWrite: buffer usage is recorded in outsideRP1 - onImageTransferREad: outsiderRP1 is flushed, outsideRP2 is started - copyImageToBuffer: recorded on outsideRP2, but buffer usage not recorded there - A following command that uses the buffer and requires barrier doesn't close outsideRP2 as it believes it was not used there Bug: angleproject:5319 Change-Id: Ib8994083fbc21969a538cda3784adee57b089415 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2523388 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 16102e8b 2020-10-17T01:15:05 Reland "Vulkan: Fold deferred clears into current clears" This reverts commit 37c400146e59f718b516eb58e16fa53c8a88bf21. Reason for revert: Need to clear the package cache when bisecting. Original change's description: > Revert "Vulkan: Fold deferred clears into current clears" > > This reverts commit e416c92a81c9ef01d633ec5c05e81c2551b6c5d6. > > Reason for revert: Reverted parent: > https://chromium-review.googlesource.com/c/angle/angle/+/2481612 > > Original change's description: > > Vulkan: Fold deferred clears into current clears > > > > If there are clears prior to a glClear() call, those clears were > > flushed (starting a new render pass) and then the clear call's clears > > would be applied (essentially modifying the loadOps of said render > > pass). > > > > The main downside of the above is that the current glClear() clears > > don't get a chance to be deferred. This was observed in Chrome which > > clears an attachment with an emulated format, then switches > > framebuffers. > > > > Additionally, if the render pass had already been started, the deferred > > clears could have become inlined instead of breaking the render pass. > > Although, it's unlikely for there to be deferred clears when the render > > pass is already open. > > > > This change first identifies which clears need to go through the draw > > path (scissored, masked or as workaround for driver bug). It merges the > > rest of the clears (that don't need the draw path) with the deferred > > clears. It then checks deferred clears and applies them by either: > > > > - vkCmdClearAttachments if mid RP > > - Start a new render pass and use loadOps, if any draw-based clear needs > > to follow. > > - Modify current RP loadOps / defer the clear > > > > Afterwards, the draw-based clears are applied. > > > > Bug: angleproject:4836 > > Change-Id: Id4992c78983b199734508c9d4bb18ed3195c91ec > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2455167 > > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Jamie Madill <jmadill@chromium.org> > > Reviewed-by: Charlie Lao <cclao@google.com> > > TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com > > Change-Id: I85733b3594409df9b96e3d5b34933522c97c42cf > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: angleproject:4836 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2481613 > Reviewed-by: Tim Van Patten <timvp@google.com> > Commit-Queue: Tim Van Patten <timvp@google.com> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com # Not skipping CQ checks because this is a reland. Bug: angleproject:4836 Change-Id: I702cd510f39ee46feab27d4efbf61ae5da10d4e2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2481856 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Tim Van Patten 37c40014 2020-10-16T22:19:20 Revert "Vulkan: Fold deferred clears into current clears" This reverts commit e416c92a81c9ef01d633ec5c05e81c2551b6c5d6. Reason for revert: Reverted parent: https://chromium-review.googlesource.com/c/angle/angle/+/2481612 Original change's description: > Vulkan: Fold deferred clears into current clears > > If there are clears prior to a glClear() call, those clears were > flushed (starting a new render pass) and then the clear call's clears > would be applied (essentially modifying the loadOps of said render > pass). > > The main downside of the above is that the current glClear() clears > don't get a chance to be deferred. This was observed in Chrome which > clears an attachment with an emulated format, then switches > framebuffers. > > Additionally, if the render pass had already been started, the deferred > clears could have become inlined instead of breaking the render pass. > Although, it's unlikely for there to be deferred clears when the render > pass is already open. > > This change first identifies which clears need to go through the draw > path (scissored, masked or as workaround for driver bug). It merges the > rest of the clears (that don't need the draw path) with the deferred > clears. It then checks deferred clears and applies them by either: > > - vkCmdClearAttachments if mid RP > - Start a new render pass and use loadOps, if any draw-based clear needs > to follow. > - Modify current RP loadOps / defer the clear > > Afterwards, the draw-based clears are applied. > > Bug: angleproject:4836 > Change-Id: Id4992c78983b199734508c9d4bb18ed3195c91ec > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2455167 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Charlie Lao <cclao@google.com> TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Change-Id: I85733b3594409df9b96e3d5b34933522c97c42cf No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:4836 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2481613 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi e416c92a 2020-10-06T23:29:02 Vulkan: Fold deferred clears into current clears If there are clears prior to a glClear() call, those clears were flushed (starting a new render pass) and then the clear call's clears would be applied (essentially modifying the loadOps of said render pass). The main downside of the above is that the current glClear() clears don't get a chance to be deferred. This was observed in Chrome which clears an attachment with an emulated format, then switches framebuffers. Additionally, if the render pass had already been started, the deferred clears could have become inlined instead of breaking the render pass. Although, it's unlikely for there to be deferred clears when the render pass is already open. This change first identifies which clears need to go through the draw path (scissored, masked or as workaround for driver bug). It merges the rest of the clears (that don't need the draw path) with the deferred clears. It then checks deferred clears and applies them by either: - vkCmdClearAttachments if mid RP - Start a new render pass and use loadOps, if any draw-based clear needs to follow. - Modify current RP loadOps / defer the clear Afterwards, the draw-based clears are applied. Bug: angleproject:4836 Change-Id: Id4992c78983b199734508c9d4bb18ed3195c91ec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2455167 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Hyunchang Kim d9a88d63 2020-09-28T17:58:31 Vulkan: Support OES_texture_cube_map_array extension Add support for GL_OES_texture_cube_map_array to the Vulkan backend if the underlying ICD supports creation of of cube array ImageViews Bug: angleproject:3584 Test: dEQP-GLES31.functional.fbo.color.texcubearray.* Change-Id: I636cbf347d718abfc1600119b312578370b8e02e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2437989 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 463e02e6 2020-09-29T14:46:46 Vulkan: Constants for unpacked D/S attachment indices kClearValueDepth/StencilIndex is renamed and repurposed in other places where depth and stencil are placed at indices MAX_DRAW_BUFFERS and MAX_DRAW_BUFFERS+1. Bug: angleproject:4836 Change-Id: Idaeff5017d944d786a5f388c4f1ce3a4e3fe9b7d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2437505 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Courtney Goeltzenleuchter fc4e3cf2 2020-09-23T08:41:18 Vulkan: fix ASSERT issue in ResourceSerialFactory Refactor ResourceSerialFactory::issueSerial so that the ASSERT is valid in a threaded environment. Otherwise it's possible for another thread to increment mCurrentUniqueSerial in the middle of the ASSERT. Bug: b/168744561 Change-Id: I7208e8be91b21c50ad4a260d02d69f5b7dab2efe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2426685 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
Shahbaz Youssefi a76b6836 2020-09-17T22:40:42 Vulkan: Support MSRTT depth/stencil resolve VK_KHR_depth_stencil_resolve is used by this change to resolve depth/stencil multisampled-render-to-texture renderbuffers. This extension is not widely supported yet. If it's not present, the depth/stencil resolve operation is silently ignored and the renderbuffer acts as a normal multisampled one. This is not correct, but our primary user (Chrome), and most applications don't care for the resolved depth/stencil data. In fact, it's recommended for the depth/stencil attachment to be invalidated after rendering. Exposing EXT_multisampled_render_to_texture even in the absence of depth/stencil resolve allows the majority of the applications to still take advantage of MSRTT color attachments. Bug: angleproject:4836 Change-Id: I6ba4187344a0c9330d2c77bdc5e2c6fc5483c299 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2417645 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
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>
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>
David Reveman 78d10017 2020-08-16T16:13:59 Vulkan: Enable VK_KHR_bind_memory2 extension Don't assume support for VK_KHR_bind_memory2, enable the extension, if supported, during device creation. Also initialize all required extension functions for the memory allocator. Bug: angleproject:4966 Change-Id: I878939fb3324723675a2b7dec18ab453b2a9fc77 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2359529 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
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>
Shahbaz Youssefi 91a03bd4 2020-08-03T23:24:31 Vulkan: Fix render-to-texture simultaneously bound to two FBOs If a texture is simultaneously attached to two FBOs, one where it's a normal texture and another where it's multisampled-render-to-texture, different render targets must be created for it. If a texture is simultaneously attached to two FBOs, both as multisampled-render-to-texture but with different sample counts, two implicit multisampled images need to be created as well as different render targets. Bug: angleproject:4913 Change-Id: I584ba327e4cb2099ef62f86f5d88719dc156ce13 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2335810 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
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>
Shahbaz Youssefi dcc56215 2020-07-19T01:12:09 Vulkan: Implement GL_EXT_multisampled_render_to_texture This change allows the use of resolve attachments in the Vulkan backend. GL_EXT_multisampled_render_to_texture is implemented using this feature. The infrastructure for specifying resolve attachments is designed with eventual support for GL_EXT_multisampled_render_to_texture2 in mind as well as optimizations to glBlitFramebuffer() and multisampled backbuffers. Proper support for glRenderbufferStorageMultisampledEXT is still missing from this change. All tests use this for the depth/stencil attachment and don't read back the data. Currently, the depth/stencil attachment is created as a normal multisampled image. Bug: angleproject:4836 Change-Id: I110a7f63312ae61a657b6094adf7d97c92bd5843 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2304170 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 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>
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 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>
Tobin Ehlis b50541b2 2020-01-14T09:07:03 Vulkan:Adding key perf trace markers Adding trace markers in performance-critical functions. Primary areas of interest are command buffer processing and cleanup and memory mapping. Bug: b/156403378 Change-Id: Icba53024771711d79f7eee7085bf4dae0e033e63 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2002689 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Tobin Ehlis <tobine@google.com> Commit-Queue: Tobin Ehlis <tobine@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 d705f18f 2020-05-11T13:53:13 Vulkan: Add immediate scissored clears. This allows us to avoid using draw commands with pipelines for scissored clears. This prevents some tests from generating large numbers of VkPipelines. Bug: angleproject:4517 Bug: angleproject:4617 Change-Id: Id4a44000078098a60aa89233cfef30b75727d108 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2194473 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill d657e1d7 2020-04-24T13:13:18 Vulkan: Defer framebuffer clears. This works by storing the deferred clears in the ImageHelper's staging buffers. We apply the deferred clears onto the RenderPass right before we begin to draw. Storing the clears in the ImageHelper solves problems where we clear GL Textures in a Framebuffer and then unbind the Textures and sample from them. Or do other commands like CopyTexImage. Note that because the staging buffer clears only handle full-image clears we need to immediately apply some scissored clears where before we would use the RP. This should be a pretty rare occurrence and it is possible to optimize that in the future. Reduces the RenderPass count in the Manhattan "frame 10" trace from max 22 to max 20. May improve perf slightly on Android or may have effects too small to measure. Should not regress performance. Bug: angleproject:4517 Change-Id: I02150d531022afb903f1058f070937ec6337bd88 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2142711 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jonah Ryan-Davis 3cb9c4be 2020-03-13T13:56:47 Statically link vulkan-loader on Mac Disable angle_shared_libvulkan on Mac since we are the only client. Re-add codepaths to support this. Bug: angleproject:4477 Change-Id: Ie128c83adaae741636541bbfd6105d160d874a8d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2102954 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Tobin Ehlis <tobine@google.com>
Jamie Madill 35e389cc 2020-04-24T13:33:36 Vulkan: Remove unicode character from error string. Will fix presubmit checks on Windows. Bug: angleproject:4586 Change-Id: I36cec3e850c88a015f33d8a0bb7cc8f8c26402d0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2165628 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 492ec932 2020-04-21T13:38:41 Vulkan: Track allocated sampler counts. Helps to diagnose perf bugs where resources are over-allocated. Also can be useful to evaluate caching strategies. Bug: angleproject:4517 Change-Id: I48df5a09fbc394fa0b1712fa8cf28a179665e6e7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2159293 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tobin Ehlis <tobine@google.com>
Charlie Lao 927ea225 2020-04-21T19:42:18 Vulkan: add vulkan error code in the error message If driver returns error code that we do not know, we simply output "unknown vulkan error code". Instead we should at least include the actual errorCode here so that people can search up to see what it is. Also remove the double period at the end of string and added a few other vulkan error strings. Bug: b/154665382 Change-Id: Ic4138e90534b4e7d97520fe10ac1477d2930d9c8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2160130 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Mohan Maiya b7d6949b 2020-04-17T13:36:14 Vulkan: Enable persistently mapped buffer objects The VMA allocator has a handy feature where during memory allocation we can request persistently mapped memory. This saves IOCTL overhead for apps that update buffers frequently. Bug: angleproject:2162 Change-Id: I870d880033beec343efae6de06f1c5935de4c2c1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2155131 Reviewed-by: Tobin Ehlis <tobine@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Tobin Ehlis <tobine@google.com>
Hyunchang Kim 6e0d718a 2020-03-31T18:41:57 Vulkan: Implement device memory sub-allocation Use AMD Vulkan Memory Allocator for device memory sub-allocation. We now have a mempool from which all glBuffer memory is allocated. The CPU overhead involved in repeated IOCTL calls to the kernel is reduced significantly. Bug: angleproject:2162 Change-Id: Id7681ffe2ac3d2853141ebe34c7df7b7fdd0d55e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2124519 Reviewed-by: Tobin Ehlis <tobine@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Hyunchang Kim 449d9d76 2020-03-31T17:27:00 Vulkan: Refactor garbarge collection related parameter Use RendererVk instead of VkDevice as a parameter in garbage collection functions. Bug: angleproject:2162 Change-Id: Ifd53e05223d6d603402c9b7fcfa82fe1f896458c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2131882 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Hyunchang Kim 6281e30d 2020-03-31T15:41:23 Vulkan: Add flush condition for the device memory updated by CPU Memory created using HOST_COHERENT_BIT does not need to be explicitly flushed. Bug: angleproject:2162 Change-Id: Idc2001e2254de616d7e7067410d225d0b521f29f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2131881 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Courtney Goeltzenleuchter 4422d298 2020-03-18T09:54:54 Vulkan: Must call vkFlush while memory is mapped Update to Vulkan validation layers pointed out that vkFlushMappedMemoryRanges needs to be called when the memory is mapped. Bug: b:151820847 Change-Id: I3860306080bca435c063046f9ae20943a8601d17 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2108705 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
Mohan Maiya 78a85f2c 2020-03-16T10:28:59 Vulkan: Request device local memory for glBuffer with GL_STATIC* usage glBuffer objects with GL_STATIC_* usage patterns will now request the storage to be allocated in device local memory. For glBuffer objects with GL_DYNAMIC_* usage patterns we request a host cached memory. Bug: angleproject:4480 Change-Id: I7ca968f5ddfb59e4df3ecd07ae65df2bbf734190 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2102958 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Jamie Madill a741abb9 2020-02-21T16:37:37 Vulkan: Rename CommandGraphResource to Resource. Also renames the h and cpp files to ResourceVk (to keep distinct from other resource.h/cpp files) and renames 'onResourceAccess' to 'retain'. Cleans up a few remaining mentions of the command graph in comments. Bug: angleproject:4029 Change-Id: Ifc8e880c8cea3fc48a4aec4730191c88aa35a076 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2065920 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill ce4918f1 2020-02-19T09:39:44 Vulkan: Sanitize Images & Buffers with non-zero values. Only enabled for specific tests at the moment. This CL allows our tests to sanitizes memory for the robust resource access extension. It is quite slow so should not be enabled by default. Only works for 1 level 2D color textures and buffers. Makes several flaky robust resource initialization tests consistently fail. Controlled via an angle::Feature in FeaturesVk. It works by initializing memory to an abitrary non-zero value: - if newly allocated memory is mappable, we map it in init and set it - if a buffer or texture can be a transfer destination, we use a staging resource - otherwise we don't attempt to initialize the resource. Bug: angleproject:4384 Change-Id: I9b4f347bfcddf3096f491ed0243bef86837feaa0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2043271 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Jamie Madill 3c066404 2020-02-05T12:43:12 Vulkan: Command graph linearization (Step 4). Implements GLES 3.0 functionality for the new command recording style. Tested with angle_end2end_tests. dEQP/CTS testing will come later. Bug: angleproject:4029 Change-Id: Ibdc4f1355a7b880946699ec227fd9807f4a27af9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2040197 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Courtney Goeltzenleuchter d0b4eaf6 2020-01-16T09:38:28 Vulkan: Allow user to specify preferred device On a platform with multiple graphics devices (e.g. laptop with integrated and descrete devices) it's handy to be able to specify the specific device we want ANGLE to use. Setting the environment variable ANGLE_PREFERRED_DEVICE to the device name as returned by VkPhysicalDeviceProperties.deviceName will select that device. Bug: angleproject:4305 Change-Id: Ib16895add2c36a59135942b52401ceb7b6bc0895 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2002737 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 35e6050f 2019-12-30T23:47:51 Vulkan: Correct error message for VK_ERROR_INVALID_SHADER_NV If an invalid shader is generated, generate the appropriate message instead of "Unknown error". Bug: angleproject:3394 Change-Id: I586c99e95cd72daeaf74b4d1eff352942e01d8b7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1982783 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Ian Elliott abc8f277 2019-12-19T10:47:31 Vulkan: Disallow multisampling with a sample count of 1 GLES uses a sample count of 0 to indicate non-multisampling, and a sample count of 1 or greater to indicate multisampling.  While the Vulkan specification seems to support multisampling with a sample count of 1, the following spec language effectively disallows it (even when the underlying Vulkan driver supports it): If the image was created with VkImageCreateInfo::samples equal to VK_SAMPLE_COUNT_1_BIT, the instruction must have MS = 0. The following GLES 3.1 dEQP tests use shaders that look for the sample position, with a sample count of 1: dEQP-GLES31.functional.texture.multisample.samples_1.* For Vulkan drivers that fully support multisampling with a sample count of 1, these tests pass, but get Vulkan validation errors because of the above spec language. This was discussed in the Khronos-private issue tracker (see: https://gitlab.khronos.org/vulkan/vulkan/issues/1925).  The Vulkan working group wondered if ANGLE could live with not supporting a sample count of 1 (but upgrading such requests to the next-largest supported sample count, per the GLES specification).  This change implements that approach. Bug: angleproject:4197 Bug: angleproject:4212 Change-Id: I009ba47b48efe5af464011c7c15022fc01f45e76 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1974842 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
Tobin Ehlis 5fd73782 2019-08-09T11:46:46 Vulkan: Use volk to load vk* func ptrs Thanks to Jamie Madill for some fixes to get all CI test passing w/ volk. This change updates all ANGLE targets that use Vulkan to dyanmically link all of the VK entrypoints using the volk OSS library from https://github.com/zeux/volk. It's only two source files so baking them directly into ANGLE repo. Also it's used in both the tests and libANGLE trees so added to src/common/third_party/volk dir. Updated volk and the renderer to track latest instance and device that were loaded and renderer will refresh vk* function pointers if the current and previous device and/or instance don't match. This prevents errors in the test framework as we transition between backends, especially between VK HW & SwiftShader ICDs. This change rolls the Vulkan Loader forward to use the latest loader version which no longer allows static linking but requires dynamic linking. Bug: angleproject:3740 Bug: angleproject:4092 Bug: angleproject:4162 Bug: angleproject:4210 Bug: angleproject:4225 Change-Id: I8a0b7d24c9545bbfdfaa4b9357a9bfe6793e0140 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1965640 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Tobin Ehlis <tobine@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Renaud Lepage bf47a17e 2019-12-13T01:40:33 Fix GGP build Bug: angleproject:4221 Change-Id: I625b78795dbc826d176660e47af9b51d3f8d417b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1966410 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Hyunchang Kim caa6eccd 2019-10-27T13:46:56 Vulkan: Implement Transform Feedback support via extension Implemented transform feedback extension path. Where VK_EXT_transform_feedback is supported, extension path will be taken over an emulation path. Extension path has advantages in terms of performance. BUG=angleproject:3206 Test: dEQP-GLES3.functional.transform_feedback.* angle_end2end_tests --gtest_filter=TransformFeedbackTest* Change-Id: Ia07c23afb289d9c67073469a97b714ec96f5265a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1882767 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Shahbaz Youssefi 84c074cf 2019-11-20T15:32:44 Vulkan: Simplify AppendToPNextChain use The function is turned into a template to avoid the reinterpret_cast at call sites. Additionally, uses Vulkan's own VkBaseOutStructure instead of a bespoke definition. Bug: angleproject:4027 Change-Id: Ib236d44a12c0363e7e89b9bf2ed5ab8166252730 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1924992 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tobin Ehlis <tobine@google.com>
Jamie Madill c898ec1a 2019-11-04T15:20:18 Add EGL GGP extensions. This CL adds two new extensions: * EGL_ANGLE_ggp_stream_descriptor: Introduces a new attribute to CreateWindowSurface. Allows the app to pass in a stream descriptor to VkCreateSurfaceKHR. Mirrors VK_GGP_stream_descriptor_surface. * EGL_ANGLE_swap_with_frame_token: Introduces a new function 'eglSwapBuffersWithFrameTokenANGLE'. This allows the app to pass a GGP frame token down to vkQueuePresentKHR. Mirrors VK_GGP_frame_token. Bug: angleproject:4078 Change-Id: I4313ac4c264e68999905049f661bc64b44f72fab Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1897315 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Jamie Madill a6206854 2019-10-24T12:55:09 Enable "-Wmissing-field-initializers". This is another warning required by Skia. This one didn't find anything that surprising. Enabling the warning does help enforce code consistency and avoids a bit of possible undefined behaviour. Bug: angleproject:4046 Change-Id: Ifec7f4afad49cd820bf3c0a79df3f46559473ee2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1877477 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tobin Ehlis 08af1c80 2019-10-22T08:58:52 Vulkan:Store full 64bit handle in GarbageObject On 32bit builds we were only storing 32bit handles for non- dispatchable objects. This resulted in the handles getting shrunk from 64-bits which then led to false validation errors. Fixed this by using VK_DEFINE_NON_DISPATCHABLE_HANDLE() macro in GarbageObject instead of VK_DEFINE_HANDLE(). Also MSVC on Win32 didn't like reinterpret_cast<> with the updated 64bit handles so migrated a number of GarbageHandle casts to be c-style which is contrary to style guide, but is preferable to conditional code. Bug: angleproject:3924 Bug: angleproject:3946 Change-Id: Icb4139e34989179e46ac1f0c76269ff49ab1e897 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1873244 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Le Quyen a48f95ab 2019-10-14T14:49:49 Move Vulkan GlslangWrapper code to a shared location. Metal backend will reuse Vulkan's GlslangWrapper code. The Metal backend will use this code to translate glsl to spirv then cross compile to Metal Shading Language using spirv-cross. So the source code of GlslangWrapper should be moved outside vulkan folder. Bug: angleproject:2634 Change-Id: I208062daf0d77756c9d32cfdab925b7dfdf83e05 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1858042 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Tobin Ehlis be1fa7d8 2019-10-16T16:34:57 Vulkan: Enable VK_EXT_line_rasterization Plumbing to make ANGLE use VK_EXT_line_rasterization extension when available. Bug: angleproject:3981 Change-Id: I12913c20bff69ab0b7c16462c10b8b5fd8e1c2a5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1865027 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Alexis Hétu <sugoi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Cody Northrop 6b60dfd8 2019-10-02T07:54:18 Vulkan: Remove image views forced to one mip level textureSize requires the view to reflect actual mip levels, so we can't artificially limit the view based on filtering mode. This CL removes those views. That unearthed a problem where the VK backend wasn't properly implementing non-mipmapped filter modes. There is a blurb in the Vulkan spec about this: There are no Vulkan filter modes that directly correspond to OpenGL minification filters of GL_LINEAR or GL_NEAREST, but they can be emulated using VK_SAMPLER_MIPMAP_MODE_NEAREST, minLod = 0, and maxLod = 0.25, and using minFilter = VK_FILTER_LINEAR or minFilter = VK_FILTER_NEAREST, respectively. So this CL also adds that emulation. Bug: angleproject:3948 Test: TextureSizeTextureArrayTest.BaseLevelVariesInTextureArray Test: dEQP-GLES3.functional.shaders.texture_functions.texturesize.* Change-Id: I81d5c3417e7d9abd0cdd058b935963706024a28f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1835937 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Cody Northrop <cnorthrop@google.com>
Tim Van Patten f750d86a 2019-10-01T17:52:37 Trigger a flush() when the command graph contains too many objects If an App repeatedly issues GL commands like glTextImage2D without a finish/flush/draw, it's possible for ANGLE to exhaust the available Vulkan memory allocations and exceed VkPhysicalDeviceLimits::maxMemoryAllocationCount. When this occurs, the Vulkan validation layers will trigger an error and cause dEQP tests to fail. This change will query the backend if a flush() should be performed during each of the GL delete calls, and perform it if necessary. This will cause a queue submission and a Serial increment, allowing the allocated memory to be freed, preventing the validation errors. Bug: angleproject:3818 Test: KHR-GLES3.copy_tex_image_conversions.forbidden.renderbuffer_cubemap_* Change-Id: I26d0a47aa7bca10c25bc8141f1523afbab0b3b5b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1834781 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tobin Ehlis f22f16d3 2019-07-18T15:10:49 Reland "Vulkan: Use VK repos' internal BUILD.gn files" This is a reland of 552f5fcb0d8fcc615856ce3b678190e1cbdd38e6 There was a missing build dependence causing a build no-op issue which has now been fixed in the upstream Vulkan Validation Layer repo. Primary workaround that need to be re-visted and fixed are: 1. Disabled validation layers on 32-bit Windows 2. Disabled validation layers on 32-bit Android 3. Disabled DebugUtils on Android, using DebugReport instead 4. Using custom VK Loader branch to avoid WDK dependence Original change's description: > Vulkan: Use VK repos' internal BUILD.gn files > > This retires custom BUILD.gn files for the Vulkan Headers, Tools, > Validation-Layers, and Loader repos. They now have integrated BUILD.gn > files so switched ANGLE to use those by default. > Also Validation Layer, Loader, and Tools repos no longer uses codegen > so this speeds up the build overall. > Switched over from old VK_LAYER_LUNARG_standard_validation meta-layer > to VK_LAYER_KHRONOS_validation unified layer. > > This changes includes a temporary workaround to the Vulkan-Loader repo > to remove its Window's build dependence on WDK. There are plans to > remove that depenedence in Loader master, but until then we can use > our custom branch workaround. > It also includes a custom branch for validation layers that includes > some build fixes for ANGLE. > Finally, the layers were crashing on Android when attempting to use > DebugUtils extension so forcing DebugReport on Android for now. > > Bug: angleproject:2449 > Bug: angleproject:3320 > Bug: angleproject:3852 > Bug: angleproject:3924 > Bug: angleproject:3925 > Bug: angleproject:3946 > Bug: chromium:997009 > Bug: chromium:997016 > Change-Id: I48b36acefcc7f2bc930eb72d6fdbc87bca24f833 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1610438 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Tobin Ehlis <tobine@google.com> Bug: angleproject:2449, angleproject:3320, angleproject:3852 Change-Id: I373ada091a1329db5e304874079428d01ba21d52 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1778302 Reviewed-by: Tobin Ehlis <tobine@google.com> Commit-Queue: Tobin Ehlis <tobine@google.com>
Jamie Madill 33ffed01 2019-09-26T10:19:35 Vulkan: Clean up garbage APIs. Instead of dumping resources to a context, we use the release APIs consistently. Refactoring/cleanup change only. Should have very litte impact on runtime behaviour. Bug: angleproject:2464 Change-Id: I2dc7f8316c466f7ccfad50a7b792ba0ee7bc2e49 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1804883 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 29f7916f 2019-09-25T14:37:35 Vulkan: Store current Serial in RendererVk. This gives a stronger ordering on serials than if they're acquired by the ContextVk. Part of the steps of implementing multithreaded GL on Vulkan. Implements a "globalFinish" method in RendererVk that is triggered on ContextVk destruction. This helped fixed some racy object deletion situations where the ContextVk could have queued work that uses deleted objects. Flush all the Contexts before destruction to avoid these hanging deleted objects. Bug: angleproject:2464 Change-Id: I244e9bbf6cd47b272c7cbca45b0fb1eb46d626fc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1791268 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill d2766ce7 2019-08-30T15:26:17 Vulkan: Generalize ICD decision for loader. This will allow a more flexible introduction of other ICDs like SwiftShader. Refactoring change only. Bug: angleproject:3876 Change-Id: I6883225645e0f961f699366368bebccd9812aaec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1775463 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 2b7e2acb 2019-08-30T13:26:37 Vulkan: Move loader defines into BUILD.gn. We shouldn't need the extra loader defines config variable. The defines we need should probably be able to be located in ANGLE entirely. Bug: angleproject:3320 Bug: angleproject:3876 Change-Id: I78f449f44c1709b6d683930f9b9ea3d80016272e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1775462 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Tobin Ehlis aae21ef6 2019-08-29T21:56:06 Revert "Reland "Vulkan: Use VK repos' internal BUILD.gn files"" This reverts commit 0ad1559f3ae95efecaa209f990987d3ce4ebd150. Reason for revert: linux-rel no-op build issue showing up in Chromium integration. Tracking in chromium:997016 Original change's description: > Reland "Vulkan: Use VK repos' internal BUILD.gn files" > > This is a reland of 552f5fcb0d8fcc615856ce3b678190e1cbdd38e6 > > Original change's description: > > Vulkan: Use VK repos' internal BUILD.gn files > > > > This retires custom BUILD.gn files for the Vulkan Headers, Tools, > > Validation-Layers, and Loader repos. They now have integrated BUILD.gn > > files so switched ANGLE to use those by default. > > Also Validation Layer, Loader, and Tools repos no longer uses codegen > > so this speeds up the build overall. > > Switched over from old VK_LAYER_LUNARG_standard_validation meta-layer > > to VK_LAYER_KHRONOS_validation unified layer. > > > > This changes includes a temporary workaround to the Vulkan-Loader repo > > to remove its Window's build dependence on WDK. There are plans to > > remove that depenedence in Loader master, but until then we can use > > our custom branch workaround. > > It also includes a custom branch for validation layers that includes > > some build fixes for ANGLE. > > Finally, the layers were crashing on Android when attempting to use > > DebugUtils extension so forcing DebugReport on Android for now. > > > > Bug: angleproject:2449 > > Bug: angleproject:3320 > > Bug: angleproject:3852 > > Bug: chromium:997009 > > Bug: chromium:997016 > > Change-Id: I48b36acefcc7f2bc930eb72d6fdbc87bca24f833 > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1610438 > > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Jamie Madill <jmadill@chromium.org> > > Commit-Queue: Tobin Ehlis <tobine@google.com> > > Bug: angleproject:2449, angleproject:3320, angleproject:3852 > Change-Id: I9597be99000083b135e19b6ee68d4ae222158e72 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1769036 > Commit-Queue: Tobin Ehlis <tobine@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> TBR=tobine@google.com,syoussefi@chromium.org,jmadill@chromium.org Change-Id: I88afdaff07e9f414f9de02f6d3651eaba9a5045f No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:2449, angleproject:3320, angleproject:3852 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1776920 Reviewed-by: Tobin Ehlis <tobine@google.com> Commit-Queue: Tobin Ehlis <tobine@google.com>
Tobin Ehlis 0ad1559f 2019-07-18T15:10:49 Reland "Vulkan: Use VK repos' internal BUILD.gn files" This is a reland of 552f5fcb0d8fcc615856ce3b678190e1cbdd38e6 Original change's description: > Vulkan: Use VK repos' internal BUILD.gn files > > This retires custom BUILD.gn files for the Vulkan Headers, Tools, > Validation-Layers, and Loader repos. They now have integrated BUILD.gn > files so switched ANGLE to use those by default. > Also Validation Layer, Loader, and Tools repos no longer uses codegen > so this speeds up the build overall. > Switched over from old VK_LAYER_LUNARG_standard_validation meta-layer > to VK_LAYER_KHRONOS_validation unified layer. > > This changes includes a temporary workaround to the Vulkan-Loader repo > to remove its Window's build dependence on WDK. There are plans to > remove that depenedence in Loader master, but until then we can use > our custom branch workaround. > It also includes a custom branch for validation layers that includes > some build fixes for ANGLE. > Finally, the layers were crashing on Android when attempting to use > DebugUtils extension so forcing DebugReport on Android for now. > > Bug: angleproject:2449 > Bug: angleproject:3320 > Bug: angleproject:3852 > Bug: chromium:997009 > Bug: chromium:997016 > Change-Id: I48b36acefcc7f2bc930eb72d6fdbc87bca24f833 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1610438 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Tobin Ehlis <tobine@google.com> Bug: angleproject:2449, angleproject:3320, angleproject:3852 Change-Id: I9597be99000083b135e19b6ee68d4ae222158e72 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1769036 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
James Dong 1d5aaa6c 2019-08-06T11:20:13 Vulkan: support dynamic indices in array of arrays Expands existing struct-sampler rewrite to flatten arrays of arrays. This allows us to support dynamically-uniform array indexing, which is core in ES 3.2. Samplers inside (possibly nested) structs are broken apart as before, and then if the type resulting from merging the array sizes of the field and its containing structs is an array of array, the array is flattened. Also adds an offset parameter to functions taking in arrays to account for this translation. As a result of outer array sizes leaking into function signatures, functions taking arrays of different sizes are duplicated according to how the function is invoked. Bug: angleproject:3604 Change-Id: Ic9373fd12a38f19bd811eac92e281055a63c1901 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1744177 Commit-Queue: James Dong <dongja@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 5f3c98de 2019-08-23T01:05:38 Revert "Vulkan: Use VK repos' internal BUILD.gn files" This reverts commit 552f5fcb0d8fcc615856ce3b678190e1cbdd38e6. Reason for revert: Causing flakiness in "confirm no-op" CQ step. See issue for more details. Bug: chromium:997016 Original change's description: > Vulkan: Use VK repos' internal BUILD.gn files > > This retires custom BUILD.gn files for the Vulkan Headers, Tools, > Validation-Layers, and Loader repos. They now have integrated BUILD.gn > files so switched ANGLE to use those by default. > Also Validation Layer, Loader, and Tools repos no longer uses codegen > so this speeds up the build overall. > Switched over from old VK_LAYER_LUNARG_standard_validation meta-layer > to VK_LAYER_KHRONOS_validation unified layer. > > This changes includes a temporary workaround to the Vulkan-Loader repo > to remove its Window's build dependence on WDK. There are plans to > remove that depenedence in Loader master, but until then we can use > our custom branch workaround. > It also includes a custom branch for validation layers that includes > some build fixes for ANGLE. > Finally, the layers were crashing on Android when attempting to use > DebugUtils extension so forcing DebugReport on Android for now. > > Bug: angleproject:2449 > Bug: angleproject:3320 > Bug: angleproject:3852 > Change-Id: I48b36acefcc7f2bc930eb72d6fdbc87bca24f833 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1610438 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Tobin Ehlis <tobine@google.com> TBR=ynovikov@chromium.org,tobine@google.com,syoussefi@chromium.org,jmadill@chromium.org Change-Id: Iec97ba8cb5c38fa56bfd4c0afb0f7af8d68513ff No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:2449, angleproject:3320, angleproject:3852 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1767363 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Tobin Ehlis 552f5fcb 2019-07-18T15:10:49 Vulkan: Use VK repos' internal BUILD.gn files This retires custom BUILD.gn files for the Vulkan Headers, Tools, Validation-Layers, and Loader repos. They now have integrated BUILD.gn files so switched ANGLE to use those by default. Also Validation Layer, Loader, and Tools repos no longer uses codegen so this speeds up the build overall. Switched over from old VK_LAYER_LUNARG_standard_validation meta-layer to VK_LAYER_KHRONOS_validation unified layer. This changes includes a temporary workaround to the Vulkan-Loader repo to remove its Window's build dependence on WDK. There are plans to remove that depenedence in Loader master, but until then we can use our custom branch workaround. It also includes a custom branch for validation layers that includes some build fixes for ANGLE. Finally, the layers were crashing on Android when attempting to use DebugUtils extension so forcing DebugReport on Android for now. Bug: angleproject:2449 Bug: angleproject:3320 Bug: angleproject:3852 Change-Id: I48b36acefcc7f2bc930eb72d6fdbc87bca24f833 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1610438 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Tobin Ehlis <tobine@google.com>
James Darpinian 7e48c9eb 2019-08-06T17:17:19 Add explicit integer casts WebKit uses the -Wshorten-64-to-32 flag which warns on these cases. Bug: 3439 Change-Id: I8c1de60da0f173ca2036e2120e79b857f5f2775f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1740866 Commit-Queue: James Darpinian <jdarpinian@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Jamie Madill 22511021 2019-08-13T09:17:52 Vulkan: Remove unused GetDepthStencilAspectFlagsForCopy. Was incorrect and causing a Clang warning. Bug: chromium:992863 Change-Id: Ieff7b332ee11a6330bd5879d73b53ad374f40664 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1751622 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jiacheng Lu 758b12fa 2019-07-17T14:55:38 Filter out redundant depth&stencil state updates 1. Compare updating values with active ones at frontend when depth&stencil related gl call happens and do not set any unnecessary dirty bits. 2. Remove d3d and gl backends' checking of depth&stencil states when detect any dirty bits, as it is now being done at frontend. 3. Modification to graphics pipeline description update, make sure it syncs with gl::State initial value. 4. Change gl_vk::CullMode return type to VkCullModeFlagBits, as it only represents single value. Bug: angleproject:3700 Change-Id: Id3aa5186455ee3a10a9c147edad13944e3e41098 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1706903 Commit-Queue: Jiacheng Lu <lujc@google.com> Reviewed-by: Tobin Ehlis <tobine@google.com>
Cody Northrop a2129356 2019-07-23T12:54:13 Vulkan: Add support for 2D array textures Includes changes from jmadill to align with Vulkan backend design. Correctly setting layer count and depth when the texture type is 2Darray. Vulkan requires depth of 1 for 2Darray textures. Bug: angleproject:3189 Change-Id: I0d58c33fcd75b1d768ea0308ac6e54230d8cfcc5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1721169 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Cody Northrop <cnorthrop@google.com>
Shahbaz Youssefi 29fba5e0 2019-07-04T17:08:41 Vulkan: Prepare for variable-stage pipelines Compute (single-stage pipeline) is upcoming, but this change prepares GlslangWrapper to handle any number of stages (mostly). Additionally, this change binds each resource to each stage based on whether it's active, so that we don't hit the per-stage limit of resources by binding every resource to every stage. Bug: angleproject:3633 Bug: angleproject:3562 Change-Id: Ifebf691482846e0371c6e314f514226a4cfee258 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1689330 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>