From dfdfee04dfac14b965830ba3a8f54a24ed1e8e70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Wed, 22 Jul 2020 16:31:17 +0200 Subject: [PATCH] Vulkan: Fix struct init for VkClearAttachment The changes from #38835 were not sufficient to fix #38829, as VkClearAttachment still had uninitialized member structs in its VkClearColor member struct. The struct rabbit hole goes deep and trying to do validation as done in #38829 doesn't appear realistic. --- drivers/vulkan/rendering_device_vulkan.cpp | 29 ++-------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp index cb26d3ce92c..fb890491a44 100644 --- a/drivers/vulkan/rendering_device_vulkan.cpp +++ b/drivers/vulkan/rendering_device_vulkan.cpp @@ -2997,16 +2997,10 @@ VkRenderPass RenderingDeviceVulkan::_render_pass_create(const Vectortexture_ids.size(); i++) { Texture *texture = texture_owner.getornull(framebuffer->texture_ids[i]); - VkClearAttachment clear_at; - clear_at.aspectMask = VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM; // Invalid value. - clear_at.colorAttachment = uint32_t(-1); // Invalid value. - clear_at.clearValue.depthStencil.stencil = uint32_t(-1); // Invalid value. + VkClearAttachment clear_at = {}; if (p_clear_color && texture->usage_flags & TEXTURE_USAGE_COLOR_ATTACHMENT_BIT) { ERR_FAIL_INDEX(color_index, p_clear_colors.size()); //a bug @@ -5683,13 +5665,6 @@ void RenderingDeviceVulkan::_draw_list_insert_clear_region(DrawList *draw_list, } else { ERR_CONTINUE(true); } - - // Ensure VkClearAttachment has been initialized properly. - ERR_CONTINUE_MSG(clear_at.aspectMask == VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM || - clear_at.colorAttachment == uint32_t(-1) || - clear_at.clearValue.depthStencil.stencil == uint32_t(-1), - "Bug: VkClearAttachment not initialized properly."); - clear_attachments.push_back(clear_at); }