|
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>
|