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>
25 extern "C" std::vector<uint32_t> GraphicsGetBuiltinShader( const std::string& tag );
29 /// fixme: substituting directly the vulkan implementation
32 using GraphicsImpl = Dali::Graphics::Vulkan::Graphics;
39 using Swapchain = Dali::Graphics::Vulkan::Swapchain;
40 using SwapchainRef = Dali::Graphics::Vulkan::SwapchainRef;
45 auto impl = Dali::Graphics::MakeUnique<Dali::Graphics::GraphicsImpl>();
49 mGraphicsImpl = std::move(impl);
57 Dali::Graphics::FBID Graphics::Create(
58 std::unique_ptr<Dali::Integration::Graphics::SurfaceFactory> surfaceFactory)
60 //@todo do we really need to have a surface that early???
63 auto retval = mGraphicsImpl->CreateSurface(std::move(surfaceFactory));
66 mGraphicsImpl->CreateDevice();
68 // create swapchain from surface
69 auto surface = mGraphicsImpl->GetSurface( retval );
72 mGraphicsImpl->CreateSwapchainForSurface( surface );
77 Dali::Graphics::FBID Graphics::CreateSurface(
78 std::unique_ptr<Dali::Integration::Graphics::SurfaceFactory> surfaceFactory)
83 void Graphics::PreRender(Dali::Graphics::FBID framebufferId)
85 assert(framebufferId != 0 && "Invalid FBID!");
86 auto swapchain = mGraphicsImpl->GetSwapchainForFBID( framebufferId );
87 swapchain->AcquireNextFramebuffer();
90 Dali::Graphics::API::Controller& Graphics::GetController()
92 return mGraphicsImpl->GetController();
98 void Graphics::PostRender(Dali::Graphics::FBID framebufferId)
100 auto swapchain = mGraphicsImpl->GetSwapchainForFBID( framebufferId );
101 swapchain->Present();
104 void IncludeThisLibrary()
106 // dummy function to create linker dependency
107 GraphicsGetBuiltinShader("");
110 } // Namespace Graphics
111 } // Namespace Integration