mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 15:50:20 +00:00
fix: correct water refraction barrier srcAccessMask to prevent VK_ERROR_DEVICE_LOST
The captureSceneHistory barrier was using srcAccessMask=0 with VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT when transitioning the swapchain image from PRESENT_SRC_KHR to TRANSFER_SRC_OPTIMAL. This does not flush the GPU's color attachment write caches, causing VK_ERROR_DEVICE_LOST on strict drivers (AMD, Mali) that require explicit cache invalidation before transfer reads. Fix: use VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT + COLOR_ATTACHMENT_OUTPUT as the source mask so color writes are properly made visible to the transfer unit before the image copy begins. Also remove the now-unnecessary "requires FSR" restriction in the settings UI — water refraction can be enabled independently of FSR.
This commit is contained in:
parent
8abb65a813
commit
fa3a5ec67e
2 changed files with 8 additions and 11 deletions
|
|
@ -1142,10 +1142,14 @@ void WaterRenderer::captureSceneHistory(VkCommandBuffer cmd,
|
|||
};
|
||||
|
||||
// Color source: final render pass layout is PRESENT_SRC.
|
||||
// srcAccessMask must be COLOR_ATTACHMENT_WRITE (not 0) so that GPU cache flushes
|
||||
// happen before the transfer read. Using srcAccessMask=0 with BOTTOM_OF_PIPE
|
||||
// causes VK_ERROR_DEVICE_LOST on strict drivers (AMD/Mali) because color writes
|
||||
// are not made visible to the transfer unit before the copy begins.
|
||||
barrier2(srcColorImage, VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
0, VK_ACCESS_TRANSFER_READ_BIT,
|
||||
VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
|
||||
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, VK_ACCESS_TRANSFER_READ_BIT,
|
||||
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
|
||||
barrier2(sh.colorImage, VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
||||
VK_ACCESS_SHADER_READ_BIT, VK_ACCESS_TRANSFER_WRITE_BIT,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue