aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Hetu <sugoi@google.com>2019-02-01 17:49:55 -0500
committerAlexis Hétu <sugoi@google.com>2019-02-04 15:42:54 +0000
commit3f5a479280ccbc5b3c30be3f21191e5abf25037a (patch)
tree256eb59a026e6e5b08937438f41951dde272e9c8
parentcd610c9a9dbc9a827900725a0ae2645e37a8a4b2 (diff)
downloadswiftshader-3f5a479280ccbc5b3c30be3f21191e5abf25037a.tar.gz
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/24371 Tested-by: Alexis Hétu <sugoi@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: Chris Forbes <chrisforbes@google.com>
-rw-r--r--src/Vulkan/VkCommandBuffer.cpp41
1 files changed, 39 insertions, 2 deletions
diff --git a/src/Vulkan/VkCommandBuffer.cpp b/src/Vulkan/VkCommandBuffer.cpp
index 432edf91f..52bde469a 100644
--- a/src/Vulkan/VkCommandBuffer.cpp
+++ b/src/Vulkan/VkCommandBuffer.cpp
@@ -14,6 +14,7 @@
#include "VkCommandBuffer.hpp"
#include "VkBuffer.hpp"
+#include "VkEvent.hpp"
#include "VkFramebuffer.hpp"
#include "VkImage.hpp"
#include "VkPipeline.hpp"
@@ -343,6 +344,38 @@ struct PipelineBarrier : public CommandBuffer::Command
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)
{
// 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,
void CommandBuffer::setEvent(VkEvent event, VkPipelineStageFlags stageMask)
{
- UNIMPLEMENTED();
+ ASSERT(state == RECORDING);
+
+ addCommand<SignalEvent>(event, 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,