]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/vulkan/texture_backend.cpp
Refactor Synchronizer to deal with individual mipmap levels
[libs/gl.git] / source / backends / vulkan / texture_backend.cpp
index 06c4a622341955b1064539afe11b369c0620b9e6..f1e8b85bab162e32926db81f78ced507752e5d04 100644 (file)
@@ -73,7 +73,7 @@ void VulkanTexture::allocate()
                memory_id = device.get_allocator().allocate(handle, DEVICE_MEMORY);
 
                // Trigger a layout transition if the image is used before uploading data.
-               synchronize(-1, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, true);
+               change_layout(0, -1, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, true);
        }
 
        VkImageViewCreateInfo view_info = { };
@@ -105,10 +105,12 @@ void VulkanTexture::generate_mipmap()
        throw logic_error("VulkanTexture::generate_mipmap is unimplemented");
 }
 
-void VulkanTexture::synchronize(int layer, unsigned layout, bool discard) const
+void VulkanTexture::change_layout(unsigned n_levels, int level, unsigned layout, bool discard) const
 {
        unsigned aspect = get_vulkan_aspect(get_components(static_cast<const Texture *>(this)->storage_fmt));
-       device.get_synchronizer().access(handle, aspect, layer, layout, discard);
+       if(n_levels>0)
+               device.get_synchronizer().split_image_mipmap(handle, aspect, n_levels);
+       device.get_synchronizer().change_image_layout(handle, aspect, level, layout, discard);
 }
 
 void VulkanTexture::set_debug_name(const string &name)