Nebula
Loading...
Searching...
No Matches
vkscheduler.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
14//------------------------------------------------------------------------------
15#include "vkdeferredcommand.h"
16#include "core/singleton.h"
17#include "util/dictionary.h"
18
19namespace Vulkan
20{
22{
24public:
25
54
58 virtual ~VkScheduler();
59
61 void PushImageLayoutTransition(CoreGraphicsQueueType queue, CoreGraphics::BarrierStage left, CoreGraphics::BarrierStage right, VkImageMemoryBarrier barrier);
63 void PushImageOwnershipChange(CoreGraphicsQueueType queue, CoreGraphics::BarrierStage left, CoreGraphics::BarrierStage right, VkImageMemoryBarrier barrier);
65 void PushImageColorClear(const VkImage& image, const CoreGraphicsQueueType queue, VkImageLayout layout, VkClearColorValue clearValue, VkImageSubresourceRange subres);
67 void PushImageDepthStencilClear(const VkImage& image, const CoreGraphicsQueueType queue, VkImageLayout layout, VkClearDepthStencilValue clearValue, VkImageSubresourceRange subres);
69 void PushImageUpdate(const VkImage& img, const VkImageCreateInfo& info, uint32_t mip, uint32_t face, VkDeviceSize size, uint32_t* data);
70
72 void ExecuteCommandPass(const CommandPass& pass);
74 void SetDevice(const VkDevice dev);
75
77 void Begin();
79 void EndTransfers();
81 void EndDraws();
83 void EndComputes();
84
86 void Discard();
87
88private:
89
91 void PushCommand(const VkDeferredCommand& cmd, const CommandPass& pass);
92
93 friend class VkUtilities;
94
95 friend void BindDescriptorsGraphics(const VkDescriptorSet* descriptors, uint32_t baseSet, uint32_t setCount, const uint32_t* offsets, uint32_t offsetCount, bool shared);
96 friend void BindDescriptorsCompute(const VkDescriptorSet* descriptors, uint32_t baseSet, uint32_t setCount, const uint32_t* offsets, uint32_t offsetCount);
97 friend void EndDrawThreads();
98 friend void EndDrawSubpass();
99
104 VkDevice dev;
110};
111
112
113//------------------------------------------------------------------------------
116inline void
117VkScheduler::SetDevice(const VkDevice dev)
118{
119 this->dev = dev;
120}
121
122} // namespace Vulkan
A collection of key/value pairs with quick value retrieval by key at roughly O(log n).
Definition dictionary.h:34
Implements a fixed size one-dimensional array.
Definition fixedarray.h:20
Definition vkscheduler.h:22
CommandPass
Definition vkscheduler.h:27
@ OnMainComputeSubmitted
Definition vkscheduler.h:35
@ OnEndPass
Definition vkscheduler.h:32
@ OnHandleFences
Definition vkscheduler.h:47
@ OnBeginComputeThread
Definition vkscheduler.h:38
@ OnBeginFrame
Definition vkscheduler.h:28
@ NumCommandPasses
Definition vkscheduler.h:52
@ OnBeginDrawThread
Definition vkscheduler.h:37
@ OnBeginPass
Definition vkscheduler.h:30
@ OnHandleDrawFences
Definition vkscheduler.h:44
@ OnBindGraphicsPipeline
Definition vkscheduler.h:49
@ OnBeginTransferThread
Definition vkscheduler.h:36
@ OnMainDrawSubmitted
Definition vkscheduler.h:34
@ OnMainTransferSubmitted
Definition vkscheduler.h:33
@ OnEndFrame
Definition vkscheduler.h:29
@ OnHandleComputeFences
Definition vkscheduler.h:45
@ OnHandleTransferFences
Definition vkscheduler.h:43
@ OnNextSubpass
Definition vkscheduler.h:31
@ OnDrawThreadsSubmitted
Definition vkscheduler.h:40
@ OnHandleSparseFences
Definition vkscheduler.h:46
@ OnComputeThreadsSubmitted
Definition vkscheduler.h:41
@ OnTransferThreadsSubmitted
Definition vkscheduler.h:39
@ OnBindComputePipeline
Definition vkscheduler.h:50
void Begin()
begin new cycle for all queues
Definition vkscheduler.cc:243
void EndTransfers()
end cycle for transfers
Definition vkscheduler.cc:256
Util::Dictionary< VkFence, Util::Array< VkDeferredCommand > > computeFenceCommands
Definition vkscheduler.h:108
void ExecuteCommandPass(const CommandPass &pass)
execute stacked commands
Definition vkscheduler.cc:132
Util::Dictionary< VkFence, Util::Array< VkDeferredCommand > > drawFenceCommands
Definition vkscheduler.h:107
bool putSparseFenceThisFrame
Definition vkscheduler.h:101
friend void EndDrawThreads()
bool putTransferFenceThisFrame
Definition vkscheduler.h:100
void EndComputes()
end cycle for computes
Definition vkscheduler.cc:310
Util::Dictionary< VkFence, Util::Array< VkDeferredCommand > > sparseFenceCommands
Definition vkscheduler.h:109
void PushImageUpdate(const VkImage &img, const VkImageCreateInfo &info, uint32_t mip, uint32_t face, VkDeviceSize size, uint32_t *data)
setup staging image update for later execution
Definition vkscheduler.cc:109
void PushImageDepthStencilClear(const VkImage &image, const CoreGraphicsQueueType queue, VkImageLayout layout, VkClearDepthStencilValue clearValue, VkImageSubresourceRange subres)
push image depth stencil clear
Definition vkscheduler.cc:91
friend class VkUtilities
Definition vkscheduler.h:93
Util::FixedArray< Util::Array< VkDeferredCommand > > commands
Definition vkscheduler.h:105
__DeclareSingleton(VkScheduler)
void SetDevice(const VkDevice dev)
set device to be used by this scheduler
Definition vkscheduler.h:117
void PushImageOwnershipChange(CoreGraphicsQueueType queue, CoreGraphics::BarrierStage left, CoreGraphics::BarrierStage right, VkImageMemoryBarrier barrier)
push transition image ownership transition
Definition vkscheduler.cc:56
bool putComputeFenceThisFrame
Definition vkscheduler.h:102
friend void EndDrawSubpass()
friend void BindDescriptorsCompute(const VkDescriptorSet *descriptors, uint32_t baseSet, uint32_t setCount, const uint32_t *offsets, uint32_t offsetCount)
Util::Dictionary< VkFence, Util::Array< VkDeferredCommand > > transferFenceCommands
Definition vkscheduler.h:106
VkScheduler()
constructor
Definition vkscheduler.cc:17
bool putDrawFenceThisFrame
Definition vkscheduler.h:103
VkDevice dev
Definition vkscheduler.h:104
friend void BindDescriptorsGraphics(const VkDescriptorSet *descriptors, uint32_t baseSet, uint32_t setCount, const uint32_t *offsets, uint32_t offsetCount, bool shared)
void PushImageColorClear(const VkImage &image, const CoreGraphicsQueueType queue, VkImageLayout layout, VkClearColorValue clearValue, VkImageSubresourceRange subres)
push image color clear
Definition vkscheduler.cc:73
void PushImageLayoutTransition(CoreGraphicsQueueType queue, CoreGraphics::BarrierStage left, CoreGraphics::BarrierStage right, VkImageMemoryBarrier barrier)
push image layout change
Definition vkscheduler.cc:39
void EndDraws()
end cycle for draws
Definition vkscheduler.cc:283
virtual ~VkScheduler()
destructor
Definition vkscheduler.cc:30
void PushCommand(const VkDeferredCommand &cmd, const CommandPass &pass)
push command to sheduler
Definition vkscheduler.cc:230
void Discard()
discard scheduler
Definition vkscheduler.cc:337
Vulkan implementation of GPU acceleration structure.
Definition vkaccelerationstructure.cc:15
Definition vkdeferredcommand.h:16