src/libANGLE/renderer/vulkan/vk_utils.cpp


Log

Author Commit Date CI Message
Yuxiang Qian a1be7e61 2024-11-26T14:39:18 Implement EGL_EXT_surface_compression This patch adds implementation of EGL_EXT_surface_compression to ANGLE, including new API eglQuerySupportedCompressionRatesEXT and adding EGL_SURFACE_COMPRESSION_EXT in EGLQuerySurface and EGLCreateWindowSurface/EGLCreatePlatformWindowSurface. Angle end2end test is added to verify the extension. Bug: angleproject:375496226 Change-Id: I06926930d94485a378fc831d552cf55fe7938a57 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6073355 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 7adbb3e8 2024-11-26T17:06:07 Vulkan: Remove explicit destroy calls Since now SharedPtr will automatically call destroy(device) when last reference goes away, there is no need for explicitly calling destroy(device) any more. Bug: angleproject:372268711 Change-Id: I208b17cf7e090babd51d6f337c20fdfd74c75b6b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6052886 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Charlie Lao d81834b6 2024-11-26T15:25:35 Vulkan: Store VkDevice in vk::SharedPtr So that we don't need to have two versions of destroy() APIs. In previous CLs I had to add another version of destroy() that does not take device argument due to SharedPtr may calls destroy when last reference count goes away. Because we do not have device information at that time, destroy() API was added but mostly just doing assertion that Vulkan object has been explicitly destroyed. With this CL, we now stores device in the SharedPtr so that we no longer need two destroy() APIs. The explicit destroy(device) call will be removed in the next CL. Bug: angleproject:372268711 Change-Id: Idcacbc3a922e17ac3d0f6056466b8f3aa084b02e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6052096 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Neil Zhang 01dee1cb 2024-10-14T15:04:28 Add implementation for GL_EXT_texture_storage_compression Bug: angleproject:352364583 Change-Id: I3dab4c68d5d0206d681e165e991217bd3de8eeb6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6011055 Auto-Submit: Neil Zhang <Neil.Zhang@arm.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 87d61997 2024-11-21T14:20:55 Vulkan: Switch ShaderModule to use SharedPtr This CL gets rid of many vk::RefCounted<vk::ShaderModule> usage which is risky due to it allows you to direct manipulate reference count. Switch to vk::SharedPtr manages the reference counting automatically. Bug: angleproject:372268711 Change-Id: I14f5c509bcbd9ea7d17101637e033652a68710a0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6039117 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Yuxin Hu 44b6203c 2024-09-02T16:23:44 Add new functions defined in VK_KHR_Synchronization2 extension Add vkCmdPipelineBarrier2 and vkCmdWriteTimeStamp2. The other functions introduced in VK_KHR_Synchronization2 are not being used at the moment. Bug: b/356985874 Change-Id: I4f8b432aee9b11debcb8abe8b3089f88ad7a069b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5832709 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi 621bba6c 2024-09-04T09:58:09 Vulkan: Fix device entry points loaded as instance Bug: angleproject:359420106 Change-Id: I970ac7b924013a3c8ea5dd73f90bbe1649969753 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5836783 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Yuxin Hu <yuxinhu@google.com>
Le Hoang Quyen 1bfe5c57 2024-07-30T15:58:47 Metal: partially implement EXT_multisampled_render_to_texture. Implement by implicitly attaching a multisampled texture to the render pass. The content will be preserved across render passes by loading/storing to the implicit multisampled texture. However this won't work if the single sampled texture is used in multiple render passes with different glFramebufferTexture2DMultisampleEXT's sample counts. For that to work we need to implement unresolve step to load the resolve texture's texels into the implicit multisampled texture. That will be implemented in a separate CL. Bug: angleproject:42261786 Change-Id: I12be75af17ce5b98266946846417d0a43fcba455 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5746180 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Shahbaz Youssefi c519a4a6 2024-06-10T15:56:36 Vulkan: Add dynamic rendering features Bug: angleproject:42267038 Change-Id: Ic2cdc277f6bb1bb3ce273a866bdb2ce6f5930355 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5617653 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuxin Hu <yuxinhu@google.com>
Charlie Lao 3bc4e17f 2024-05-22T16:15:23 Vulkan: Pack familyIndex and queueIndex into single uint16_t Practically these are very small number. So we really don't need a uint32_t for each index. The only trick is that even though these indices are uint32_t, some of predefined values are ~1u/~2u which does not fit uint8_t. In this CL, int8_t is used so that all these values are properly downsized and expanded by compiler without branch. Bug: b/337135577 Change-Id: I45ac8ea14c4d7a6f65cb012df70013050f725583 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5560510 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 1a9a703b 2024-05-21T11:14:40 Vulkan: Add DeviceQueueIndex to Context/BufferHelper/ImageHelper This CL adds a utility class DeviceQueueIndex, which encapsulates queueFamilyIndex and the queueIndex into one integer value so that we can pass around to barrier function. vk::Context and BufferHelper and ImageHelper class now keeps mCurrentDeviceQueueIndex instead of mCurrentQueueFamilyIndex. For All contexts by default it gets the default queue from renderer (which is always the one corresponding to Medium priority). For ContextVk, when priority changes it update mCurrentDeviceQueueIndex to match new context priority. Bug: b/337135577 Change-Id: I62cc483cfdb3e974d38db074e671c57299300074 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5555903 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 0636b509 2024-05-06T12:36:20 Vulkan: Move RefCountedEvent GC and recycler to ShareGroupVk (2/3) One of the problem we had with RefCountedEvents is CPU overhead comes with it, and some part of the CPU overhead is due to atomic reference counting. The RefCountedEvents are only used by ImageHelper and ImageHelpers are per share group, so they are already protected by front end context share lock. The only reason we needs atomic here is due to garbage cleanup, which runs in separate thread and will decrement the refCount. The idea is to move that garbage list from RendererVk to ShareGroupVk so that access of RefCountedEvents are all protected already, thus we can remove the use of atomic. The down side with this approach is that a share group will hold onto its event garbage and not available for other context to reuse. But VkEvents are expected to be very light weighted objects, so that should be acceptable. This is the second CL in the series. In this CL, we added RefCountedEventsGarbageRecycler to the ShareGroupVk which is responsible to garbage collect and recycle RefCountedEvent. Since most of ImageHelper code have only access to Context argument, for convenience we also stored the RefCountedEventsGarbageRecycler pointer in the vk::Context for easy access. vk::Context argument is also passed to RefCounteEvent::init and release function so that it has access to the recycler. The garbage collection happens when RefCountedEvent is needed. The per renderer recycler is still kept to hold the RefCounteEvents that gets released from ShareGroupVk or when it is released without access to context information. Bug: b/336844257 Change-Id: I36fe5d1c8dacdbe35bb2d380f94a32b9b72bbaa5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5529951 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Charlie Lao 3d04180c 2024-05-02T17:30:02 Vulkan: Add a dedicated garbage list for RefCountedEvents Previously each individual RefCountedEvent is wrapped into a GarbageObject. That is the reason behind RefCountedEvent being a subclass from WrappedObject, since vk::GetGarbage call requires garbage object is a subclass of WrappedObject. This CL adds a new garbage list dedicated for RefCountedEvents, named mRefCountedEventGarbageList. With this new change, we no longer limited by the vk::GetGarbage requirements since it no longer called for RefCountedEvents. RefCountedEventCollector is a vector of RefCountedEvents and every time a RefCountedEvent needs to be released, it adds into the collector. Then the event collector entire thing is treated like a garbage object and gets ResourceUse tracked and added into mRefCountedEventGarbageList. This list gets walked and cleaned when GPU is completed. This CL is also a preparation for later CLs that adds event recycle support. Bug: b/336844257 Change-Id: I4eff69b66922dfe5521b6994f240e967ff3726bd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5516458 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Charlie Lao a96e9197 2024-04-25T10:35:02 Vulkan: Add RefCountedEvent class and VkCmdSetEvent call This CL defines RefCountedEvent class that adds reference counting to VkEvent. CommandBufferHelper and ImageHelper each holds one reference count to the event. Every time an event is added to the command buffer, the corresponding RefCountedEvent will be added to the garbage list which tracks the GPU completion using ResourceUse. That event garbage's reference count will not decremented until GPU is finished, thus ensures we never destroy a VkEvent until GPU is completed. For images used by RenderPassCommands, As RenderPassCommandBufferHelper::imageRead and imageWrite get called, an event with that layout gets created and added to the image. That event is saved in RenderPassCommandBufferHelper::mRefCountedEvents and that VkCmdSetEvents calls are issued from RenderPassCommandBufferHelper::flushToPrimary(). For renderPass attachments, the events are created and added to image when attachment image gets finalized. For images used in OutsideRenderPassCommands, The events are inserted as needed as we generates commands that uses image. We do not wait until commands gets flushed to issue VkCmdSetEvent calls. A convenient function trackImageWithEvent() is added to create and setEvent and add event to image all in one call. You can add this call after the image operation whenever we think it benefits, which gives us better control. (Note: Even if forgot to insert the trackImageWithEvent call, it is still okay since every time barrier is inserted, the event gets released. Next time when we inserts barrier again we will fallback to pipelineBarrier since there is no event associated with it. But that is next CL's content). This CL only adds the VkCmdSetEvent call when feature flag is enabled. The feature flag is still disabled and no VkCmdWaitEvent is used in this CL (will be added in later CL). Bug: b/336844257 Change-Id: Iae5c4d2553a80f0f74cd6065d72a9c592c79f075 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5490203 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi efd41bd2 2024-03-15T13:25:03 Vulkan: Rename ResourceVk.* to vk_resource.* This file adds helpers to namespace vk, so its name is changed for consistency with other namespace vk files. Bug: angleproject:8564 Change-Id: I6525e7609eb9385f2a3eecaa7c52b7417fda7f12 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5370108 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 914fe61b 2024-03-15T13:20:49 Vulkan: Rename RendererVk.* to vk_renderer.* Done in a separate CL from the move to namespace vk to avoid possible rebase-time confusion with the file name change. Bug: angleproject:8564 Change-Id: Ibab79029834b88514d4466a7a4c076b1352bc450 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5370107 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Shahbaz Youssefi 60aaf4a0 2024-03-14T12:58:56 Vulkan: Move renderer to namespace vk This class is agnostic of EGL. This change moves it to namespace vk for use with the OpenCL implementation Bug: angleproject:8564 Change-Id: I57f7807d6af8b3d5d7f8efbaf8b5d537a930f881 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5371324 Reviewed-by: Austin Annestrand <a.annestrand@samsung.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 6607a2b9 2024-01-17T15:58:20 Vulkan: Add support for VK_EXT_vertex_input_dynamic_state Hook into VK_EXT_vertex_input_dynamic_state so pipeline states that differ only in vertex input state can reuse existing pipelines. Bug: angleproject:7162 Tests: StateChangeTestES3.Vertex* Change-Id: Icd3134dee93fc5fc2e9d284fcfa8c674b62faec8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5207462 Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 2608c622 2023-10-06T13:32:49 Vulkan: Refactor SharedGarbageList into templated class This CL mostly involves non-functional changes to prepare for next CL. No behavior change is expected. This CL wraps the garbage list into its own templated class which maintains std::queue and tracks number bytes in the queue etc. This CL also renames SharedBufferSuballocationGarbageList to BufferSuballocationGarbageList to reduce verbosity a bit. This CL deleted GarbageAndQueueSerial and GarbageQueue since they are no longer being used. This renames vk::GarbageList to vk::GarbageObjects to reduce name confusion with SharedGarbageList. Bug: b/302739073 Change-Id: I7370c147847ffe69ad8aa3b48251d8b5762f97f9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4919816 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Hailin Zhang <hailinzhang@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi b2e6a196 2023-09-11T15:27:20 Vulkan: Use VK_EXT_host_image_copy for texture uploads Of all the scenarios where host image copy may be useful, this is likely the most common case. There are numerous conditions for when the copy may be done on the host: - The image format must support it, - It must be unused by the GPU, - It must not have any pending updates (this can potentially be mitigated if needed), and - It must be in a host-copyable layout. However, many texture uploads are done: - To compressed formats, where support is highly likely, - On init, where: - the image is never previously used, - the image has no previous uploads - the image is in the UNDEFINED layout which satisfies the conditions above. As a result of this change, when the upload is done on the host, creation of a temp buffer is avoided which greatly reduces memory pressure (specially during app loading which is when most texture data is uploaded) and may even improve performance (due to avoiding a double copy). Testing the first 3 frames of the following traces with a SwiftShader implementation shows the amount of buffer allocated for staged uploads changed as such: - Black Desert: 185MB -> 65MB - Genshin Impact: 125MB -> 12MB - Asphalt 9: 138MB -> 0MB Bug: angleproject:8341 Change-Id: Id71dcc4a7a0f8b67960d2d283fe9d19ce7429a03 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4856676 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi b4852ef9 2023-02-08T14:18:06 Vulkan: Drop support for Vulkan 1.0 Bug: angleproject:7959 Change-Id: Ib673679ea1a503af22b37092dbff1ee1fd34fba6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4233092 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com>
Amirali Abdolrashidi e7418836 2023-08-16T14:25:52 Vulkan: Add context flushing as OOM fallback * As a new fallback for out-of-memory errors, if an allocation results in device OOM, the context is flushed and the allocation is retried. * Functions related to buffer/image allocations now return a VkResult value instead of angle::Result, which will be bubbled up to a higher level for safer handling. * The OOM is no longer handled at the level where the allocation happens, but is moved up to the context. * Added two functions to ContextVk for allocating memory for images and buffer suballocations, which also include the fallback options. * initBufferAllocation(): Uses BufferHelper::initSuballocation() * initImageAllocation(): Uses ImageHelper::initMemory() * Moved initNonZeroMemory() out of the following functions: * BufferHelper::initSuballocation() * Moved to ContextVk::initBufferAllocation(). * ImageHelper::initMemory() * Moved to ContextVk::initImageAllocation(). * Also moved to new function: ImageHelper::initMemoryAndNonZeroFillIfNeeded(). This function replaced the rest of initMemory() usages outside initImageAllocation(). * New macros for memory allocation * VK_RESULT_TRY() * If the output of the command inside it is not VK_SUCCESS, it will return with the error result from the command. * VK_RESULT_CHECK() * If the output of the command inside it is not VK_SUCCESS, it will return with the input error. * Added a test in which allocation would fail due to too much pending garbage without the fix on some platforms. The test ends once there has been a submission. * New suite: UniformBufferMemoryTest * Added a similar test for flushing texture-related pending garbage. * New suite: Texture2DMemoryTestES3 Bug: b/280304441 Change-Id: I60248ce39eae80b5a8ffe4723d8a1c5641087f23 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4787949 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jeff Vigil 1bd45c4f 2023-07-17T14:18:53 Add tiling mode for GL_EXT_memory_objects Add set and get TexParameter for pName GL_TEXTURE_TILING_EXT Add test case to VulkanImageTest for import LINEAR memory object Bug: angleproject:8274 Change-Id: I4432093e41f45e3926a27e3dee00d48c0438cae5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4752793 Reviewed-by: Jeff Vigil <j.vigil@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: mohan maiya <m.maiya@samsung.com>
Mohan Maiya 8b680c93 2023-07-07T09:24:44 Vulkan: Bug fix in GetAvailableValidationLayers(...) GetAvailableValidationLayers(...) had a bug where it did not account for a subset of kVkValidationLayerNames being available. Bug: angleproject:8247 Change-Id: Id7bc3570b2caf5550ca9d011a3ba9429702af8af Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4673189 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Amirali Abdolrashidi 232506e1 2023-05-15T19:19:39 Vulkan: Free the garbage memory before realloc The previous CL added the feature of freeing garbage memory in the event of device OOM. However, it was for image allocations only. * Extended finishing commands and freeing the garbage to buffers. * Added unit test to allocate buffer after freeing memory space on the device. Bug: b/280304441 Change-Id: I540b27a41b34d1ceb1cd3119213341c9f290ea38 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4540209 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Cody Northrop ec308b35 2023-05-15T15:03:10 Vulkan: Add feature to limit sample count to 2 This CL adds a feature called `limitSampleCountTo2`. Using it will have the Vulkan backend limit max samples to 2. Why 2? That's the minimum required in Vulkan to multisample without error. Here's an example validation error: vkCmdResolveImage: srcImage sample count is VK_SAMPLE_COUNT_1_BIT. The Vulkan spec states: srcImage must have a sample count equal to any valid sample count value other than VK_SAMPLE_COUNT_1_BIT. https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdResolveImage-srcImage-00257 Using a limit as opposed to forcing a value allows non-multisampling (sample count of 1) to continue working. To see how tests fare when the feature is set, see the following test results that force the value on: https://chromium-review.googlesource.com/c/angle/angle/+/4534098/4 Test: adb shell setprop debug.angle.feature_overrides_enabled limitSampleCountTo2 Bug: b/279498079 Bug: angleproject:8162 Change-Id: I1df2822709151e6084c32055b5aff444e0b10db5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4518562 Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Greg Schlomoff <gregschlom@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Alexey Knyazev b052a5bf 2023-03-31T00:00:00 Vulkan: Implement polygon mode extensions * NV_polygon_mode * ANGLE_polygon_mode Bug: angleproject:1791 Bug: angleproject:8132 Change-Id: I2beffdad0c1569546020b78a9c6d9b8ea87c2100 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4498687 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Shahbaz Youssefi 5c04f18a 2023-04-24T16:18:24 Vulkan: Remove DisplayVk param from ToEGL It's no longer used Bug: angleproject:3041 Change-Id: I5063152d1598aa5d40d94bbf5c643a1288589037 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4470387 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 144f2d2c 2023-04-24T12:52:27 Vulkan: Use thread-local space for EGL errors The assumption in anglebug.com/3041 that ANGLE is "single-threaded anyway" no longer holds. Bug: angleproject:3041 Change-Id: I613395c8003cad60764362d2776aaf7b6804b788 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4468107 Reviewed-by: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Yiwei Zhang 059efd15 2023-04-27T18:37:05 Vulkan: use any available memory type for external For external memory import, compatible memory types are decided by the Vulkan driver since the memory has been allocated externally. There are usually special requirements against external memory. e.g. AHB allocated with CPU R/W often usage bits is only importable for non-device-local heap on some AMD systems. So if angle requests for device-local, it'd be unable to find a compatible memory type for import. This change updates to pick the first available type on the external fallback code path. Bug: b/279862309 Test: android.media.cts.DecodeAccuracyTest on venus atop radv Change-Id: I0fd5ceb6fe633f591cbcdb01d246803fe0130796 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4484422 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 2f19bb74 2023-03-16T16:03:29 Reland "Vulkan: Reactivate already started render pass when possible" This is a reland of commit ad9537af7f2bb5e22bc73f4e833fd3789adaa217 Original change's description: > Vulkan: Reactivate already started render pass when possible > > In some usage case (such as lineage_mobile), we are seeing in the middle > of render pass, app switch to another fbo just to issue a glClear() > call, which the clear call itself gets deferred. Application then switch > back to the original frame buffer. Before this CL, the render pass gets > recreated due to frame buffer binding change, even though the clear gets > deferred and new render pass and the previous render pass are > essentially the same. This CL detects this situation and reactivate the > current render pass instead of creating a new one. With this CL, > lineage_m app trace reduces frame time from 3.86ms to 3.7ms, and only > one render pass is used instead of two. > > This CL also allows the render pass started by BlitFramebuffer reused by > subsequent draw calls. Asphalt_9 is hitting this use pattern and this CL > reduces frame time by 0.1245 ms (from 5.6203 ms to 5.4958 on pixel 7 > pro) > > Bug: b/273808966 > Change-Id: I48c2671cbef3ff9d6cf59caae88c37c77828ee07 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4348713 > Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Charlie Lao <cclao@google.com> Bug: b/273808966 Change-Id: Ice9062122ae320b1a0108ff981bc65bd13b2ada0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4406888 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Amirali Abdolrashidi a7bd3f53 2023-03-31T16:57:35 Fix the retrace issue for VMA image suballocation After adding the VMA image suballocation feature, VVL errors were seen when using the retracing script for some traces, causing failure. After analysis, it was seen that the functionality of the allocation differs from the original method when it comes to non-zero memory allocation. * In allocateAndBindMemory(), the memory property flags from the allocated memory are returned to be used for non-zero memory feature usage. * Added mapMemoryAndInitWithNonZeroValue() to ImageMemorySuballocator, which is used when allocateNonZeroMemory is enabled and the allocated memory is host-visible. * Merged the following into ImageHelper::initializeNonZeroMemory(): * mapMemoryAndInitWithNonZeroValue() * InitMappableDeviceMemory(); used when VMA image suballocation is disabled. * Moved onMemoryAlloc() inside allocateAndBindMemory(). Test: retrace_restricted_traces.py Bug: b/277618656 Bug: angleproject:8058 Change-Id: If411a073e900c1c034d40a99e3fffefe30c82548 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4391403 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Charlie Lao 41f0a321 2023-04-03T21:58:43 Revert "Vulkan: Reactivate already started render pass when possible" This reverts commit ad9537af7f2bb5e22bc73f4e833fd3789adaa217. Reason for revert: Suspected cause for flakiness. anglebug.com/8118 Original change's description: > Vulkan: Reactivate already started render pass when possible > > In some usage case (such as lineage_mobile), we are seeing in the middle > of render pass, app switch to another fbo just to issue a glClear() > call, which the clear call itself gets deferred. Application then switch > back to the original frame buffer. Before this CL, the render pass gets > recreated due to frame buffer binding change, even though the clear gets > deferred and new render pass and the previous render pass are > essentially the same. This CL detects this situation and reactivate the > current render pass instead of creating a new one. With this CL, > lineage_m app trace reduces frame time from 3.86ms to 3.7ms, and only > one render pass is used instead of two. > > This CL also allows the render pass started by BlitFramebuffer reused by > subsequent draw calls. Asphalt_9 is hitting this use pattern and this CL > reduces frame time by 0.1245 ms (from 5.6203 ms to 5.4958 on pixel 7 > pro) > > Bug: b/273808966 > Change-Id: I48c2671cbef3ff9d6cf59caae88c37c77828ee07 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4348713 > Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Charlie Lao <cclao@google.com> Bug: b/273808966 Change-Id: I81cc2dcacb52466808b2ccf5819feda466c39fc5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4396502 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Auto-Submit: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao ad9537af 2023-03-16T16:03:29 Vulkan: Reactivate already started render pass when possible In some usage case (such as lineage_mobile), we are seeing in the middle of render pass, app switch to another fbo just to issue a glClear() call, which the clear call itself gets deferred. Application then switch back to the original frame buffer. Before this CL, the render pass gets recreated due to frame buffer binding change, even though the clear gets deferred and new render pass and the previous render pass are essentially the same. This CL detects this situation and reactivate the current render pass instead of creating a new one. With this CL, lineage_m app trace reduces frame time from 3.86ms to 3.7ms, and only one render pass is used instead of two. This CL also allows the render pass started by BlitFramebuffer reused by subsequent draw calls. Asphalt_9 is hitting this use pattern and this CL reduces frame time by 0.1245 ms (from 5.6203 ms to 5.4958 on pixel 7 pro) Bug: b/273808966 Change-Id: I48c2671cbef3ff9d6cf59caae88c37c77828ee07 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4348713 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Alexey Knyazev 3fed0866 2023-02-22T00:00:00 Implement EXT_texture_mirror_clamp_to_edge Support GL_MIRROR_CLAMP_TO_EDGE_EXT address mode when native support is available. Adjusted validation, sorted switch cases by target enums order. Added new TextureMirrorClampToEdge* end2end tests. Drive-by: fixed texture address computation for integer formats with GL_MIRRORED_REPEAT on D3D11. Fixed: angleproject:7968 Change-Id: Iaf29c8b4b32a7630c2a871f832d171f4bc4e2672 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4289137 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi 7d8e2778 2023-02-13T10:04:08 Vulkan: Remove usage of VK_EXT_external_memory_host This extension is no longer used by ANGLE Bug: angleproject:7959 Change-Id: If6c0e89e63b8b06fd03f7b6a0b083a18bada34fe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4244599 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 54951da2 2022-12-18T17:11:33 Vulkan: Refactor extension vs core version checks Extensions are now grouped based on promotion-to-core status, and initialization code is generally cleaned up. ANGLE currently doesn't attempt to use a core version above Vulkan 1.1, as extensions are always assumed to be exposed even if promoted to core in later versions. With this change, it would be simpler to use a newer core version if ever necessary. Bug: angleproject:7959 Change-Id: Ia5fd3e06c18f7289e9e5a63af0f039a6dc89c687 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4224582 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 2618a9bc 2023-02-08T14:14:02 Vulkan: Fix fragment shading rate entry point init The function to initialize vkGetPhysicalDeviceFragmentShadingRatesKHR was accidentally initializing vkGetPhysicalDeviceExternalSemaphorePropertiesKHR. Bug: angleproject:7172 Change-Id: I2c76e1b88c5ce2e996d5581731010053821e6f7a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4233091 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: mohan maiya <m.maiya@samsung.com>
Charlie Lao b96f3abd 2023-02-03T13:12:29 Vulkan: Make Context::mLastSubmittedSerial to QueueSerial Right now Context::mLastSubmittedSerial and mLastFlushedSerial are all Serial type instead of QueueSerial. Most places we do need QueueSerial. This CL changes them to QueueSerial type. This simplifies and improves code readability. No actual functional change is expected with this CL. Bug: b/267806287 Change-Id: Ib00cae2637ee9ed95e5fc00060c63017b04e26c5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4219944 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Amirali Abdolrashidi 13aee254 2023-01-13T14:01:56 Move memory allocation info vars to separate class * Moved the RendererVk variables related to memory allocation to a new class, MemoryAllocationTracker. * Note: The existing variable "mMemoryAllocationTracker" has been renamed to "mMemoryAllocationRecord" to avoid confusion. * Added a custom locale using the class MemoryLogNumberFormat, since the original method did not include formatting on some Android devices. Bug: b/262029018 Change-Id: I23acf37119da02e6430de6b5d360307982ecf9bb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4174738 Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ivan Neulander <ineula@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Amirali Abdolrashidi 48e40ef6 2023-01-06T13:35:21 Add per-heap memory allocation trackers * For each member of MemoryAllocationType, we now have a per-heap counter to keep track of the allocation size in each available heap. * mActivePerHeapMemoryAllocationsSize * mActivePerHeapMemoryAllocationsCount (debug mode only) * Added the memory type index to onMemoryAlloc() and onMemoryDealloc() as an input. It can then be used to determine the used memory heap index for that allocation using the memory properties defined in the renderer. * checkForCurrentMemoryAllocations() will now log the heap index of the current memory allocations in debug mode and during an OOM crash. * logPendingMemoryAllocation() will now log the heap index of the pending allocation during an OOM crash. * Renamed constexpr values used for tracking for more consistency. * kTrackMemoryAllocation -> kTrackMemoryAllocationSizes * kDebugMemoryAllocationLogs -> kTrackMemoryAllocationDebug Bug: b/262029018 Change-Id: I178a3556b3107edc0c72c6b23ea2f2d6b12da947 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4149431 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Ivan Neulander <ineula@google.com>
Shahbaz Youssefi 2550fe9a 2023-01-14T21:21:24 Vulkan: Drop usage of VK_EXT_debug_report This extension has been deprecated for 6 years in favor of VK_EXT_debug_utils. Bug: angleproject:7959 Change-Id: I51923a6821a6a18854ef94e0ca85c328bc8c6da5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4167833 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi cd540095 2022-12-12T13:13:14 Vulkan: Add memory log at allocation error * Added logging memory allocation information in handleError() in the event of an error from ANGLE_VK_TRY. * Used for the handleError() in ContextVk. * Updated the name and message of the function to log allocations. * checkForCurrentMemoryAllocations() * Added logging memory heap stats, including budget and usage. * logMemoryHeapStats() * In the renderer, added the feature flag indicating whether the platform supports the memory budget extension. * Uses VK_EXT_memory_budget. * Added the enum class MemoryLogSeverity, which is used to select the severity level of the memory log. * Added logging pending memory allocation information. * logPendingMemoryAllocation() * If the last unsuccessful memory allocation was unsuccessful, its information will be added to the log. Bug: b/262029018 Change-Id: I97343c1553936aed23d763f3e0c00d495f9ee810 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4089531 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Kaiyi Li <kaiyili@google.com>
Amirali Abdolrashidi 58d7ace2 2022-11-22T16:08:07 Vulkan: Add memory allocation log support in debug * Added a memory tracker to the renderer object to keep track of the memory allocations and deallocations in more detail. * This feature is used for debugging only. * To enable it, set angle_enable_memory_alloc_logging=true in GN args (added in renderer/vulkan/BUILD). * It is related to ANGLE_ENABLE_MEMORY_ALLOC_LOGGING in the code. * The tracker are updated in the memory allocation tracking functions if the feature is enabled. (The counter is always updated, even if the feature is disabled.) * At the end of a RendererVk object, it checks for and logs any remaining allocated memory from MemoryAllocationType members. * The data is stored in the map object "mMemoryAllocationTracker". The key used for it is currently of type angle::BacktraceInfo. * If angle_enable_unwind_backtrace_support is disabled, or not on Android, the key is an empty object. * MemoryAllocInfoMapKey is used as a key to access the allocation information. Bug: b/242641395 Change-Id: If701a4bdea2f8738a830ee47e0c7c5cdacf95b87 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4050103 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Charlie Lao 2e5ca217 2022-11-18T10:44:49 Vulkan: Let each current context has its own QueueSerial. This CL makes every current context has its own queueSerial. At context creation time or when context becomes current, it allocates a QueueIndex from renderer. When it becomes non-current, it releases QueueIndex for others to reuse. This way we significantly reduces the max number of QueueIndexs for reasonable usage. Each CommandBuffer has its own unique QueueSerial and we use that to determine if a resource is being used by the given CommandBuffer. The QueueSerial for RenderPassCommands is deferred until renderPass starts, and when we generate queueSerial for renderPassCommands, we also reserve a range of serials for outsideRenderPassCommands so that we can do incremental submission of outsideRenderPassCommands without need to close renderPassCommands. In rare situation, if that reserved serials runs out, we also close renderPassCommands to ensure the ordering of serials matches ordering of command buffers. With per current context queue serial, this CL is able to set resource queue serial as it is being used. This CL completely removes usage of ResourceUseList class since it was introduced due to deferred setSerial. This CL also get rid of refCount from ResourceUse since there we no longer add it to a ResourceUseList. With that, we also able to remove SharedResourceUse class since access to ResourceUse itself is now thread safe since we are able to make a copy of it when we add it to GarbageList. Because RenderPassCommands now has its own unique QueueSerial as it encodes command, we can use it to detect if a resource is being used by it or not, thus this CL also removes usage of CommandBufferID. Bug: b/255414841 Change-Id: I36dcbeaa7bc996f04e6c04bf9ad44cd0d630f61a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4038096 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 7dd8478e 2022-11-17T10:11:02 Vulkan: Make ResourceUse::serial an FastVector of Serials In preparation for per context queue serial, this CL makes ResourceUse::serial a FastVector of Serial. Right now we still limited to one serial index so that it still work the same way as before. This CL adds necessary data type and change the function names to reflect that tracking GPU progress needs a ResourceUse object instead of a single Serial number. Bug: b/255414841 Change-Id: Ic60cdf5ec8da45d1821f65a55947f5c553f65737 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4034548 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Amirali Abdolrashidi b2f55ec3 2022-11-14T16:07:19 Vulkan: Add memory allocation/deallocation counter * Added a counter to the renderer object to keep track of the memory allocations and deallocations per allocation type. * The counters are updated with the functions onMemoryAlloc() and onMemoryDealloc(), which can be added next to the allocation or deallocation point. * Currently used for buffer memory and image memory. * Removed some of the redundant arguments from vk_helper and suballocation functions. Bug: b/242641395 Change-Id: I58b38f619df7bef0ba5fa3373a8db5aed0ef142c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4014164 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 71d28a9b 2022-11-02T13:19:20 Vulkan: Remove unused ShaderAndSerial The serial in the ShaderAndSerial is unused. This CL removed ShaderAndSerial and replaced with ShaderModule directly. Bug: b/257116399 Change-Id: I50d42af7818a12888309a80423531d75135e0bfd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3998747 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi eaa71709 2022-10-14T11:47:07 Vulkan: s/ContextVk/Context in pipeline creation With VK_EXT_graphics_pipeline_library, pipeline creation may happen on a thread. This change prepares the interface such that only a vk::Context is needed, instead of ContextVk. Bug: angleproject:7369 Change-Id: Ib7e9e7e140e27a4af71bffee069c88e3d7f47dfa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3956935 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya dbbfdd22 2022-10-06T13:39:20 Vulkan: Bug fix in GL_QCOM_shading_rate Don't initialize "vkCmdSetFragmentShadingRateKHR" before creating VkDevice as it leads to a nullptr assertion in RendererVk::canSupportFragmentShadingRate. Separate out instance and device function pointer initializations. Bug: angleproject:7172 Change-Id: I55b5b41313857a2861a197f17d7f88b71aec907f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3938443 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi ba3b4515 2022-09-15T01:06:51 Vulkan: Implement GL_ANGLE_logic_op Enabled if the logicOp device feature is available. According to gpuinfo, it's pretty much universal except for ARM. Bug: angleproject:7654 Change-Id: I4808b519fdd6273b2f8c1bb17f59517eb65bfe8d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3898317 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya aa2a558e 2022-08-23T09:47:02 Vulkan: Add support for setting timestamp surface attribute On Android the EGL wrapper handles most of the functionality required by EGL_ANDROID_get_frame_timestamps. However if for some reason the swapchain is recreated, the timestamp state would be lost resulting in stuttering. Introduce EGL_ANGLE_timestamp_surface_attribute extension that adds support for toggling the EGL_TIMESTAMPS_ANDROID attribute of a surface. Cache this state and recreate the swapchain accordingly. Bug: angleproject:7489 Test: EGLSurfaceTest.TimestampSurfaceAttribute* Test: dEQP-EGL.functional.get_frame_timestamps* Change-Id: I3660f7137c006d904164d243a682a4ff520eabd8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3753396 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Charlie Lao 8df0c53e 2022-07-11T16:56:26 Vulkan: Split suballocation out into it's own file Right now Suballocation and BufferBlock classes are in vk_utils.h, which is included by other header files. This made it difficult to have these two classes use variables defined in other headers. And vk_utils.h is really designed for utilities, it isn't the best place for bufferBlock/suballocation by definition. This CL split out suballocation code into its own file to make future CLs much easier. No functional change is expected other than move the code around. Bug: b/237686097 Change-Id: I36733468b4bed152a19d9c9bca8e7459c11c3b43 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3756761 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mark Lobodzinski fb3e2def 2022-05-24T15:47:01 Extend labelObject functionality Modify interface to fully support labelObject return codes. Fix issues with texture implementation, including handling deferred Vulkan object creation. Bug: b/229105865 Change-Id: I0c64b72dd0b54642fb643ee7f5ccbb2a134c6787 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3703184 Commit-Queue: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Dan Field 4b9eb4ba 2022-06-03T09:22:41 Optionally support vulkan_memory_allocator 3.x Incompatible API is guarded behind a new define, ANGLE_VMA_VERSION. This allows a soft migration for Chromium and Fuchsia, while allowing clients like Flutter to roll to a new version that is compatible with its revision of Skia. Bug: chromium:1332566 Change-Id: I68cafde13e50445aa8eea2f18203143659a1c627 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3688835 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Dan Field <dnfield@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mark Lobodzinski 7fb021b0 2022-05-12T16:19:14 Reland "Add Vulkan backend support for texture labels" This is a reland of commit 1afb80587e302e2ce9a901a69fd66e5ef98a73b6 Added check to ensure vkSetDebugUtilsObjectName fcn ptr is valid before use. Fixes failures on mac-swangle-chromium-try-x64. Original change's description: > Add Vulkan backend support for texture labels > > Add onLableUpdate support for textures in the Vulkan backend. > > Bug: b/229105865 > Change-Id: Id9e5b2b81352e97b7843a63f27709739005dc2f3 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3645854 > Reviewed-by: Ian Elliott <ianelliott@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Ian Elliott <ianelliott@google.com> Bug: b/229105865 Change-Id: I994da6db2771671c204e4ab01c69912c1be4a48f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3674296 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
Shahbaz Youssefi 28b4c378 2022-05-27T15:45:59 Vulkan: Pipeline creation feedback in perf counters Bug: angleproject:5881 Change-Id: I42917cab3c97abb50a14035972a96728dcb990b9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3672851 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Kai Ninomiya 7ad48b84 2022-05-26T00:23:35 Revert "Add Vulkan backend support for texture labels" This reverts commit 1afb80587e302e2ce9a901a69fd66e5ef98a73b6. Reason for revert: Null-dereference crash starting here: https://ci.chromium.org/ui/p/chromium/builders/ci/mac-swangle-chromium-x64/26323/blamelist (see angle blamelist) Crash reason: EXC_BAD_ACCESS / KERN_INVALID_ADDRESS Crash address: 0x0 Process uptime: 24 seconds Thread 0 (crashed) 0 0x0 rax = 0x0000011c0113c000 rdx = 0x0000011c09094590 rcx = 0x0000000000000006 rbx = 0x0000011c0e2a0000 rsi = 0x00007ffedfc11500 rdi = 0x0000011c01378010 rbp = 0x00007ffedfc11540 rsp = 0x00007ffedfc114f8 r8 = 0x0000000000000006 r9 = 0x0000000123a6ccc4 r10 = 0x0000011c011018d0 r11 = 0x00007ffdbc1a4834 r12 = 0x0000000000000006 r13 = 0x0000011c090944b0 r14 = 0x0000011c0e34c000 r15 = 0x00007ffedfc11550 rip = 0x0000000000000000 Found by: given as instruction pointer in context 1 libGLESv2.dylib!gl::Context::objectLabel(unsigned int, unsigned int, int, char const*) + 0x156 rbp = 0x00007ffedfc116a0 rsp = 0x00007ffedfc11550 rip = 0x00000001357b38e6 Found by: previous frame's frame pointer 2 libGLESv2.dylib!_GL_ObjectLabelKHR + 0xa5 rbp = 0x00007ffedfc116f0 rsp = 0x00007ffedfc116b0 rip = 0x000000013578e7e5 Found by: previous frame's frame pointer 3 Chromium Framework!gpu::gles2::GLES2DecoderPassthroughImpl::DoBindTexture(unsigned int, unsigned int) + 0x1ea rbp = 0x00007ffedfc11780 rsp = 0x00007ffedfc11700 rip = 0x000000011e7dcd4a Found by: previous frame's frame pointer Original change's description: > Add Vulkan backend support for texture labels > > Add onLableUpdate support for textures in the Vulkan backend. > > Bug: b/229105865 > Change-Id: Id9e5b2b81352e97b7843a63f27709739005dc2f3 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3645854 > Reviewed-by: Ian Elliott <ianelliott@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Ian Elliott <ianelliott@google.com> Bug: b/229105865 Change-Id: I5a5e00084e1320a486c43fec9d41b9ae6cb2b1db Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3669657 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Mark Lobodzinski 1afb8058 2022-05-12T16:19:14 Add Vulkan backend support for texture labels Add onLableUpdate support for textures in the Vulkan backend. Bug: b/229105865 Change-Id: Id9e5b2b81352e97b7843a63f27709739005dc2f3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3645854 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Ian Elliott <ianelliott@google.com>
Shahbaz Youssefi 7c83a363 2022-05-16T22:22:44 Vulkan: Dynamic state for rasterizer discard enable Interaction with primitives generated query are tested by those tests added in https://chromium-review.googlesource.com/c/angle/angle/+/2976181 Bug: angleproject:5906 Change-Id: I0ab9f54995504be770a93bf13337a5ffe20bf7eb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3651582 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 891a4682 2022-05-12T22:32:07 Vulkan: Dynamic state for stencil test/op Bug: angleproject:5906 Change-Id: I436c6c238a15e54919a74d2a697d1f114bb3eaf9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3647207 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 4e5da2d2 2022-05-11T13:58:07 Vulkan: Dynamic state for cull mode Bug: angleproject:5906 Change-Id: I3d7b888e7999d4892ff71d636ea16a2edcf7a27f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3642800 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 802504ad 2022-04-29T20:22:53 Vulkan: Add log for buffer pool stats For debugging purpose, this will calculate stats of buffer pool and output string to log. Set ANGLE_ENABLE_BUFFER_POOL_STATS_LOGGING to 1 will log stats into INFO() stream. Bug: b/230538246 Change-Id: I68f83af547e782ca7cb6cb222967ba02b8005083 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3617229 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mohan Maiya 02b96848 2022-04-21T16:32:31 Vulkan: Add support for GL_QCOM_shading_rate Layer GL_QCOM_shading_rate over VK_KHR_fragment_shading_rate Test: ShadingRateQcomTest* Bug: angleproject:7172 Change-Id: I3f040dbfad3906facd4349937fed2ce9a464b824 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3599874 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Charlie Lao 5014ce66 2022-04-18T18:05:20 Vulkan: Add orphaned list for non-empty BufferBlocks. In the fix for chromium:1299211, we added a new pool in the RendererVk and pick which pool to use at the getDefaultBufferPool() call. This CL fixes the original problem differently. In this CL we still uses the ShareGroup's pool. When display global texture is enabled, we orphan the non-empty buffer blocks into renderer and check and destroyed from garbage collection code. This way we still only deal with one buffer pool and all logic is mostly in context destroy code path, which I believe is a better solution. Bug: b/223428306 Change-Id: Ib465a11f7e3656df09cc891416ff57f086a8184b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3573390 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 957f8297 2022-04-08T15:44:55 Vulkan: Change ContextVk to Context for BufferPool APIs These APIs only needs information from Context, not ContextVk. This CL changes to Context for better encapsulation. Bug: b/223428306 Change-Id: I4f50aaa4065eff62ca32e9049f5a891d8814e511 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3578587 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Lingfeng Yang <lfy@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 1b94c585 2022-04-10T15:09:38 Revert "Vulkan: Switch loader to new driver files env var." This reverts commit 1f6123d55467c2af7c67405c0101a6f327b76225. Reason for revert: Seems to break ANGLE on fuchsia loader: https://ci.chromium.org/ui/p/chromium/builders/try/fuchsia_arm64/1123629/overview Original change's description: > Vulkan: Switch loader to new driver files env var. > > VK_DRIVER_FILES replaces VK_ICD_FILENAMES. > > Bug: angleproject:7095 > Change-Id: I949ac9a8f375240b6c6068825eccc645f81b0185 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3522821 > Reviewed-by: Ian Elliott <ianelliott@google.com> > Reviewed-by: Yuxin Hu <yuxinhu@google.com> > Commit-Queue: Jamie Madill <jmadill@chromium.org> Bug: angleproject:7095 Change-Id: I5b7e094b08d76b9c14adb4acb3b59e4cfb7a28fa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3580980 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 1f6123d5 2022-03-14T11:40:05 Vulkan: Switch loader to new driver files env var. VK_DRIVER_FILES replaces VK_ICD_FILENAMES. Bug: angleproject:7095 Change-Id: I949ac9a8f375240b6c6068825eccc645f81b0185 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3522821 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Charlie Lao fe28a429 2022-03-30T15:34:49 Vulkan: Create buffer for vertex array if robust enabled If robust access is enabled (i.e., chrome), we want to ensure vulkan driver never access beyond that OpenGL buffer boundary. But with suballocation from BufferPool, we are using the same VkBuffer for all suballocations from the same BufferBlock. this combined with the fact that there is no size information in the vkCmdBindVertexBuffers, it means vulkan driver can not properly ensure vertex access not go beyond the subrange. It can only guarantee not access beyond the entire VkBuffer size. This CL creates a dedicated vkBuffer object and bind it to the suballocation of the vkDeviceMemory so that vulkan driver will see the exact range of the subrange instead of entire buffer. Since we may allocated more memory than actual requested size and the extra paddings are not zero filled , user size is used to create this vkBuffer. This is only enabled when robust access is enabled. This CL also ported webgl conformance test out-of-bounds-index-buffers.html and out-of-bounds-array-buffers.html to end2end test. Bug: chromium:1310038 Change-Id: I3499ae600028149b1039082e5011232b3e4e5e80 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3553940 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Yuxin Hu cdd97fb8 2022-03-24T17:41:30 Reland "Vulkan: Fix invalid access with display texture share group." This is a reland of 1099b5ef2279cfe1988a39c8e011aada59c650f1. Original change's description: > Vulkan: Fix invalid access with display texture share group. > Create bufferpool that owns by RendererVk. > If we are using EGL_ANGLE_display_texture_share_group > extension, use the bufferpool owned RendererVk, > otherwise, use the bufferpool owned by EGL::ShareGroup. > The bufferpool lifetime will remain consistent with > texture lifetime. > Bug: chromium:1299211 > Change-Id: Ie4e87cea1dfd20dabab24e2afed6ddd92e469888 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3531155 > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Geoff Lang <geofflang@chromium.org> Bug: chromium:1299211 Change-Id: I4b8f5bcb30297f2c5f24e02404fd96011f9d843b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3550038 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shrek Shao 73ec28af 2022-03-23T21:13:45 Revert "Vulkan: Fix invalid access with display texture share group." This reverts commit 1099b5ef2279cfe1988a39c8e011aada59c650f1. Reason for revert: suspect culprit of 1309304 Original change's description: > Vulkan: Fix invalid access with display texture share group. > > Create bufferpool that owns by RendererVk. > If we are using EGL_ANGLE_display_texture_share_group > extension, use the bufferpool owned RendererVk, > otherwise, use the bufferpool owned by EGL::ShareGroup. > The bufferpool lifetime will remain consistent with > texture lifetime. > > Bug: chromium:1299211 > Change-Id: Ie4e87cea1dfd20dabab24e2afed6ddd92e469888 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3531155 > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Geoff Lang <geofflang@chromium.org> Bug: chromium:1299211, 1309304 Change-Id: Ibdc119ef6bb52352858114d72a0f1c0edcd4da5e No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3546288 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Shrek Shao <shrekshao@google.com> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Yuxin Hu 1099b5ef 2022-03-17T17:20:44 Vulkan: Fix invalid access with display texture share group. Create bufferpool that owns by RendererVk. If we are using EGL_ANGLE_display_texture_share_group extension, use the bufferpool owned RendererVk, otherwise, use the bufferpool owned by EGL::ShareGroup. The bufferpool lifetime will remain consistent with texture lifetime. Bug: chromium:1299211 Change-Id: Ie4e87cea1dfd20dabab24e2afed6ddd92e469888 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3531155 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Kimmo Kinnunen 9637185c 2022-03-10T15:38:13 Add ForceGPUSwitch to EGL_ANGLE_power_preference eglHandleGPUSwitch() does not work with WebKit sandbox profile. The root cause is that we do not know the primary display, and as such we do not know which GPU drives this. Add eglForceGPUSwitchANGLE(display, gpuIDHigh, gpuIDLow). This lets the caller figure out the GPU in another process. Then the caller can just set the GPU in the sandboxed process. Add tests that are disabled by default until the runner and the infrastructure supports running the tests with automatic switching enabled. Bug: angleproject:7092 Change-Id: I316ee431156596effbdb89659a5e24291719a204 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3516274 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Jamie Madill e8ee847d 2022-02-23T12:25:39 Vulkan: Add UpdateDescriptorSetsBuilder. This helper class encapsulates the vkUpdateDescriptorSets caching. As part of the refactor, we switch passing a ContextVk to passing a vk::Context with some mutable variables. This helps encapsulate ContextVk. Since we use the perf counters in many places, this CL moves the perf counters to vk::Context, so we can access them everywhere. Refactoring change only. Bug: angleproject:6776 Change-Id: Id529962b2f425bece6f9b3bd0cd1698c692e58cb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3484980 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 8d966f7d 2022-02-08T11:05:09 Vulkan: Simplify SubAllocation data types. We no longer need to bootstrap on the wrapper classes because we use a separate garbage list. This simplifies the code for the allocation tracking considerably. Also we remove a few mutable accessor to fortify our OOP design. (Credit to Jamie since it is splited from his CL) Bug: angleproject:6980 Change-Id: I2025ec4d141531273e824bb586957a38efc30be1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3469715 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Charlie Lao 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>