Fixed PipelineLayout creation on 32 bit The assumption that Cast(VkDescriptorSetLayout) is nothing but a noop cast no longer hold on 32 bit, since the handle and the pointer don't have the same size. Used the Cast() function to solve the issue. Bug chromium:968313 Change-Id: I0349d1f4f00ca983bbc4ca9c39be77d3a0b3d5bc Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/32229 Tested-by: Alexis Hétu <sugoi@google.com> Presubmit-Ready: Alexis Hétu <sugoi@google.com> Reviewed-by: Nicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
diff --git a/src/Vulkan/VkPipelineLayout.cpp b/src/Vulkan/VkPipelineLayout.cpp index 1c80ca7..5ea8cb8 100644 --- a/src/Vulkan/VkPipelineLayout.cpp +++ b/src/Vulkan/VkPipelineLayout.cpp
@@ -25,7 +25,10 @@ size_t setLayoutsSize = pCreateInfo->setLayoutCount * sizeof(DescriptorSetLayout*); setLayouts = reinterpret_cast<DescriptorSetLayout**>(hostMem); - memcpy(setLayouts, pCreateInfo->pSetLayouts, setLayoutsSize); // Assumes Cast(VkDescriptorSetLayout) is nothing but a cast + for(uint32_t i = 0; i < pCreateInfo->setLayoutCount; i++) + { + setLayouts[i] = Cast(pCreateInfo->pSetLayouts[i]); + } hostMem += setLayoutsSize; size_t pushConstantRangesSize = pCreateInfo->pushConstantRangeCount * sizeof(VkPushConstantRange);