Commit e7b2a058 by Alexis Hetu Committed by Alexis Hétu

vkCmdExecuteCommands implementation

Basic support for executing secondary command buffers, without support for any inheritance features. Bug b/118619338 Change-Id: Ie3453018a45a722ecfa4f1acd20c95442fbb3d9b Tests: dEQP-VK.memory.pipeline_barrier.host_write_transfer_src.* Tests: dEQP-VK.api.command_buffers.allocate_single_secondary Tests: dEQP-VK.api.command_buffers.allocate_many_secondary Tests: dEQP-VK.api.command_buffers.trim_command_pool_secondary Tests: dEQP-VK.api.command_buffers.record_single_secondary Tests: dEQP-VK.api.command_buffers.record_many_secondary Tests: dEQP-VK.api.command_buffers.submit_twice_secondary Tests: dEQP-VK.api.command_buffers.record_one_time_submit_secondary Tests: dEQP-VK.api.command_buffers.secondary_execute Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/27493Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 603a1b53
...@@ -109,6 +109,23 @@ protected: ...@@ -109,6 +109,23 @@ protected:
private: private:
}; };
class ExecuteCommands : public CommandBuffer::Command
{
public:
ExecuteCommands(const VkCommandBuffer& commandBuffer) : commandBuffer(commandBuffer)
{
}
protected:
void play(CommandBuffer::ExecutionState& executionState) override
{
Cast(commandBuffer)->submitSecondary(executionState);
}
private:
const VkCommandBuffer commandBuffer;
};
class PipelineBind : public CommandBuffer::Command class PipelineBind : public CommandBuffer::Command
{ {
public: public:
...@@ -660,10 +677,7 @@ VkResult CommandBuffer::begin(VkCommandBufferUsageFlags flags, const VkCommandBu ...@@ -660,10 +677,7 @@ VkResult CommandBuffer::begin(VkCommandBufferUsageFlags flags, const VkCommandBu
// must also provide a non-null pInheritanceInfo, which we don't implement yet, but is caught below. // must also provide a non-null pInheritanceInfo, which we don't implement yet, but is caught below.
(void) flags; (void) flags;
if(pInheritanceInfo) // pInheritanceInfo merely contains optimization hints, so we currently ignore it
{
UNIMPLEMENTED("pInheritanceInfo");
}
if(state != INITIAL) if(state != INITIAL)
{ {
...@@ -727,7 +741,12 @@ void CommandBuffer::endRenderPass() ...@@ -727,7 +741,12 @@ void CommandBuffer::endRenderPass()
void CommandBuffer::executeCommands(uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers) void CommandBuffer::executeCommands(uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers)
{ {
UNIMPLEMENTED("executeCommands"); ASSERT(state == RECORDING);
for(uint32_t i = 0; i < commandBufferCount; ++i)
{
addCommand<ExecuteCommands>(pCommandBuffers[i]);
}
} }
void CommandBuffer::setDeviceMask(uint32_t deviceMask) void CommandBuffer::setDeviceMask(uint32_t deviceMask)
...@@ -1102,4 +1121,12 @@ void CommandBuffer::submit(CommandBuffer::ExecutionState& executionState) ...@@ -1102,4 +1121,12 @@ void CommandBuffer::submit(CommandBuffer::ExecutionState& executionState)
state = EXECUTABLE; state = EXECUTABLE;
} }
void CommandBuffer::submitSecondary(CommandBuffer::ExecutionState& executionState) const
{
for(auto& command : *commands)
{
command->play(executionState);
}
}
} // namespace vk } // namespace vk
...@@ -144,6 +144,7 @@ public: ...@@ -144,6 +144,7 @@ public:
}; };
void submit(CommandBuffer::ExecutionState& executionState); void submit(CommandBuffer::ExecutionState& executionState);
void submitSecondary(CommandBuffer::ExecutionState& executionState) const;
class Command; class Command;
private: private:
......
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