|
@@ -2032,7 +2032,7 @@ RID RenderingDeviceVulkan::texture_create(const TextureFormat &p_format, const T
|
|
|
|
|
|
if (p_data.size()) {
|
|
|
for (uint32_t i = 0; i < image_create_info.arrayLayers; i++) {
|
|
|
- texture_update(id, i, p_data[i]);
|
|
|
+ _texture_update(id, i, p_data[i], RD::BARRIER_MASK_ALL, true);
|
|
|
}
|
|
|
}
|
|
|
return id;
|
|
@@ -2279,10 +2279,14 @@ RID RenderingDeviceVulkan::texture_create_shared_from_slice(const TextureView &p
|
|
|
}
|
|
|
|
|
|
Error RenderingDeviceVulkan::texture_update(RID p_texture, uint32_t p_layer, const Vector<uint8_t> &p_data, uint32_t p_post_barrier) {
|
|
|
+ return _texture_update(p_texture, p_layer, p_data, p_post_barrier, false);
|
|
|
+}
|
|
|
+
|
|
|
+Error RenderingDeviceVulkan::_texture_update(RID p_texture, uint32_t p_layer, const Vector<uint8_t> &p_data, uint32_t p_post_barrier, bool p_use_setup_queue) {
|
|
|
_THREAD_SAFE_METHOD_
|
|
|
|
|
|
- ERR_FAIL_COND_V_MSG(draw_list || compute_list, ERR_INVALID_PARAMETER,
|
|
|
- "Updating textures in is forbidden during creation of a draw or compute list");
|
|
|
+ ERR_FAIL_COND_V_MSG((draw_list || compute_list) && !p_use_setup_queue, ERR_INVALID_PARAMETER,
|
|
|
+ "Updating textures is forbidden during creation of a draw or compute list");
|
|
|
|
|
|
Texture *texture = texture_owner.getornull(p_texture);
|
|
|
ERR_FAIL_COND_V(!texture, ERR_INVALID_PARAMETER);
|
|
@@ -2323,7 +2327,7 @@ Error RenderingDeviceVulkan::texture_update(RID p_texture, uint32_t p_layer, con
|
|
|
|
|
|
const uint8_t *r = p_data.ptr();
|
|
|
|
|
|
- VkCommandBuffer command_buffer = p_post_barrier ? frames[frame].draw_command_buffer : frames[frame].setup_command_buffer;
|
|
|
+ VkCommandBuffer command_buffer = p_use_setup_queue ? frames[frame].setup_command_buffer : frames[frame].draw_command_buffer;
|
|
|
|
|
|
//barrier to transfer
|
|
|
{
|
|
@@ -2376,7 +2380,7 @@ Error RenderingDeviceVulkan::texture_update(RID p_texture, uint32_t p_layer, con
|
|
|
to_allocate >>= get_compressed_image_format_pixel_rshift(texture->format);
|
|
|
|
|
|
uint32_t alloc_offset, alloc_size;
|
|
|
- Error err = _staging_buffer_allocate(to_allocate, required_align, alloc_offset, alloc_size, false, p_post_barrier);
|
|
|
+ Error err = _staging_buffer_allocate(to_allocate, required_align, alloc_offset, alloc_size, false, !p_use_setup_queue);
|
|
|
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
|
|
|
|
|
|
uint8_t *write_ptr;
|