From edd61c44860e5566daa9aaef013e1c2f870d486b Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 11 Apr 2016 20:55:56 +0200 Subject: [PATCH] Add warnings and skip when shader needs desc sets/binds that are unbound * These should be converted into log warnings/errors soon. --- renderdoc/driver/vulkan/vk_core.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/renderdoc/driver/vulkan/vk_core.cpp b/renderdoc/driver/vulkan/vk_core.cpp index 75aa316a8..256f9969f 100644 --- a/renderdoc/driver/vulkan/vk_core.cpp +++ b/renderdoc/driver/vulkan/vk_core.cpp @@ -2130,12 +2130,26 @@ void WrappedVulkan::AddUsage(VulkanDrawcallTreeNode &drawNode) int32_t bindset = types[t].bindmap[i].bindset; int32_t bind = types[t].bindmap[i].bind; - RDCASSERT(bindset < (int32_t)descSets.size()); + if(bindset >= (int32_t)descSets.size()) + { + RDCWARN("At draw %u, shader referenced a descriptor set %i that was not bound", drawNode.draw.eventID, bindset); + continue; + } DescriptorSetInfo &descset = m_DescriptorSetState[ descSets[bindset] ]; DescSetLayout &layout = c.m_DescSetLayout[ descset.layout ]; - RDCASSERT(bind < (int32_t)layout.bindings.size()); + if(layout.bindings.empty()) + { + RDCWARN("At draw %u, shader referenced a descriptor set %i that was not bound", drawNode.draw.eventID, bindset); + continue; + } + + if(bind >= (int32_t)layout.bindings.size()) + { + RDCWARN("At draw %u, shader referenced a bind %i in descriptor set %i that does not exist. Mismatched descriptor set?", drawNode.draw.eventID, bind, bindset); + continue; + } // handled as part of the framebuffer attachments if(layout.bindings[bind].descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT) @@ -2147,7 +2161,11 @@ void WrappedVulkan::AddUsage(VulkanDrawcallTreeNode &drawNode) ResourceUsage usage = ResourceUsage(types[t].usage + shad); - RDCASSERT(bind < (int32_t)descset.currentBindings.size()); + if(bind >= (int32_t)descset.currentBindings.size()) + { + RDCWARN("At draw %u, shader referenced a bind %i in descriptor set %i that does not exist. Mismatched descriptor set?", drawNode.draw.eventID, bind, bindset); + continue; + } for(uint32_t a=0; a < layout.bindings[bind].descriptorCount; a++) {