Implemented the ResourceCache class.
[platform/core/uifw/dali-core.git] / dali / graphics / vulkan / vulkan-graphics.cpp
index 655272f..a898475 100644 (file)
@@ -29,7 +29,8 @@
 #include <dali/graphics/vulkan/vulkan-shader.h>
 #include <dali/graphics/vulkan/vulkan-descriptor-set.h>
 #include <dali/graphics/vulkan/vulkan-framebuffer.h>
-#include <dali/graphics/vulkan/vulkan-graphics-controller.h>
+#include <dali/graphics/vulkan/api/vulkan-api-controller.h>
+#include <dali/graphics/vulkan/vulkan-pipeline-cache.h>
 
 #include <dali/graphics-api/graphics-api-controller.h>
 
@@ -45,8 +46,6 @@
 #define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface"
 #endif
 
-#include <iostream>
-
 namespace Dali
 {
 namespace Graphics
@@ -73,10 +72,7 @@ const auto VALIDATION_LAYERS = std::vector< const char* >{
 };
 
 Graphics::Graphics() = default;
-
 Graphics::~Graphics() = default;
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wframe-larger-than="
 
 Platform Graphics::GetDefaultPlatform() const
 {
@@ -95,10 +91,10 @@ Dali::Graphics::API::Controller& Graphics::GetController()
 {
   if(!mGfxController)
   {
-    mGfxController = Dali::Graphics::Vulkan::Controller::New(*this);
+    mGfxController = Dali::Graphics::VulkanAPI::Controller::New(*this);
   }
 
-  return *mGfxController.get();
+  return *mGfxController;
 }
 
 std::vector<const char*> Graphics::PrepareDefaultInstanceExtensions()
@@ -258,10 +254,7 @@ void Graphics::PreparePhysicalDevice()
 
   mDeviceMemoryManager = GpuMemoryManager::New( *this );
 }
-#pragma GCC diagnostic pop
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wframe-larger-than="
 void Graphics::GetPhysicalDeviceProperties()
 {
   // store data on heap to keep object smaller
@@ -272,11 +265,10 @@ void Graphics::GetPhysicalDeviceProperties()
   mPhysicalDeviceFeatures =
     MakeUnique<vk::PhysicalDeviceFeatures>(mPhysicalDevice.getFeatures());
 }
-#pragma GCC diagnostic pop
 
 void Graphics::GetQueueFamilyProperties()
 {
-  mQueueFamilyProperties = std::move(mPhysicalDevice.getQueueFamilyProperties());
+  mQueueFamilyProperties = mPhysicalDevice.getQueueFamilyProperties();
 }
 
 FBID Graphics::CreateSurface(std::unique_ptr< SurfaceFactory > surfaceFactory)
@@ -299,7 +291,7 @@ SwapchainRef Graphics::CreateSwapchainForSurface( SurfaceRef surface )
 {
   auto swapchain = Swapchain::New( *this,
                                    GetGraphicsQueue(0u),
-                                   surface, 2, 0 );
+                                   surface, 4, 0 );
 
   // store swapchain in the correct pair
   for( auto&& val : mSurfaceFBIDMap )
@@ -336,8 +328,6 @@ SwapchainRef Graphics::GetSwapchainForFBID( FBID surfaceId )
   return mSurfaceFBIDMap[surfaceId].swapchain;
 }
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wframe-larger-than="
 std::vector< vk::DeviceQueueCreateInfo > Graphics::GetQueueCreateInfos()
 {
   // surface is needed in order to find a family that supports presentation to this surface
@@ -417,10 +407,7 @@ std::vector< vk::DeviceQueueCreateInfo > Graphics::GetQueueCreateInfos()
 
   return queueInfos;
 }
-#pragma GCC diagnostic pop
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wframe-larger-than="
 void Graphics::CreateDevice()
 {
   auto queueInfos = GetQueueCreateInfos();
@@ -479,8 +466,9 @@ void Graphics::CreateDevice()
       // todo: present queue
     }
   }
+
+  mPipelineDatabase = std::make_unique<PipelineCache>( *this );
 }
-#pragma GCC diagnostic pop
 
 vk::Device Graphics::GetDevice() const
 {