From ef4ee0b2d42b1fe9ce36c67526cf853343d98ea0 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 6 Dec 2021 14:50:42 -0800 Subject: Fix shader-toy example. (#2047) Co-authored-by: Yong He --- tools/gfx/vulkan/render-vk.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'tools/gfx/vulkan/render-vk.cpp') diff --git a/tools/gfx/vulkan/render-vk.cpp b/tools/gfx/vulkan/render-vk.cpp index 1fb06b8e7..59f12cb41 100644 --- a/tools/gfx/vulkan/render-vk.cpp +++ b/tools/gfx/vulkan/render-vk.cpp @@ -2741,7 +2741,8 @@ public: for(Index i = 0; i < count; ++i) { auto resourceView = static_cast(resourceViews[i].Ptr()); - + if (!resourceView) + continue; VkBufferView bufferView = resourceView->m_view; VkWriteDescriptorSet write = {}; @@ -2770,7 +2771,8 @@ public: { auto texture = slots[i].textureView; auto sampler = slots[i].sampler; - + if (!texture) + continue; VkDescriptorImageInfo imageInfo = {}; imageInfo.imageView = texture->m_view; imageInfo.imageLayout = texture->m_layout; @@ -2802,7 +2804,8 @@ public: { auto accelerationStructure = static_cast(resourceViews[i].Ptr()); - + if (!accelerationStructure) + continue; VkWriteDescriptorSetAccelerationStructureKHR writeAS = {}; writeAS.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR; writeAS.accelerationStructureCount = 1; @@ -2831,7 +2834,8 @@ public: for(Index i = 0; i < count; ++i) { auto texture = static_cast(resourceViews[i].Ptr()); - + if (!texture) + continue; VkDescriptorImageInfo imageInfo = {}; imageInfo.imageView = texture->m_view; imageInfo.imageLayout = texture->m_layout; @@ -2862,7 +2866,8 @@ public: for(Index i = 0; i < count; ++i) { auto sampler = samplers[i]; - + if (!sampler) + continue; VkDescriptorImageInfo imageInfo = {}; imageInfo.imageView = 0; imageInfo.imageLayout = VK_IMAGE_LAYOUT_GENERAL; -- cgit v1.2.3