15 #include <vsg/core/ScratchMemory.h>
16 #include <vsg/state/PipelineLayout.h>
17 #include <vsg/vk/CommandPool.h>
23 class ViewDependentState;
29 const VkCommandBuffer* data()
const {
return &_commandBuffer; }
30 operator VkCommandBuffer()
const {
return _commandBuffer; }
31 VkCommandBuffer vk()
const {
return _commandBuffer; }
33 std::atomic_uint& numDependentSubmissions() {
return _numDependentSubmissions; }
35 const uint32_t deviceID;
37 Mask traversalMask = MASK_ALL;
38 Mask overrideMask = MASK_OFF;
41 VkCommandBufferLevel level()
const {
return _level; }
46 Device* getDevice() {
return _device; }
47 const Device* getDevice()
const {
return _device; }
49 CommandPool* getCommandPool() {
return _commandPool; }
50 const CommandPool* getCommandPool()
const {
return _commandPool; }
52 void setCurrentPipelineLayout(
const PipelineLayout* pipelineLayout)
54 _currentPipelineLayout = pipelineLayout->vk(deviceID);
55 if (pipelineLayout->pushConstantRanges.empty())
56 _currentPushConstantStageFlags = 0;
58 _currentPushConstantStageFlags = pipelineLayout->pushConstantRanges.front().stageFlags;
61 VkPipelineLayout getCurrentPipelineLayout()
const {
return _currentPipelineLayout; }
62 VkShaderStageFlags getCurrentPushConstantStageFlags()
const {
return _currentPushConstantStageFlags; }
64 ref_ptr<ScratchMemory> scratchMemory;
68 CommandBuffer(CommandPool* commandPool, VkCommandBuffer commandBuffer, VkCommandBufferLevel level);
70 virtual ~CommandBuffer();
72 VkCommandBuffer _commandBuffer;
73 VkCommandBufferLevel _level;
75 std::atomic_uint _numDependentSubmissions{0};
76 ref_ptr<Device> _device;
77 ref_ptr<CommandPool> _commandPool;
78 VkPipelineLayout _currentPipelineLayout;
79 VkShaderStageFlags _currentPushConstantStageFlags;
83 using CommandBuffers = std::vector<ref_ptr<CommandBuffer>>;
95 CommandBuffers buffers()
const;
99 mutable std::mutex _mutex;
100 std::map<int, ref_ptr<RecordedCommandBuffers>> _orderedCommandBuffers;
101 CommandBuffers _commandBuffers;
CommandBuffer encapsulates VkCommandBuffer.
Definition: CommandBuffer.h:27
void reset()
reset the CommandBuffer for the new frame.
Device encapsulates VkDevice, a logical handle to the PhysicalDevice with capabilities specified duri...
Definition: Device.h:37
Thread safe container class.
Definition: CommandBuffer.h:87
Definition: ViewDependentState.h:105