1 #ifndef DALI_GRAPHICS_VULKAN_SWAPCHAIN_H
2 #define DALI_GRAPHICS_VULKAN_SWAPCHAIN_H
5 * Copyright (c) 2018 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>
34 * Creates swapchain for given surface and queue
36 class Swapchain : public VkManaged
40 static SwapchainRef New( Graphics& graphics, Queue& presentationQueue, SurfaceRef surface, uint8_t bufferCount, uint32_t flags );
44 Swapchain( const Swapchain& ) = delete;
45 Swapchain& operator=( const Swapchain& ) = delete;
48 * Returns current framebuffer ( the one which is rendering to )
51 FramebufferRef GetCurrentFramebuffer() const;
54 * Returns any framebuffer from the queue
58 FramebufferRef GetFramebuffer( uint32_t index ) const;
61 * Requests for next framebuffer
64 FramebufferRef AcquireNextFramebuffer();
67 * Returns primary command buffer associated with currently
68 * being recorded frame
71 CommandBufferRef GetPrimaryCommandBuffer() const;
74 * Begins primary render pass, must be called after acquiring new image
76 void BeginPrimaryRenderPass();
79 * Begins primary render pass, must be called after acquiring new image
80 * @param beginInfo custom initialisation structure
82 void BeginPrimaryRenderPass( std::vector<std::array<float,4>> colors );
85 * Presents using default present queue, asynchronously
90 * Presents using default queue, synchronized with supplied semaphores
91 * @param waitSemaphores
93 void Present( std::vector<vk::Semaphore> waitSemaphores );
98 Swapchain( Graphics& graphics, Queue& presentationQueue, SurfaceRef surface, uint8_t bufferCount, uint32_t flags );
99 ~Swapchain() override;
104 std::unique_ptr<Impl> mImpl;
107 } // namespace Vulkan
108 } // namespace Graphics
110 #endif //DALI_GRAPHICS_VULKAN_SWAPCHAIN_H