summaryrefslogtreecommitdiffstats
path: root/tools/gfx/vulkan/render-vk.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-03-18 13:19:58 -0700
committerGitHub <noreply@github.com>2021-03-18 13:19:58 -0700
commit0f9b3a95a6cc087bc1e34d4becff04fa6160c582 (patch)
treea8b14958f13f53ee3918c727f4e5a06af377349c /tools/gfx/vulkan/render-vk.cpp
parent6e5d85efb9fa5f647f7f0c7ef784a9fd09b29023 (diff)
Remove `DescriptorSet` from D3D11 and GL devices. (#1761)
Diffstat (limited to 'tools/gfx/vulkan/render-vk.cpp')
-rw-r--r--tools/gfx/vulkan/render-vk.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/gfx/vulkan/render-vk.cpp b/tools/gfx/vulkan/render-vk.cpp
index 1c263d505..21d437921 100644
--- a/tools/gfx/vulkan/render-vk.cpp
+++ b/tools/gfx/vulkan/render-vk.cpp
@@ -3154,8 +3154,8 @@ Result VKDevice::createTextureResource(IResource::Usage initialUsage, const ITex
int subResourceIndex = subResourceCounter++;
auto initSubresource = initData[subResourceIndex];
- const ptrdiff_t srcRowStride = initSubresource.strideY;
- const ptrdiff_t srcLayerStride = initSubresource.strideZ;
+ const ptrdiff_t srcRowStride = (ptrdiff_t)initSubresource.strideY;
+ const ptrdiff_t srcLayerStride = (ptrdiff_t)initSubresource.strideZ;
auto dstRowSizeInBytes = calcRowSize(desc.format, mipSize.width);
auto numRows = calcNumRows(desc.format, mipSize.height);
@@ -3923,6 +3923,8 @@ void VKDevice::DescriptorSetImpl::setResource(UInt range, UInt index, IResourceV
auto descriptorType = rangeInfo.vkDescriptorType;
auto viewImpl = (ResourceViewImpl*)view;
+ if (!viewImpl)
+ return;
switch (viewImpl->m_type)
{
case ResourceViewImpl::ViewType::Texture:
@@ -3993,7 +3995,8 @@ void VKDevice::DescriptorSetImpl::setSampler(UInt range, UInt index, ISamplerSta
auto bindingIndex = rangeInfo.vkBindingIndex;
auto boundObjectIndex = rangeInfo.arrayIndex + index;
auto descriptorType = rangeInfo.vkDescriptorType;
-
+ if (!sampler)
+ return;
VkWriteDescriptorSet writeInfo = { VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET };
writeInfo.dstSet = m_descriptorSet.handle;
writeInfo.dstBinding = uint32_t(bindingIndex);