nvrhi icon indicating copy to clipboard operation
nvrhi copied to clipboard

[Question] Should Vulkan WriteTexture need vkFlushMappedMemoryRanges?

Open BlurryLight opened this issue 2 years ago • 0 comments

https://github.com/NVIDIAGameWorks/nvrhi/blob/89424010f5c3aef48a912fb9220e47a36c03a87c/src/vulkan/vulkan-texture.cpp#L469-L489

the code snippnet is trying to first transfer data to upload heap and then using vkCopyBufferToImage to transfer data into device-local memory. However, the staging buffer is created with eHostVisible instead of eHostCoherent. https://github.com/NVIDIAGameWorks/nvrhi/blob/89424010f5c3aef48a912fb9220e47a36c03a87c/src/vulkan/vulkan-allocator.cpp#L40-L42

Taking Vulkan-Docs:Transfer-dependencies as reference, it seems there should be a vkFlushMappedMemoryRanges between the memcpy and the vkCopyBufferToImage, to ensure the host write is visible.

BlurryLight avatar Oct 28 '23 09:10 BlurryLight