Commit 5edafb5a by Alexis Hetu Committed by Alexis Hétu

Descriptor sets binding

This cl partially implements vkCmdBindDescriptorSets. It allows binding descriptor sets to the proper pipeline bind point and descriptor set binding location. Dynamic offsets are not yet supported. Bug b/123244275 b/118619338 Change-Id: I91b14b79cb6cf00a4fabb6962938e7f55d5b6c22 Reviewed-on: https://swiftshader-review.googlesource.com/c/24909Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarBen Clayton <bclayton@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent ead1a345
......@@ -430,6 +430,25 @@ private:
VkPipelineStageFlags stageMask; // FIXME(b/117835459) : We currently ignore the flags and reset the event at the last stage
};
struct BindDescriptorSet : public CommandBuffer::Command
{
BindDescriptorSet(VkPipelineBindPoint pipelineBindPoint, uint32_t set, const VkDescriptorSet& descriptorSet)
: pipelineBindPoint(pipelineBindPoint), set(set), descriptorSet(descriptorSet)
{
}
void play(CommandBuffer::ExecutionState& executionState)
{
ASSERT((pipelineBindPoint < VK_PIPELINE_BIND_POINT_RANGE_SIZE) && (set < MAX_BOUND_DESCRIPTOR_SETS));
executionState.boundDescriptorSets[pipelineBindPoint][set] = descriptorSet;
}
private:
VkPipelineBindPoint pipelineBindPoint;
uint32_t set;
const VkDescriptorSet descriptorSet;
};
CommandBuffer::CommandBuffer(VkCommandBufferLevel pLevel) : level(pLevel)
{
// FIXME (b/119409619): replace this vector by an allocator so we can control all memory allocations
......@@ -681,7 +700,17 @@ void CommandBuffer::bindDescriptorSets(VkPipelineBindPoint pipelineBindPoint, Vk
uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets,
uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets)
{
UNIMPLEMENTED();
ASSERT(state == RECORDING);
if(dynamicOffsetCount > 0)
{
UNIMPLEMENTED();
}
for(uint32_t i = 0; i < descriptorSetCount; i++)
{
addCommand<BindDescriptorSet>(pipelineBindPoint, firstSet + i, pDescriptorSets[i]);
}
}
void CommandBuffer::bindIndexBuffer(VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType)
......
......@@ -125,6 +125,7 @@ public:
RenderPass* renderPass = nullptr;
Framebuffer* renderPassFramebuffer = nullptr;
Pipeline* pipelines[VK_PIPELINE_BIND_POINT_RANGE_SIZE] = {};
VkDescriptorSet boundDescriptorSets[VK_PIPELINE_BIND_POINT_RANGE_SIZE][MAX_BOUND_DESCRIPTOR_SETS] = { { VK_NULL_HANDLE } };
struct VertexInputBinding
{
......
......@@ -55,6 +55,7 @@ enum
enum
{
MAX_BOUND_DESCRIPTOR_SETS = 4,
MAX_VERTEX_INPUT_BINDINGS = 16,
};
......
......@@ -150,7 +150,7 @@ const VkPhysicalDeviceLimits& PhysicalDevice::getLimits() const
4000, // maxSamplerAllocationCount
131072, // bufferImageGranularity
0, // sparseAddressSpaceSize (unsupported)
4, // maxBoundDescriptorSets
MAX_BOUND_DESCRIPTOR_SETS, // maxBoundDescriptorSets
16, // maxPerStageDescriptorSamplers
12, // maxPerStageDescriptorUniformBuffers
4, // maxPerStageDescriptorStorageBuffers
......
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