Commit 3f5a4792 by Alexis Hetu Committed by Alexis Hétu

vkCmdSetEvent/vkCmdResetEvent implementation

This implementation of vkCmdSetEvent and vkCmdResetEvent assumes: - There's only one queue (which currently is the case) - Everything in the queue is executed linearly (which is currently the case) - VkPipelineStageFlags can be ignored for now Taking VkPipelineStageFlags into account could be used to avoid unnecessary stalls or cache flushing. This will come at the optimization phase after full conformance is achieved. Bug b/117835459 Change-Id: Icb08a8b8e3fe63e827c9ba994a5e4353603e4ac9 Reviewed-on: https://swiftshader-review.googlesource.com/c/24371Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com>
parent cd610c9a
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "VkCommandBuffer.hpp" #include "VkCommandBuffer.hpp"
#include "VkBuffer.hpp" #include "VkBuffer.hpp"
#include "VkEvent.hpp"
#include "VkFramebuffer.hpp" #include "VkFramebuffer.hpp"
#include "VkImage.hpp" #include "VkImage.hpp"
#include "VkPipeline.hpp" #include "VkPipeline.hpp"
...@@ -343,6 +344,38 @@ struct PipelineBarrier : public CommandBuffer::Command ...@@ -343,6 +344,38 @@ struct PipelineBarrier : public CommandBuffer::Command
private: private:
}; };
struct SignalEvent : public CommandBuffer::Command
{
SignalEvent(VkEvent ev, VkPipelineStageFlags stageMask) : ev(ev), stageMask(stageMask)
{
}
void play(CommandBuffer::ExecutionState& executionState)
{
Cast(ev)->signal();
}
private:
VkEvent ev;
VkPipelineStageFlags stageMask; // FIXME(b/117835459) : We currently ignore the flags and signal the event at the last stage
};
struct ResetEvent : public CommandBuffer::Command
{
ResetEvent(VkEvent ev, VkPipelineStageFlags stageMask) : ev(ev), stageMask(stageMask)
{
}
void play(CommandBuffer::ExecutionState& executionState)
{
Cast(ev)->reset();
}
private:
VkEvent ev;
VkPipelineStageFlags stageMask; // FIXME(b/117835459) : We currently ignore the flags and reset the event at the last stage
};
CommandBuffer::CommandBuffer(VkCommandBufferLevel pLevel) : level(pLevel) CommandBuffer::CommandBuffer(VkCommandBufferLevel pLevel) : level(pLevel)
{ {
// FIXME (b/119409619): replace this vector by an allocator so we can control all memory allocations // FIXME (b/119409619): replace this vector by an allocator so we can control all memory allocations
...@@ -729,12 +762,16 @@ void CommandBuffer::resolveImage(VkImage srcImage, VkImageLayout srcImageLayout, ...@@ -729,12 +762,16 @@ void CommandBuffer::resolveImage(VkImage srcImage, VkImageLayout srcImageLayout,
void CommandBuffer::setEvent(VkEvent event, VkPipelineStageFlags stageMask) void CommandBuffer::setEvent(VkEvent event, VkPipelineStageFlags stageMask)
{ {
UNIMPLEMENTED(); ASSERT(state == RECORDING);
addCommand<SignalEvent>(event, stageMask);
} }
void CommandBuffer::resetEvent(VkEvent event, VkPipelineStageFlags stageMask) void CommandBuffer::resetEvent(VkEvent event, VkPipelineStageFlags stageMask)
{ {
UNIMPLEMENTED(); ASSERT(state == RECORDING);
addCommand<ResetEvent>(event, stageMask);
} }
void CommandBuffer::waitEvents(uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, void CommandBuffer::waitEvents(uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask,
......
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