src/tests/gl_tests/VulkanImageTest.cpp


Log

Author Commit Date CI Message
Shahbaz Youssefi f0370a41 2025-09-09T19:44:57 Vulkan: Use the GENERAL layout if VK_KHR_unified_image_layouts This lets ANGLE simplify synchronization by generally being able to use memory barriers instead of listing image barriers separately. Although the more specific access masks from VK_KHR_synchronization2 is possibly necessary for some hardware to work optimally (VK_ACCESS_2_SHADER_SAMPLED_READ_BIT in particular). It also lets ANGLE optimize a very specific scenario. Take an image used in the following scenario: 1. Copy to image in a transfer operation 2. Sample from image in the fragment shader of render pass 1 3. Sample from image in the vertex shader of shader pass 2 When GENERAL is not used, there's a layout transition between steps 1 and 2, changing the layout from TRANSFER_DST to SHADER_READ_ONLY_OPTIMAL (with dst stage == fragment shader). Later, at step 3, we need to make sure the vertex shader at least waits for this layout transition to finish... a dependency which is not expressible in Vulkan: * There cannot be a dependency to step 1, because the layout transition is not necessarily done * There is no stage mask that signifies the end of a layout transition. Without GENERAL, ANGLE has no choice but to issue a fragment->vertex dependency before step 3, serializing render pass 2's vertex pass with render pass 1's fragment pass on tilers. When using the GENERAL layout instead, step 3 can issue a transfer->vertex memory barrier, including using a VkEvent, parallelizing the two render passes. The above optimization is possible after this change, but not yet implemented. Bug: angleproject:422982681 Change-Id: Ieaae6f92b8b7d1e9c80c810a759c64b1e81d2dc1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6936485 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Tom Sepez 25390156 2025-08-21T00:13:19 Suppress unsafe buffers on a file-by-file basis in src/ [1 of N] In this CL, we suppress many files but stop short of actually enabling the warning by not removing the line from the unsafe_buffers_paths.txt file. That will happen in a follow-on CL, along with resolving any stragglers missed here. This is mostly a manual change so as to familiarize myself with the kinds of issues faced by the Angle codebase when applying buffer safety warnings. -- Re-generate affected hashes. -- Clang-format applied to all changed files. -- Add a few missing .reserve() calls to vectors as noticed. -- Fix some mismatches between file names and header comments. -- Be more consistent with header comment format (blank lines and trailing //-only lines when a filename comment adjoins license boilerplate). Bug: b/436880895 Change-Id: I3bde5cc2059acbe8345057289214f1a26f1c34aa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6869022 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Roman Lavrov 22c457a6 2024-12-06T16:07:54 Tests: VulkanMemoryTest OOM fallbacks check >= instead of == OOM tests check deviceMemoryImageAllocationFallbacks in a loop, assuming that +1 will be reached. Maybe we are skipping over +1 somehow. Check for >= instead. The loops are followed by EXPECT_EQ, so if this happens the test would still fail. Bug: angleproject:382094011 Change-Id: Icfc93954b4a7ba30e24ae087d7a0c03d640e85b3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6077964 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Roman Lavrov <romanl@google.com>
Shahbaz Youssefi 3f572905 2024-06-19T17:46:38 Add basic begin/end support for perf counters The AMD_performance_monitor extension has explicit begin/end calls to capture counters. This was not implemented in ANGLE and the tests were relying on ANGLE always capturing counters (incurring a small overhead). This change does not complete the implementation of that extension, but does add basic support for starting and stopping perf counter measurements. While inactive, most counters are not updated. Bug: angleproject:42267038 Change-Id: I3ff6448b22ca247c217401cb2d76ef4142c9d759 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5639343 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Shahbaz Youssefi e9c0241d 2023-12-19T10:23:13 Vulkan: Rely on Vulkan 1.1 entry points in tests Some KHR entry points that were promoted to Vulkan 1.1 no longer seem to be loadable with their KHR symbols. Bug: angleproject:8464 Change-Id: Id5417e5b047e6bd34d144fead518f771c17658e3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5135676 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi e7a77053 2023-09-12T13:40:47 Update VulkanMemoryTest after adding context flush After adding context flushing to the memory allocation fallbacks in a previous CL (https://crrev.com/c/4787949), some tests in the VulkanMemoryTest suite no longer test the success path of the fallback to wait for submitted commands to finish. * Updated AllocateVMAImageAfterFreeing2DGarbageWhenDeviceOOM * The test now uses an additional allocation and draw after the first sync, followed by a second sync. During the allocation of the last texture, it would wait to finish the submitted command and free the garbage without flushing the whole context. Bug: b/280304441 Change-Id: Idc583e120b8d9e1cc550f6cba4cb0b2b197e4944 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4860367 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
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>
Amirali Abdolrashidi b1b12d4a 2023-06-22T15:27:48 Vulkan: Move device OOM tests to new test suite * Moved the device OOM tests from VulkanImageTest to a new test suite, VulkanMemoryTest. * It is instantiated for ES3. * Moved the slow tests in the expectation file to the end. Bug: b/280304441 Change-Id: Icc958b5eb071567f8e6671661302760c7f5e3621 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4639041 Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.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>
Amirali Abdolrashidi 5f9548c3 2023-05-19T11:51:04 Vulkan: Free the garbage memory before realloc Currently image allocations fall back to system memory in case of a device OOM. However, in some cases, it is also possible to gain some memory by freeing garbage memory from the device. This allows us to keep the allocation on the device memory. * Updated the image allocation fallback, so we will try cleaning the garbage memory through the renderer before retrying the allocation. * finishOneCommandBatchAndCleanup() in RendererVk, which will call a similar function in its CommandQueue. It will be called until there are no more in-flight submissions. * The existing finishOneCommandBatchAndCleanup() in CommandQueue has been renamed to finishOneCommandBatchAndCleanupImpl(). * Updated the flags used for VMA image allocations. If any device memory is freed after garbage cleanup to make enough space for the new allocation, it will take precedence over the system memory. * Added unit tests in which a new image allocation could happen on the device after freeing the garbage memory. * They use a 2D texture and a 2D texture array for garbage. Bug: b/280304441 Change-Id: Ia5e605e180833b44af8c77550ab1b0b8ba21724e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4547941 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Amirali Abdolrashidi 6f959e07 2023-04-28T16:00:11 Vulkan: Add non-device memory option for VMA image * Updated the required flags for allocateAndBindMemory() to no longer include VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, though still preferred. This allows VMA to allocate from another memory type if the device is out of memory. * Added a debug message to indicate when allocated memory for VMA image does not have all the preferred property flags. * Also added a warning in the case of memory allocation fallback. * Added a perf counter to keep track of image allocation fallbacks from the device memory. * deviceMemoryImageAllocationFallbacks * Added a test to make sure that VMA images can still be allocated from other memory types even if device memory is unavailable. * VulkanImageTest.AllocateVMAImageWhenDeviceOOM Bug: b/280304441 Change-Id: Ic452c18ded25345cdb7e271442372b99aede045e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4493483 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Amirali Abdolrashidi f1872822 2022-12-22T17:17:37 Vulkan: Fix imageless framebuffer VVL issue In some tests, including some blink tests, there were cases of VVL messages spamming the output log, even though they did not always cause a failure. Investigation showed that in some cases, the call to EGL_CreateImageKHR() was not setting all the attributes in the ImageHelper object that is used later for an imageless framebuffer, specifically the one created in VkImageImageSiblingVk::initImpl(). * Added the usage flags and view formats in the new image created in VkImageImageSiblingVk. * Added a Vulkan image test to make sure the error is fixed. Bug: b/261473248 Bug: angleproject:7845 Change-Id: I1874b2930e9ce62e5b603cf7acff6fd78b957d5b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4117584 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Eddie Hatfield 89e38b57 2022-06-22T15:04:08 Refactor to use ANGLETest vs ANGLETestWithParam Bug: angleproject:6747 Change-Id: I72ad52d0268eae0e1a401f12f3e94cc5efa402f2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3719002 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Sunny Sachanandani d4cbd9bf 2022-04-11T16:55:39 vulkan: Mark external memory textures as preinitialized Textures initialized from external memory objects should be considered preinitialized so that they're not cleared on first access with robust resource init. This is essential for Vulkan-GL (WebGPU-WebGL) interop on Linux where Skia or Dawn could be first used to render into a VkImage backed by an external memory object, and a GL texture is created lazily on first GL access. This CL also includes an end-to-end test for such interop, and changes to support that test: 1) Add writePixels() to VulkanHelper to upload pixels to a VkImage 2) Detect external memory / semaphore extensions when VulkanHelper is initialized from ANGLE. 3) Allow importing external memory object that's larger than VkImage size requirements. Bug: angleproject:7188 Change-Id: I60c250b64df1766a179edd1cc67c3f0765e8aa0f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3582954 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Peng Huang 32f572b7 2021-12-03T17:58:51 Support creating EGLImage from VkImage Bug: chromium:1264439 Change-Id: I520182143e748f25b44d0725f3f171b7b33a85d8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3311131 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Peng Huang <penghuang@chromium.org>
Peng Huang 65720272 2021-11-26T17:42:16 Add end2end gl test for *_ANGLE_vulkan_image extensions Bug: chromium:1264439,angleproject:6741 Change-Id: I12d332995138a020ba514fba34024c3e666b8e6b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3304396 Commit-Queue: Peng Huang <penghuang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>