Fix inline uniform block update
The data sent to DescriptorSetLayout::WriteDescriptorSet() when
calling vkUpdateDescriptorSetWithTemplate() was completely wrong
when the descriptor type is VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK.
This CL changes how DescriptorSetLayout::WriteDescriptorSet()
processes its input parameters when the descriptorType is
VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK so that it matches what
is sent by DescriptorUpdateTemplate::updateDescriptorSet() and
adjusts the rest of the code accordingly.
Tests: dEQP-VK.api.info.vulkan1p2_limits_validation.*
Tests: dEQP-VK.binding_model.descriptor_copy.*.inline_uniform_block*
Tests: dEQP-VK.binding_model.descriptorset_random.sets4.*
Bug: b/204502117
Change-Id: I0398035ca701aaa3a48f89da868c3b7f33b57c8c
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/64628
Reviewed-by: Sean Risser <srisser@google.com>
Presubmit-Ready: Alexis Hétu <sugoi@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexis Hétu <sugoi@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Vulkan/VkDescriptorSetLayout.cpp b/src/Vulkan/VkDescriptorSetLayout.cpp
index 06e2555..bed2557 100644
--- a/src/Vulkan/VkDescriptorSetLayout.cpp
+++ b/src/Vulkan/VkDescriptorSetLayout.cpp
@@ -569,8 +569,7 @@
}
else if(entry.descriptorType == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK)
{
- auto update = reinterpret_cast<const VkWriteDescriptorSetInlineUniformBlock *>(src);
- memcpy(memToWrite, static_cast<const uint8_t *>(update->pData), update->dataSize);
+ memcpy(memToWrite, src + entry.offset, entry.descriptorCount);
}
}
@@ -626,8 +625,7 @@
// the stride member of VkDescriptorUpdateTemplateEntry is ignored for inline
// uniform blocks and a default value of one is used, meaning that the data to
// update inline uniform block bindings with must be contiguous in memory."
- ptr = extInfo;
- e.descriptorCount = 1;
+ ptr = reinterpret_cast<const VkWriteDescriptorSetInlineUniformBlock *>(extInfo)->pData;
e.stride = 1;
break;
}