1 #ifndef DALI_GRAPHICS_VULKAN_COMMAND_BUFFER_H
2 #define DALI_GRAPHICS_VULKAN_COMMAND_BUFFER_H
5 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/graphics/vulkan/vulkan-types.h>
36 CommandBuffer() = delete;
38 CommandBuffer(Graphics& graphics, CommandPool& ownerPool, vk::CommandBuffer commandBuffer);
39 CommandBuffer(Graphics& graphics, CommandPool& ownerPool, const vk::CommandBufferAllocateInfo& allocateInfo);
40 CommandBuffer(Graphics& graphics, CommandPool& ownerPool);
44 /** Begin recording */
45 void Begin(vk::CommandBufferUsageFlags usageFlags = vk::CommandBufferUsageFlags{},
46 vk::CommandBufferInheritanceInfo* inheritanceInfo = nullptr);
48 /** Finish recording */
51 /** Reset command buffer */
54 /** Free command buffer */
57 /** Records image layout transition barrier for one image */
58 void ImageLayoutTransition(vk::Image image, vk::ImageLayout oldLayout, vk::ImageLayout newLayout, vk::ImageAspectFlags aspectMask);
60 /** Push wait semaphores */
61 void PushWaitSemaphores(const std::vector< vk::Semaphore >& semaphores,
62 const std::vector< vk::PipelineStageFlags >& stages);
64 /** Push signal semaphores */
65 void PushSignalSemaphores(const std::vector< vk::Semaphore >& semaphores);
67 const std::vector< vk::Semaphore >& GetSignalSemaphores() const
69 return mSignalSemaphores;
72 const std::vector< vk::Semaphore >& GetSWaitSemaphores() const
74 return mWaitSemaphores;
77 const std::vector< vk::PipelineStageFlags >& GetWaitSemaphoreStages() const
82 /** Returns Vulkan object associated with the buffer */
83 inline const vk::CommandBuffer& Get() const
85 return mCommandBuffer;
89 void RecordImageLayoutTransition(vk::Image image,
90 vk::AccessFlags srcAccessMask,
91 vk::AccessFlags dstAccessMask,
92 vk::PipelineStageFlags srcStageMask,
93 vk::PipelineStageFlags dstStageMask,
94 vk::ImageLayout oldLayout,
95 vk::ImageLayout newLayout,
96 vk::ImageAspectFlags aspectMask);
101 CommandPool& mCommandPool;
103 // semaphores per command buffer
104 std::vector< vk::Semaphore > mSignalSemaphores;
105 std::vector< vk::Semaphore > mWaitSemaphores;
106 std::vector< vk::PipelineStageFlags > mWaitStages;
108 vk::CommandBuffer mCommandBuffer;
113 } // namespace Vulkan
114 } // namespace Graphics
117 #endif // DALI_GRAPHICS_VULKAN_COMMAND_BUFFER_H