Use provided VkPipelineLayout in BindDescriptorSets
Previously we were using the layout from the pipeline, but that doesn't
work if the pipeline is not bound yet. Conveniently, BindDescriptorSets
is passed a pipeline pointer by the app for this reason.
Bug: b/123244275
Test: dEQP-VK.binding_model.descriptorset_random.sets4.*
Change-Id: I94616efa7f2acd92733df9f408714c5867a87f53
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/31511
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Vulkan/VkCommandBuffer.cpp b/src/Vulkan/VkCommandBuffer.cpp
index 6981ec6..b60fe3e 100644
--- a/src/Vulkan/VkCommandBuffer.cpp
+++ b/src/Vulkan/VkCommandBuffer.cpp
@@ -966,9 +966,9 @@
struct BindDescriptorSet : public CommandBuffer::Command
{
- BindDescriptorSet(VkPipelineBindPoint pipelineBindPoint, uint32_t set, const VkDescriptorSet& descriptorSet,
+ BindDescriptorSet(VkPipelineBindPoint pipelineBindPoint, vk::PipelineLayout *pipelineLayout, uint32_t set, const VkDescriptorSet& descriptorSet,
uint32_t dynamicOffsetCount, uint32_t const *dynamicOffsets)
- : pipelineBindPoint(pipelineBindPoint), set(set), descriptorSet(descriptorSet),
+ : pipelineBindPoint(pipelineBindPoint), pipelineLayout(pipelineLayout), set(set), descriptorSet(descriptorSet),
dynamicOffsetCount(dynamicOffsetCount)
{
for (uint32_t i = 0; i < dynamicOffsetCount; i++)
@@ -981,7 +981,6 @@
{
ASSERT_OR_RETURN((pipelineBindPoint < VK_PIPELINE_BIND_POINT_RANGE_SIZE) && (set < MAX_BOUND_DESCRIPTOR_SETS));
auto &pipelineState = executionState.pipelineState[pipelineBindPoint];
- auto pipelineLayout = pipelineState.pipeline->getLayout();
auto dynamicOffsetBase = pipelineLayout->getDynamicOffsetBase(set);
ASSERT_OR_RETURN(dynamicOffsetBase + dynamicOffsetCount <= MAX_DESCRIPTOR_SET_COMBINED_BUFFERS_DYNAMIC);
@@ -994,6 +993,7 @@
private:
VkPipelineBindPoint pipelineBindPoint;
+ vk::PipelineLayout *pipelineLayout;
uint32_t set;
const VkDescriptorSet descriptorSet;
uint32_t dynamicOffsetCount;
@@ -1378,7 +1378,7 @@
ASSERT(dynamicOffsetCount >= numDynamicDescriptors);
addCommand<BindDescriptorSet>(
- pipelineBindPoint, descriptorSetIndex, pDescriptorSets[i],
+ pipelineBindPoint, layout, descriptorSetIndex, pDescriptorSets[i],
dynamicOffsetCount, pDynamicOffsets);
pDynamicOffsets += numDynamicDescriptors;