Reputation: 10039
If an entire vkDeviceMemory
is mapped (via vkMapMemory
) and it wasn't allocated with VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
, vkFlushMappedMemoryRanges
must be made after any modifications to the buffer are made, for the device to see the writes (per the documentation).
I am only modifying small sections of a large buffer, and thus, only want to flush the affected regions. So, I create multiple VkMappedMemoryRange
structures, with varying offset
and size
fields, but pointing to the same vkDeviceMemory
. This all seems to work as I expect. Howevever, if I enable VK_LAYER_LUNARG_threading
, I get an error:
THREADING ERROR : object of type VkDeviceMemory is recursively used in thread 24812
If I instead just call vkFlushMappedMemoryRanges
multiple times with only a single flush range, instead of an array, I don't get an error. Is flushing multiple sub-ranges of the same buffer not a valid use case?
Upvotes: 1
Views: 328
Reputation: 36
That is a false error report from the layer. A single function call can safely refer to the same vulkan object several times. Newer versions of the thread checking layer don't report that false conflict. (That layer is renamed to VK_LAYER_GOOGLE_threading in recent versions.)
Upvotes: 2