Commit 3ff0e8c5 by Chris Forbes

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/+/31511Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Reviewed-by: 's avatarBen Clayton <bclayton@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 54b63031
...@@ -966,9 +966,9 @@ private: ...@@ -966,9 +966,9 @@ private:
struct BindDescriptorSet : public CommandBuffer::Command 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) uint32_t dynamicOffsetCount, uint32_t const *dynamicOffsets)
: pipelineBindPoint(pipelineBindPoint), set(set), descriptorSet(descriptorSet), : pipelineBindPoint(pipelineBindPoint), pipelineLayout(pipelineLayout), set(set), descriptorSet(descriptorSet),
dynamicOffsetCount(dynamicOffsetCount) dynamicOffsetCount(dynamicOffsetCount)
{ {
for (uint32_t i = 0; i < dynamicOffsetCount; i++) for (uint32_t i = 0; i < dynamicOffsetCount; i++)
...@@ -981,7 +981,6 @@ struct BindDescriptorSet : public CommandBuffer::Command ...@@ -981,7 +981,6 @@ struct BindDescriptorSet : public CommandBuffer::Command
{ {
ASSERT_OR_RETURN((pipelineBindPoint < VK_PIPELINE_BIND_POINT_RANGE_SIZE) && (set < MAX_BOUND_DESCRIPTOR_SETS)); ASSERT_OR_RETURN((pipelineBindPoint < VK_PIPELINE_BIND_POINT_RANGE_SIZE) && (set < MAX_BOUND_DESCRIPTOR_SETS));
auto &pipelineState = executionState.pipelineState[pipelineBindPoint]; auto &pipelineState = executionState.pipelineState[pipelineBindPoint];
auto pipelineLayout = pipelineState.pipeline->getLayout();
auto dynamicOffsetBase = pipelineLayout->getDynamicOffsetBase(set); auto dynamicOffsetBase = pipelineLayout->getDynamicOffsetBase(set);
ASSERT_OR_RETURN(dynamicOffsetBase + dynamicOffsetCount <= MAX_DESCRIPTOR_SET_COMBINED_BUFFERS_DYNAMIC); ASSERT_OR_RETURN(dynamicOffsetBase + dynamicOffsetCount <= MAX_DESCRIPTOR_SET_COMBINED_BUFFERS_DYNAMIC);
...@@ -994,6 +993,7 @@ struct BindDescriptorSet : public CommandBuffer::Command ...@@ -994,6 +993,7 @@ struct BindDescriptorSet : public CommandBuffer::Command
private: private:
VkPipelineBindPoint pipelineBindPoint; VkPipelineBindPoint pipelineBindPoint;
vk::PipelineLayout *pipelineLayout;
uint32_t set; uint32_t set;
const VkDescriptorSet descriptorSet; const VkDescriptorSet descriptorSet;
uint32_t dynamicOffsetCount; uint32_t dynamicOffsetCount;
...@@ -1378,7 +1378,7 @@ void CommandBuffer::bindDescriptorSets(VkPipelineBindPoint pipelineBindPoint, Vk ...@@ -1378,7 +1378,7 @@ void CommandBuffer::bindDescriptorSets(VkPipelineBindPoint pipelineBindPoint, Vk
ASSERT(dynamicOffsetCount >= numDynamicDescriptors); ASSERT(dynamicOffsetCount >= numDynamicDescriptors);
addCommand<BindDescriptorSet>( addCommand<BindDescriptorSet>(
pipelineBindPoint, descriptorSetIndex, pDescriptorSets[i], pipelineBindPoint, layout, descriptorSetIndex, pDescriptorSets[i],
dynamicOffsetCount, pDynamicOffsets); dynamicOffsetCount, pDynamicOffsets);
pDynamicOffsets += numDynamicDescriptors; pDynamicOffsets += numDynamicDescriptors;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment