2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali/graphics/vulkan/vulkan-types.h>
19 #include <dali/graphics/vulkan/vulkan-graphics.h>
20 #include <dali/graphics/vulkan/vulkan-surface.h>
21 #include <dali/graphics/vulkan/vulkan-framebuffer.h>
22 #include <dali/graphics-api/graphics-api-controller.h>
23 #include <dali/integration-api/graphics/graphics.h>
28 /// fixme: substituting directly the vulkan implementation
31 using GraphicsImpl = Dali::Graphics::Vulkan::Graphics;
38 using Swapchain = Dali::Graphics::Vulkan::Swapchain;
39 using SwapchainRef = Dali::Graphics::Vulkan::SwapchainRef;
44 auto impl = Dali::Graphics::MakeUnique<Dali::Graphics::GraphicsImpl>();
48 mGraphicsImpl = std::move(impl);
56 Dali::Graphics::FBID Graphics::Create(
57 std::unique_ptr<Dali::Integration::Graphics::SurfaceFactory> surfaceFactory)
59 //@todo do we really need to have a surface that early???
62 auto retval = mGraphicsImpl->CreateSurface(std::move(surfaceFactory));
65 mGraphicsImpl->CreateDevice();
67 // create swapchain from surface
68 auto surface = mGraphicsImpl->GetSurface( retval );
71 mGraphicsImpl->CreateSwapchainForSurface( surface );
76 Dali::Graphics::FBID Graphics::CreateSurface(
77 std::unique_ptr<Dali::Integration::Graphics::SurfaceFactory> surfaceFactory)
82 void Graphics::PreRender(Dali::Graphics::FBID framebufferId)
84 assert(framebufferId != 0 && "Invalid FBID!");
85 auto swapchain = mGraphicsImpl->GetSwapchainForFBID( framebufferId );
86 swapchain->AcquireNextFramebuffer();
89 Dali::Graphics::API::Controller& Graphics::GetController()
91 return mGraphicsImpl->GetController();
97 void Graphics::PostRender(Dali::Graphics::FBID framebufferId)
99 auto swapchain = mGraphicsImpl->GetSwapchainForFBID( framebufferId );
100 swapchain->Present();
103 void IncludeThisLibrary()
105 // dummy function to create linker dependency
108 } // Namespace Graphics
109 } // Namespace Integration