summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-09-13 11:21:58 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-09-13 11:21:58 +0200
commit0f86f30cf0d2359b8bfc0e45d94b087763c3531b (patch)
tree6ee001b7b6afc6b8731c80aef0e0e84404f36f7a
parent97843116f63653943570c42b2ba5bcbeaad2d484 (diff)
parent41fdc55b056587d7ea51658e1a47863ceacddd35 (diff)
downloadredot-engine-0f86f30cf0d2359b8bfc0e45d94b087763c3531b.tar.gz
Merge pull request #96860 from kroketio/from-ext-alloc-check
Vulkan: Account for externally backed textures
-rw-r--r--drivers/vulkan/rendering_device_driver_vulkan.cpp9
-rw-r--r--drivers/vulkan/rendering_device_driver_vulkan.h3
2 files changed, 8 insertions, 4 deletions
diff --git a/drivers/vulkan/rendering_device_driver_vulkan.cpp b/drivers/vulkan/rendering_device_driver_vulkan.cpp
index 4ea46e8214..bd395f41e2 100644
--- a/drivers/vulkan/rendering_device_driver_vulkan.cpp
+++ b/drivers/vulkan/rendering_device_driver_vulkan.cpp
@@ -1772,16 +1772,17 @@ RDD::TextureID RenderingDeviceDriverVulkan::texture_create_from_extension(uint64
tex_info->vk_view = vk_image_view;
tex_info->rd_format = p_format;
tex_info->vk_view_create_info = image_view_create_info;
-
+#ifdef DEBUG_ENABLED
+ tex_info->created_from_extension = true;
+#endif
return TextureID(tex_info);
}
RDD::TextureID RenderingDeviceDriverVulkan::texture_create_shared(TextureID p_original_texture, const TextureView &p_view) {
const TextureInfo *owner_tex_info = (const TextureInfo *)p_original_texture.id;
#ifdef DEBUG_ENABLED
- ERR_FAIL_COND_V(!owner_tex_info->allocation.handle, TextureID());
+ ERR_FAIL_COND_V(!owner_tex_info->allocation.handle && !owner_tex_info->created_from_extension, TextureID());
#endif
-
VkImageViewCreateInfo image_view_create_info = owner_tex_info->vk_view_create_info;
image_view_create_info.format = RD_TO_VK_FORMAT[p_view.format];
image_view_create_info.components.r = (VkComponentSwizzle)p_view.swizzle_r;
@@ -1837,7 +1838,7 @@ RDD::TextureID RenderingDeviceDriverVulkan::texture_create_shared(TextureID p_or
RDD::TextureID RenderingDeviceDriverVulkan::texture_create_shared_from_slice(TextureID p_original_texture, const TextureView &p_view, TextureSliceType p_slice_type, uint32_t p_layer, uint32_t p_layers, uint32_t p_mipmap, uint32_t p_mipmaps) {
const TextureInfo *owner_tex_info = (const TextureInfo *)p_original_texture.id;
#ifdef DEBUG_ENABLED
- ERR_FAIL_COND_V(!owner_tex_info->allocation.handle, TextureID());
+ ERR_FAIL_COND_V(!owner_tex_info->allocation.handle && !owner_tex_info->created_from_extension, TextureID());
#endif
VkImageViewCreateInfo image_view_create_info = owner_tex_info->vk_view_create_info;
diff --git a/drivers/vulkan/rendering_device_driver_vulkan.h b/drivers/vulkan/rendering_device_driver_vulkan.h
index 2615d9824d..81f4256941 100644
--- a/drivers/vulkan/rendering_device_driver_vulkan.h
+++ b/drivers/vulkan/rendering_device_driver_vulkan.h
@@ -213,6 +213,9 @@ public:
VmaAllocation handle = nullptr;
VmaAllocationInfo info = {};
} allocation; // All 0/null if just a view.
+#ifdef DEBUG_ENABLED
+ bool created_from_extension = false;
+#endif
};
VkSampleCountFlagBits _ensure_supported_sample_count(TextureSamples p_requested_sample_count);