[Vulkan] Graphics API cleanup
[platform/core/uifw/dali-core.git] / dali / graphics-api / graphics-api-controller.h
index cfb48d0..7251111 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_GRAPHICS_API_CONTROLLER_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  */
 
+// INTERNAL INCLUDES
 #include <dali/graphics-api/graphics-api-accessor.h>
 #include <dali/graphics-api/graphics-api-base-factory.h>
-#include <dali/graphics-api/graphics-api-dynamic-buffer.h>
 #include <dali/graphics-api/graphics-api-framebuffer.h>
+#include <dali/graphics-api/graphics-api-render-command.h>
 #include <dali/graphics-api/graphics-api-sampler.h>
 #include <dali/graphics-api/graphics-api-shader.h>
-#include <dali/graphics-api/graphics-api-static-buffer.h>
-#include <dali/graphics-api/graphics-api-texture-set.h>
-#include <dali/graphics-api/graphics-api-texture.h>
+#include <dali/graphics-api/graphics-api-shader-details.h>
+#include <dali/graphics-api/graphics-api-shader-factory.h>
 #include <dali/graphics-api/graphics-api-texture-factory.h>
+#include <dali/graphics-api/graphics-api-texture.h>
+#include <dali/graphics-api/graphics-api-buffer.h>
+#include <dali/graphics-api/graphics-api-buffer-factory.h>
+#include <dali/graphics-api/utility/utility-builder.h>
 
 namespace Dali
 {
@@ -35,71 +39,107 @@ namespace Graphics
 {
 namespace API
 {
-
+class ShaderFactory;
 /**
  * @brief Interface class for Manager types in the graphics API.
  */
 class Controller
 {
 public:
+
+  virtual ~Controller() = default;
+
   /**
    * @brief Create a new object
    */
-  virtual Accessor< Shader > CreateShader(const BaseFactory< Shader >& factory) = 0;
+  virtual Accessor<Shader> CreateShader( const BaseFactory<Shader>& factory ) = 0;
 
   /**
    * @brief Create a new object
    */
-  virtual Accessor< Texture > CreateTexture(const BaseFactory< Texture >& factory) = 0;
+  virtual Accessor<Texture> CreateTexture( const BaseFactory<Texture>& factory ) = 0;
 
   /**
    * @brief Create a new object
    */
-  virtual Accessor< TextureSet > CreateTextureSet(const BaseFactory< TextureSet >& factory) = 0;
+  virtual Accessor<Buffer> CreateBuffer( const BaseFactory<Buffer>& factory ) = 0;
 
   /**
    * @brief Create a new object
    */
-  virtual Accessor< DynamicBuffer > CreateDynamicBuffer(
-      const BaseFactory< DynamicBuffer >& factory) = 0;
+  virtual Accessor<Sampler> CreateSampler( const BaseFactory<Sampler>& factory ) = 0;
 
   /**
    * @brief Create a new object
    */
-  virtual Accessor< StaticBuffer > CreateStaticBuffer(
-      const BaseFactory< StaticBuffer >& factory) = 0;
+  virtual Accessor<Framebuffer> CreateFramebuffer( const BaseFactory<Framebuffer>& factory ) = 0;
 
   /**
-   * @brief Create a new object
+   * @brief Get a render list
    */
-  virtual Accessor< Sampler > CreateSampler(const BaseFactory< Sampler >& factory) = 0;
+  virtual void GetRenderItemList() = 0;
 
   /**
-   * @brief Create a new object
+   * @brief Returns texture factory
+   * @return
    */
-  virtual Accessor< Framebuffer > CreateFramebuffer(const BaseFactory< Framebuffer >& factory) = 0;
+  virtual TextureFactory& GetTextureFactory() const = 0;
 
   /**
-   * @brief Get a render list
+   * @brief Returns shader factory
+   * @return
    */
-  virtual void GetRenderItemList() = 0;
+  virtual ShaderFactory& GetShaderFactory() const = 0;
+
+  /**
+ * @brief Returns shader factory
+ * @return
+ */
+  virtual BufferFactory& GetBufferFactory() const = 0;
+
+  /**
+   * @brief alAllocates render command ( depends on implementation );
+   * @return
+   */
+  virtual std::unique_ptr<API::RenderCommand> AllocateRenderCommand() = 0;
+
+  /**
+   * @brief Submits a list of commands
+   * @param commands
+   */
+  virtual void SubmitCommands( std::vector<API::RenderCommand*> commands ) = 0;
+
+  /**
+   * @brief Mark the beginning of a frame
+   */
+  virtual void BeginFrame() = 0;
+
+  /**
+   * @brief Mark the end of a frame
+   */
+  virtual void EndFrame() = 0;
 
 public:
   // not copyable
-  Controller(const Controller&) = delete;
-  Controller& operator=(const Controller&) = delete;
-
-  virtual ~Controller() = default;
+  Controller( const Controller& ) = delete;
+  Controller& operator=( const Controller& ) = delete;
 
 protected:
   // derived types should not be moved direcly to prevent slicing
-  Controller(Controller&&) = default;
-  Controller& operator=(Controller&&) = default;
+  Controller( Controller&& ) = default;
+  Controller& operator=( Controller&& ) = default;
 
   /**
    * Objects of this type should not directly.
    */
   Controller() = default;
+
+  /**
+   * @brief create an element for the given number of elements and element size
+   */
+  virtual std::unique_ptr<char> CreateBuffer( size_t numberOfElements, size_t elementSize ) = 0;
+
+private:
 };
 
 } // namespace API