Merge pull request #69635 from BastiaanOlij/fix_get_buffer
Fix barrier on buffer_get_data
This commit is contained in:
commit
f79c034713
|
@ -1579,12 +1579,12 @@ Error RenderingDeviceVulkan::_buffer_update(Buffer *p_buffer, size_t p_offset, c
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderingDeviceVulkan::_memory_barrier(VkPipelineStageFlags p_src_stage_mask, VkPipelineStageFlags p_dst_stage_mask, VkAccessFlags p_src_access, VkAccessFlags p_dst_sccess, bool p_sync_with_draw) {
|
void RenderingDeviceVulkan::_memory_barrier(VkPipelineStageFlags p_src_stage_mask, VkPipelineStageFlags p_dst_stage_mask, VkAccessFlags p_src_access, VkAccessFlags p_dst_access, bool p_sync_with_draw) {
|
||||||
VkMemoryBarrier mem_barrier;
|
VkMemoryBarrier mem_barrier;
|
||||||
mem_barrier.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER;
|
mem_barrier.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER;
|
||||||
mem_barrier.pNext = nullptr;
|
mem_barrier.pNext = nullptr;
|
||||||
mem_barrier.srcAccessMask = p_src_access;
|
mem_barrier.srcAccessMask = p_src_access;
|
||||||
mem_barrier.dstAccessMask = p_dst_sccess;
|
mem_barrier.dstAccessMask = p_dst_access;
|
||||||
|
|
||||||
if (p_src_stage_mask == 0 || p_dst_stage_mask == 0) {
|
if (p_src_stage_mask == 0 || p_dst_stage_mask == 0) {
|
||||||
return; // No barrier, since this is invalid.
|
return; // No barrier, since this is invalid.
|
||||||
|
@ -1628,14 +1628,14 @@ void RenderingDeviceVulkan::_full_barrier(bool p_sync_with_draw) {
|
||||||
p_sync_with_draw);
|
p_sync_with_draw);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderingDeviceVulkan::_buffer_memory_barrier(VkBuffer buffer, uint64_t p_from, uint64_t p_size, VkPipelineStageFlags p_src_stage_mask, VkPipelineStageFlags p_dst_stage_mask, VkAccessFlags p_src_access, VkAccessFlags p_dst_sccess, bool p_sync_with_draw) {
|
void RenderingDeviceVulkan::_buffer_memory_barrier(VkBuffer buffer, uint64_t p_from, uint64_t p_size, VkPipelineStageFlags p_src_stage_mask, VkPipelineStageFlags p_dst_stage_mask, VkAccessFlags p_src_access, VkAccessFlags p_dst_access, bool p_sync_with_draw) {
|
||||||
VkBufferMemoryBarrier buffer_mem_barrier;
|
VkBufferMemoryBarrier buffer_mem_barrier;
|
||||||
buffer_mem_barrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
|
buffer_mem_barrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
|
||||||
buffer_mem_barrier.pNext = nullptr;
|
buffer_mem_barrier.pNext = nullptr;
|
||||||
buffer_mem_barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
buffer_mem_barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||||
buffer_mem_barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
buffer_mem_barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||||
buffer_mem_barrier.srcAccessMask = p_src_access;
|
buffer_mem_barrier.srcAccessMask = p_src_access;
|
||||||
buffer_mem_barrier.dstAccessMask = p_dst_sccess;
|
buffer_mem_barrier.dstAccessMask = p_dst_access;
|
||||||
buffer_mem_barrier.buffer = buffer;
|
buffer_mem_barrier.buffer = buffer;
|
||||||
buffer_mem_barrier.offset = p_from;
|
buffer_mem_barrier.offset = p_from;
|
||||||
buffer_mem_barrier.size = p_size;
|
buffer_mem_barrier.size = p_size;
|
||||||
|
@ -6424,7 +6424,7 @@ Vector<uint8_t> RenderingDeviceVulkan::buffer_get_data(RID p_buffer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure no one is using the buffer -- the "false" gets us to the same command buffer as below.
|
// Make sure no one is using the buffer -- the "false" gets us to the same command buffer as below.
|
||||||
_buffer_memory_barrier(buffer->buffer, 0, buffer->size, src_stage_mask, src_access_mask, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_READ_BIT, false);
|
_buffer_memory_barrier(buffer->buffer, 0, buffer->size, src_stage_mask, VK_PIPELINE_STAGE_TRANSFER_BIT, src_access_mask, VK_ACCESS_TRANSFER_READ_BIT, false);
|
||||||
|
|
||||||
VkCommandBuffer command_buffer = frames[frame].setup_command_buffer;
|
VkCommandBuffer command_buffer = frames[frame].setup_command_buffer;
|
||||||
|
|
||||||
|
|
|
@ -226,8 +226,8 @@ class RenderingDeviceVulkan : public RenderingDevice {
|
||||||
Error _buffer_update(Buffer *p_buffer, size_t p_offset, const uint8_t *p_data, size_t p_data_size, bool p_use_draw_command_buffer = false, uint32_t p_required_align = 32);
|
Error _buffer_update(Buffer *p_buffer, size_t p_offset, const uint8_t *p_data, size_t p_data_size, bool p_use_draw_command_buffer = false, uint32_t p_required_align = 32);
|
||||||
|
|
||||||
void _full_barrier(bool p_sync_with_draw);
|
void _full_barrier(bool p_sync_with_draw);
|
||||||
void _memory_barrier(VkPipelineStageFlags p_src_stage_mask, VkPipelineStageFlags p_dst_stage_mask, VkAccessFlags p_src_access, VkAccessFlags p_dst_sccess, bool p_sync_with_draw);
|
void _memory_barrier(VkPipelineStageFlags p_src_stage_mask, VkPipelineStageFlags p_dst_stage_mask, VkAccessFlags p_src_access, VkAccessFlags p_dst_access, bool p_sync_with_draw);
|
||||||
void _buffer_memory_barrier(VkBuffer buffer, uint64_t p_from, uint64_t p_size, VkPipelineStageFlags p_src_stage_mask, VkPipelineStageFlags p_dst_stage_mask, VkAccessFlags p_src_access, VkAccessFlags p_dst_sccess, bool p_sync_with_draw);
|
void _buffer_memory_barrier(VkBuffer buffer, uint64_t p_from, uint64_t p_size, VkPipelineStageFlags p_src_stage_mask, VkPipelineStageFlags p_dst_stage_mask, VkAccessFlags p_src_access, VkAccessFlags p_dst_access, bool p_sync_with_draw);
|
||||||
|
|
||||||
/*********************/
|
/*********************/
|
||||||
/**** FRAMEBUFFER ****/
|
/**** FRAMEBUFFER ****/
|
||||||
|
|
Loading…
Reference in New Issue