[Vulkan] Cleanup after removing rendering backend
authoradam.b <jsr184@gmail.com>
Fri, 25 May 2018 15:34:48 +0000 (16:34 +0100)
committeradam.b <jsr184@gmail.com>
Fri, 25 May 2018 15:51:13 +0000 (16:51 +0100)
Change-Id: Iec7b0a19a26dc36f9d445ce44a137200460c4f8e

dali/graphics-api/graphics-api-render-command.h
dali/graphics/vulkan/api/internal/vulkan-ubo-manager.cpp
dali/graphics/vulkan/api/internal/vulkan-ubo-manager.h
dali/graphics/vulkan/api/vulkan-api-render-command.h
dali/graphics/vulkan/spirv/vulkan-spirv-opcode.h
dali/graphics/vulkan/spirv/vulkan-spirv.cpp
dali/graphics/vulkan/vulkan-framebuffer.cpp
dali/graphics/vulkan/vulkan-graphics.cpp
dali/graphics/vulkan/vulkan-graphics.h
dali/graphics/vulkan/vulkan-swapchain.cpp

index 60382d4..6cc597e 100644 (file)
@@ -44,6 +44,143 @@ class Pipeline;
 
 /**
  * @brief Interface class for RenderCommand types in the graphics API.
+ *
+ * @startuml
+ *
+ * skinparam defaultFontName Ubuntu Mono
+ * class RenderCommand {
+ *  -- protected --
+ *  #VertexAttributeBufferBinding[]  mVertexBufferBindings
+ *  #UniformBufferBinding[]          mUniformBufferBindings
+ *  #TextureBinding[]                mTextureBindings
+ *  #SamplerBinding[]                mSamplerBindings
+ *  #IndexBufferBinding              mIndexBufferBinding
+ *  #RenderTargetBinding             mRenderTargetBinding
+ *  #DrawCommand                     mDrawCommand
+ *  #PushConstantsBinding[]          mPushConstantsBindings
+ *  #RenderState                     mRenderState
+ *
+ * -- public API --
+ *  +RenderCommand& BindVertextBuffers()
+ *  +RenderCommand& BindUniformBuffers()
+ *  +RenderCommand& BindTextures()
+ *  +RenderCommand& BindSamplers()
+ *  +RenderCommand& PushConstants()
+ *  +RenderCommand& BindRenderState()
+ *  +RenderCommand& Draw()
+ *  -- static API ( helper functions )--
+ *  {static} NewVertexAttributeBufferBindings()
+ *  {static} NewVertexAttributeBufferBindings()
+ *  {static} NewVertexAttributeBufferBindings()
+ *  {static} NewTextureBindings()
+ *  {static} NewPushConstantsBindings()
+ * }
+ *
+ * class VertexAttributeBufferBinding {
+ * Accessor<Buffer>   buffer
+ * uint32_t           location
+ * uint32_t           offset
+ * uint32_t           stride
+ * InputAttributeRate rate
+ * void*              pNext
+ * }
+ *
+ * class UniformBufferBinding {
+ *   #Accessor<Buffer> buffer
+ *   #uint32_t         offset
+ *   #uint32_t         dataSize
+ *   #uint32_t         binding
+ *   #void*            pNext
+ * }
+ *
+  class IndexBufferBinding {
+    #Accessor<Buffer> buffer
+    #uint32_t         offset
+    #IndexType        type
+    #void*            pNext
+  }
+
+  class RenderTargetBinding {
+    #Accessor<Framebuffer>                 framebuffer
+    #std::vector<Framebuffer::ClearColor>  clearColors
+    #Framebuffer::DepthStencilClearColor   dsClearColor
+    #void*                                 pNext
+  }
+
+  class DrawCommand {
+      #DrawType drawType;
+      #uint32_t firstVertex
+      #uint32_t firstIndex
+      #uint32_t vertexCount
+      #uint32_t indicesCount
+      #uint32_t firstInstance
+      #uint32_t instanceCount
+      #void*    pNext
+  }
+
+  class PushConstantsBinding {
+    #void*     data
+    #uint32_t  size
+    #uint32_t  binding
+    #void*    pNext
+  }
+
+  class RenderState {
+    #Accessor<Shader> shader
+    #void*    pNext
+  }
+
+  class TextureBinding {
+    #Accessor<Texture> texture
+    #Accessor<Sampler> sampler
+    #uint32_t          binding
+    #void*             pNext
+  }
+
+  class SamplerBinding {
+    #Accessor<Sampler> sampler
+    #uint32_t binding
+    #void*    pNext
+  }
+
+ note as RenderStateWIP
+ Other render states like
+ blending etc. should be added
+ as public fields of this structure.
+ end note
+
+ RenderStateWIP .. RenderState
+
+ * note as N1
+ * Each state is described as POD
+ * structure which is a Vulkan
+ * approach.
+ * end note
+ *
+ * note as N2
+ * Field pNext may be used by the
+ * implementation to pass additional
+ * data.
+ * end note
+ *
+ * N2 .. VertexAttributeBufferBinding::pNext
+ * N1 .. VertexAttributeBufferBinding
+ * N1 .. UniformBufferBinding
+ * N1 .. IndexBufferBinding
+ * N1 .. RenderTargetBinding
+ *
+
+ *
+ * RenderCommand *-right- VertexAttributeBufferBinding
+ * RenderCommand *-right- UniformBufferBinding
+ * RenderCommand *-left- IndexBufferBinding
+ * RenderCommand *-left- RenderTargetBinding
+ * RenderCommand *-up- RenderState
+ * RenderCommand *-up- DrawCommand
+ * RenderCommand *-down- PushConstantsBinding
+ * RenderCommand *-down- SamplerBinding
+ * RenderCommand *-down- TextureBinding
+ * @enduml
  */
 class RenderCommand
 {
@@ -72,6 +209,7 @@ public:
 
   /**
    * Describes buffer attribute binding
+   *
    */
   struct VertexAttributeBufferBinding
   {
@@ -554,6 +692,7 @@ protected:
 } // namespace Graphics
 } // namespace Dali
 
+
 #endif // DALI_GRAPHICS_API_RENDER_COMMAND_H
 
 
index c3e3941..657e314 100644 (file)
@@ -27,7 +27,6 @@ namespace Graphics
 namespace VulkanAPI
 {
 
-
 struct UboManager::Impl
 {
   explicit Impl( UboManager& uboManager, Controller& controller )
index 45e8c7d..1856b19 100644 (file)
@@ -33,6 +33,10 @@ class UboManager
 {
 public:
 
+  /**
+   *
+   * @param controller
+   */
   explicit UboManager( Controller& controller );
   ~UboManager();
 
index 9b60f19..ea304fb 100644 (file)
@@ -30,6 +30,7 @@ namespace Vulkan
 {
 class PipelineCache;
 }
+
 namespace VulkanAPI
 {
 class Controller;
index 81cd2e0..bd7640d 100644 (file)
@@ -89,8 +89,7 @@ struct SPIRVOpCode
 
 namespace
 {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wlarger-than="
+
 /**
  * List of all the SPIR-V opcodes
  * OpCodes describing types: 19-39
@@ -412,7 +411,7 @@ static const SPIRVOpCode OP_CODE_ARRAY[] = {{"OpNop", 0, false, false, false},
                                             {"OpGroupFMaxNonUniformAMD", 5005, true, true, false},
                                             {"OpGroupUMaxNonUniformAMD", 5006, true, true, false},
                                             {"OpGroupSMaxNonUniformAMD", 5007, true, true, false}};
-#pragma GCC diagnostic pop
+
 static const SPIRVOpCode OP_CODE_NULL{};
 const SPIRVOpCode& FindOpCode( uint32_t code )
 {
index 6d981e5..8aa867b 100644 (file)
@@ -35,8 +35,6 @@ SPIRVShader::Impl& SPIRVShader::GetImplementation() const
   return *mImpl;
 }
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wframe-larger-than="
 struct SPIRVShader::Impl
 {
   /**
@@ -976,7 +974,6 @@ public:
   Header                                                               header;
 
 };
-#pragma GCC diagnostic pop
 
 /**************************************************************************************
  * SPIRVShader
index 8f8f4e7..31db682 100644 (file)
@@ -19,7 +19,6 @@
 #include <dali/graphics/vulkan/vulkan-graphics.h>
 #include <dali/graphics/vulkan/vulkan-image.h>
 
-
 namespace Dali
 {
 namespace Graphics
@@ -37,8 +36,6 @@ struct Framebuffer::Impl
 
   // creating render pass may happen either as deferred or
   // when framebuffer is initialised into immutable state
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wframe-larger-than="
   bool Initialise()
   {
     mAttachmentReference.clear();
@@ -142,7 +139,6 @@ struct Framebuffer::Impl
 
     return true;
   }
-#pragma GCC diagnostic pop
 
   /**
    * Creates immutable framebuffer object
index 0a0ffbd..fbcb697 100644 (file)
@@ -72,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
 {
@@ -208,7 +205,7 @@ void Graphics::CreateInstance( const std::vector<const char*>& extensions, const
   info.setEnabledExtensionCount(U32(extensions.size()))
       .setPpEnabledExtensionNames(extensions.data())
       .setEnabledLayerCount(U32(validationLayers.size()))
-      .setEnabledLayerCount(0)
+      //.setEnabledLayerCount(0)
       .setPpEnabledLayerNames(validationLayers.data());
 
   mInstance = VkAssert(vk::createInstance(info, *mAllocator));
@@ -257,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
@@ -271,7 +265,6 @@ void Graphics::GetPhysicalDeviceProperties()
   mPhysicalDeviceFeatures =
     MakeUnique<vk::PhysicalDeviceFeatures>(mPhysicalDevice.getFeatures());
 }
-#pragma GCC diagnostic pop
 
 void Graphics::GetQueueFamilyProperties()
 {
@@ -335,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
@@ -416,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();
@@ -481,7 +469,6 @@ void Graphics::CreateDevice()
 
   mPipelineDatabase = std::make_unique<PipelineCache>( *this );
 }
-#pragma GCC diagnostic pop
 
 vk::Device Graphics::GetDevice() const
 {
index c39bfd6..9882250 100644 (file)
@@ -68,7 +68,7 @@ class Graphics
 
 public:
   Graphics();
-  Graphics(std::unique_ptr< SurfaceFactory > surfaceFactory);
+  explicit Graphics(std::unique_ptr< SurfaceFactory > surfaceFactory);
   Graphics(const Graphics&) = delete;
   Graphics& operator=(const Graphics&) = delete;
   ~Graphics();
index 35dcc06..a7fa5de 100644 (file)
@@ -151,8 +151,6 @@ struct Swapchain::Impl
     return true;
   }
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wframe-larger-than="
   void PrepareFramebuffers()
   {
     /*
@@ -366,8 +364,6 @@ struct Swapchain::Impl
    * @param image
    * @return
    */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wframe-larger-than="
   FramebufferRef CreateFramebuffer( vk::Image& image )
   {
     auto fbRef = Framebuffer::New( mGraphics, mSwapchainExtent.width, mSwapchainExtent.height );
@@ -396,15 +392,13 @@ struct Swapchain::Impl
 
     return fbRef;
   }
-#pragma GCC diagnostic pop
 
   /**
    * This function acquires next framebuffer
    * @todo we should rather use roundrobin method
    * @return
    */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wframe-larger-than="
+
   FramebufferRef AcquireNextFramebuffer()
   {
     const auto& device    = mGraphics.GetDevice();