Commit fc8a46d0 by Chris Forbes

Wire up indirect dispatch

Bug: b/118619338 Change-Id: Ia03cbc8908efcbb5264f9fbdc91f06eac964c396 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/27908Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Presubmit-Ready: Chris Forbes <chrisforbes@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 c9d98716
......@@ -185,6 +185,32 @@ private:
uint32_t groupCountZ;
};
class DispatchIndirect : public CommandBuffer::Command
{
public:
DispatchIndirect(VkBuffer buffer, VkDeviceSize offset) :
buffer(buffer), offset(offset)
{
}
protected:
void play(CommandBuffer::ExecutionState& executionState) override
{
auto cmd = reinterpret_cast<VkDispatchIndirectCommand const *>(Cast(buffer)->getOffsetPointer(offset));
ComputePipeline* pipeline = static_cast<ComputePipeline*>(
executionState.pipelines[VK_PIPELINE_BIND_POINT_COMPUTE]);
pipeline->run(cmd->x, cmd->y, cmd->z,
MAX_BOUND_DESCRIPTOR_SETS,
executionState.boundDescriptorSets[VK_PIPELINE_BIND_POINT_COMPUTE],
executionState.pushConstants);
}
private:
VkBuffer buffer;
VkDeviceSize offset;
};
struct VertexBufferBind : public CommandBuffer::Command
{
VertexBufferBind(uint32_t pBinding, const VkBuffer pBuffer, const VkDeviceSize pOffset) :
......@@ -981,7 +1007,7 @@ void CommandBuffer::dispatch(uint32_t groupCountX, uint32_t groupCountY, uint32_
void CommandBuffer::dispatchIndirect(VkBuffer buffer, VkDeviceSize offset)
{
UNIMPLEMENTED("dispatchIndirect");
addCommand<DispatchIndirect>(buffer, offset);
}
void CommandBuffer::copyBuffer(VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions)
......
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