Removing GL usage from dali core 01/260001/1
authorDavid Steele <david.steele@samsung.com>
Thu, 17 Jun 2021 09:48:28 +0000 (10:48 +0100)
committerDavid Steele <david.steele@samsung.com>
Thu, 17 Jun 2021 09:48:28 +0000 (10:48 +0100)
Removed texture dependency syncing from render manager
(Not used/useful, needs to be re-implemented in graphics impl
differently)

Removed usages of glconfighelper, removed references to GL, GL defines
and GL types.

Cleaned up includes.

Change-Id: I85b76d2c1714e7993ec13b558a3c971c7b5f2a68
Signed-off-by: David Steele <david.steele@samsung.com>
12 files changed:
dali/internal/render/common/render-manager.cpp
dali/internal/render/common/render-manager.h
dali/internal/render/common/render-tracker.h
dali/internal/render/renderers/render-frame-buffer.h
dali/internal/render/renderers/render-geometry.cpp
dali/internal/render/renderers/render-geometry.h
dali/internal/render/renderers/render-renderer.cpp
dali/internal/render/renderers/render-renderer.h
dali/internal/render/renderers/render-texture.h
dali/internal/render/shaders/program-cache.h
dali/internal/render/shaders/program-controller.cpp
dali/internal/render/shaders/program.cpp

index 9263260..56495cc 100644 (file)
@@ -24,7 +24,6 @@
 // INTERNAL INCLUDES
 #include <dali/devel-api/threading/thread-pool.h>
 #include <dali/integration-api/core.h>
-#include <dali/integration-api/gl-context-helper-abstraction.h>
 
 #include <dali/internal/event/common/scene-impl.h>
 
@@ -136,7 +135,7 @@ struct RenderManager::Impl
 
   OwnerContainer<Render::RenderTracker*> mRenderTrackers; ///< List of render trackers
 
-  ProgramController   programController; ///< Owner of the GL programs
+  ProgramController   programController; ///< Owner of the programs
   Render::ShaderCache shaderCache;       ///< The cache for the graphics shaders
 
   std::unique_ptr<Render::UniformBufferManager> uniformBufferManager; ///< The uniform buffer manager
@@ -819,7 +818,7 @@ void RenderManager::RenderScene(Integration::RenderStatus& status, Integration::
       // Offscreen buffer rendering
       if(instruction.mIsViewportSet)
       {
-        // For glViewport the lower-left corner is (0,0)
+        // For Viewport the lower-left corner is (0,0)
         const int32_t y = (instruction.mFrameBuffer->GetHeight() - instruction.mViewport.height) - instruction.mViewport.y;
         viewportRect.Set(instruction.mViewport.x, y, instruction.mViewport.width, instruction.mViewport.height);
       }
@@ -834,7 +833,7 @@ void RenderManager::RenderScene(Integration::RenderStatus& status, Integration::
       // Check whether a viewport is specified, otherwise the full surface size is used
       if(instruction.mIsViewportSet)
       {
-        // For glViewport the lower-left corner is (0,0)
+        // For Viewport the lower-left corner is (0,0)
         const int32_t y = (surfaceRect.height - instruction.mViewport.height) - instruction.mViewport.y;
         viewportRect.Set(instruction.mViewport.x, y, instruction.mViewport.width, instruction.mViewport.height);
       }
@@ -903,57 +902,6 @@ void RenderManager::RenderScene(Integration::RenderStatus& status, Integration::
       clippingRect,
       surfaceOrientation);
 
-    // Synchronise the FBO/Texture access
-
-    // Check whether any bound texture is in the dependency list
-    bool textureFound = false;
-
-    if(mImpl->boundTextures.Count() > 0u && mImpl->textureDependencyList.Count() > 0u)
-    {
-      for(auto texture : mImpl->textureDependencyList)
-      {
-        textureFound = std::find_if(mImpl->boundTextures.Begin(), mImpl->boundTextures.End(), [texture](Graphics::Texture* graphicsTexture) {
-                         return texture == graphicsTexture;
-                       }) != mImpl->boundTextures.End();
-      }
-    }
-
-    if(textureFound)
-    {
-      if(instruction.mFrameBuffer)
-      {
-        // For off-screen buffer
-
-        // Clear the dependency list
-        mImpl->textureDependencyList.Clear();
-      }
-      else
-      {
-        // Worker thread lambda function
-        auto& glContextHelperAbstraction = mImpl->graphicsController.GetGlContextHelperAbstraction();
-        auto  workerFunction             = [&glContextHelperAbstraction](int workerThread) {
-          // Switch to the shared context in the worker thread
-          glContextHelperAbstraction.MakeSurfacelessContextCurrent();
-
-          // Wait until all rendering calls for the shared context are executed
-          glContextHelperAbstraction.WaitClient();
-
-          // Must clear the context in the worker thread
-          // Otherwise the shared context cannot be switched to from the render thread
-          glContextHelperAbstraction.MakeContextNull();
-        };
-
-        auto future = mImpl->threadPool->SubmitTask(0u, workerFunction);
-        if(future)
-        {
-          mImpl->threadPool->Wait();
-
-          // Clear the dependency list
-          mImpl->textureDependencyList.Clear();
-        }
-      }
-    }
-
     Graphics::SyncObject* syncObject{nullptr};
     // If the render instruction has an associated render tracker (owned separately)
     // and framebuffer, create a one shot sync object, and use it to determine when
index 4af1b8b..8b96203 100644 (file)
@@ -30,8 +30,6 @@ namespace Dali
 {
 namespace Integration
 {
-class GlAbstraction;
-class GlContextHelperAbstraction;
 class RenderStatus;
 class Scene;
 } // namespace Integration
index 818b56a..3f3a098 100644 (file)
@@ -52,8 +52,8 @@ public:
   Graphics::SyncObject* CreateSyncObject(Graphics::Controller& graphicsController);
 
   /**
-   * Check the GL Sync objects. This is called from Render Thread.
-   * If the GlSyncObject has been triggered, then atomically set the sync trigger
+   * Check the Sync objects. This is called from Render Thread.
+   * If the SyncObject has been triggered, then atomically set the sync trigger
    */
   void PollSyncObject();
 
index 89efc3f..01ce5c2 100644 (file)
@@ -19,7 +19,6 @@
 
 // INTERNAL INCLUDES
 #include <dali/devel-api/rendering/frame-buffer-devel.h>
-#include <dali/integration-api/gl-defines.h>
 #include <dali/internal/render/renderers/render-sampler.h>
 #include <dali/public-api/rendering/frame-buffer.h>
 
index cd6f8f6..1ccd49a 100644 (file)
@@ -159,7 +159,7 @@ bool Geometry::Draw(
     if(elementBufferOffset != 0u)
     {
       elementBufferOffset = (elementBufferOffset >= numIndices) ? numIndices - 1 : elementBufferOffset;
-      firstIndexOffset    = elementBufferOffset * sizeof(GLushort);
+      firstIndexOffset    = elementBufferOffset * sizeof(uint16_t);
       numIndices -= elementBufferOffset;
     }
 
@@ -184,11 +184,11 @@ bool Geometry::Draw(
   else
   {
     // Un-indexed draw call
-    GLsizei numVertices(0u);
+    uint32_t numVertices(0u);
     if(vertexBufferCount > 0)
     {
       // truncated, no value loss happening in practice
-      numVertices = static_cast<GLsizei>(mVertexBuffers[0]->GetElementCount());
+      numVertices = static_cast<uint32_t>(mVertexBuffers[0]->GetElementCount());
     }
 
     commandBuffer.Draw(numVertices, 1, 0, 0);
index 429ec1f..1de282f 100644 (file)
@@ -20,8 +20,6 @@
 // INTERNAL INCLUDES
 #include <dali/devel-api/common/owner-container.h>
 #include <dali/graphics-api/graphics-controller.h>
-#include <dali/integration-api/gl-abstraction.h>
-#include <dali/integration-api/gl-defines.h>
 #include <dali/internal/common/buffer-index.h>
 #include <dali/internal/common/owner-pointer.h>
 #include <dali/public-api/common/dali-vector.h>
index 711eef5..18be7c1 100644 (file)
 #include <dali/internal/render/renderers/render-texture.h>
 #include <dali/internal/render/renderers/render-vertex-buffer.h>
 #include <dali/internal/render/renderers/shader-cache.h>
+#include <dali/internal/render/renderers/uniform-buffer-view-pool.h>
+#include <dali/internal/render/renderers/uniform-buffer-view.h>
 #include <dali/internal/render/shaders/program.h>
 #include <dali/internal/render/shaders/render-shader.h>
 #include <dali/internal/update/common/uniform-map.h>
-#include <dali/internal/render/renderers/uniform-buffer-view.h>
-#include <dali/internal/render/renderers/uniform-buffer-view-pool.h>
 
 namespace Dali::Internal
 {
@@ -675,12 +675,12 @@ void Renderer::WriteUniformBuffer(
   }
 
   // Create uniform buffer view from uniform buffer
-  Graphics::UniquePtr<Render::UniformBufferView> uboView {nullptr};
+  Graphics::UniquePtr<Render::UniformBufferView> uboView{nullptr};
   if(uniformBlockAllocationBytes)
   {
-    auto uboPoolView = mUniformBufferManager->GetUniformBufferViewPool( bufferIndex );
+    auto uboPoolView = mUniformBufferManager->GetUniformBufferViewPool(bufferIndex);
 
-    uboView = uboPoolView->CreateUniformBufferView( uniformBlockAllocationBytes );
+    uboView = uboPoolView->CreateUniformBufferView(uniformBlockAllocationBytes);
   }
 
   // update the uniform buffer
@@ -693,7 +693,7 @@ void Renderer::WriteUniformBuffer(
 
     std::vector<Graphics::UniformBufferBinding>* bindings{&mUniformBufferBindings};
 
-    mUniformBufferBindings[0].buffer = uboView->GetBuffer( &mUniformBufferBindings[0].offset );
+    mUniformBufferBindings[0].buffer = uboView->GetBuffer(&mUniformBufferBindings[0].offset);
 
     // Write default uniforms
     WriteDefaultUniform(program->GetDefaultUniform(Program::DefaultUniformIndex::MODEL_MATRIX), *uboView, *bindings, modelMatrix);
@@ -781,7 +781,7 @@ void Renderer::FillUniformBuffer(Program&                                      p
     mUniformBufferBindings[i].binding  = reflection.GetUniformBlockBinding(i);
 
     dataOffset += GetUniformBufferDataAlignment(mUniformBufferBindings[i].dataSize);
-    mUniformBufferBindings[i].buffer = ubo.GetBuffer( &mUniformBufferBindings[i].offset );
+    mUniformBufferBindings[i].buffer = ubo.GetBuffer(&mUniformBufferBindings[i].offset);
 
     for(UniformIndexMappings::Iterator iter = mUniformIndexMap.Begin(),
                                        end  = mUniformIndexMap.End();
@@ -853,7 +853,9 @@ void Renderer::FillUniformBuffer(Program&                                      p
           }
           case Property::Type::MATRIX3:
           {
-            // todo: handle data padding properly
+            // @todo: handle data padding properly
+            // Get padding requirement from Graphics
+            //
             // Vulkan:
             //
             //const auto& matrix = &(*iter).propertyValue->GetMatrix3(updateBufferIndex);
@@ -1135,4 +1137,4 @@ Graphics::Pipeline& Renderer::PrepareGraphicsPipeline(
 
 } // namespace Render
 
-} // namespace Dali
+} // namespace Dali::Internal
index 205397b..7945389 100644 (file)
@@ -96,7 +96,7 @@ public:
    * @param[in] dataProviders The data providers for the renderer
    * @param[in] geometry The geometry for the renderer
    * @param[in] blendingBitmask A bitmask of blending options.
-   * @param[in] blendColor The blend color to pass to GL
+   * @param[in] blendColor The blend color
    * @param[in] faceCullingMode The face-culling mode.
    * @param[in] preMultipliedAlphaEnabled whether alpha is pre-multiplied.
    * @param[in] depthWriteMode Depth buffer write mode
@@ -120,7 +120,7 @@ public:
    * @param[in] dataProviders The data providers for the renderer
    * @param[in] geometry The geometry for the renderer
    * @param[in] blendingBitmask A bitmask of blending options.
-   * @param[in] blendColor The blend color to pass to GL
+   * @param[in] blendColor The blend color
    * @param[in] faceCullingMode The face-culling mode.
    * @param[in] preMultipliedAlphaEnabled whether alpha is pre-multiplied.
    * @param[in] depthWriteMode Depth buffer write mode
@@ -188,7 +188,7 @@ public:
 
   /**
    * Set the blend color for blending options
-   * @param[in] blendColor The blend color to pass to GL
+   * @param[in] blendColor The blend color
    */
   void SetBlendColor(const Vector4& color);
 
@@ -400,17 +400,17 @@ public:
 
   template<class T>
   bool WriteDefaultUniform(const Graphics::UniformInfo*                       uniformInfo,
-                           Render::UniformBufferView&                             ubo,
+                           Render::UniformBufferView&                         ubo,
                            const std::vector<Graphics::UniformBufferBinding>& bindings,
                            const T&                                           data);
 
   template<class T>
-  void WriteUniform(Render::UniformBufferView&                             ubo,
+  void WriteUniform(Render::UniformBufferView&                         ubo,
                     const std::vector<Graphics::UniformBufferBinding>& bindings,
                     const Graphics::UniformInfo&                       uniformInfo,
                     const T&                                           data);
 
-  void WriteUniform(Render::UniformBufferView&                             ubo,
+  void WriteUniform(Render::UniformBufferView&                         ubo,
                     const std::vector<Graphics::UniformBufferBinding>& bindings,
                     const Graphics::UniformInfo&                       uniformInfo,
                     const void*                                        data,
@@ -490,7 +490,7 @@ private:
    */
   void FillUniformBuffer(Program&                                      program,
                          const SceneGraph::RenderInstruction&          instruction,
-                         Render::UniformBufferView&                        ubo,
+                         Render::UniformBufferView&                    ubo,
                          std::vector<Graphics::UniformBufferBinding>*& outBindings,
                          uint32_t&                                     offset,
                          BufferIndex                                   updateBufferIndex);
index 5d9704b..d9223b8 100644 (file)
@@ -30,7 +30,6 @@
 #include <dali/graphics-api/graphics-texture-create-info.h>
 #include <dali/graphics-api/graphics-texture.h>
 #include <dali/graphics-api/graphics-types.h>
-#include <dali/integration-api/gl-defines.h>
 #include <dali/internal/event/rendering/texture-impl.h>
 #include <dali/internal/render/renderers/render-sampler.h>
 
index 01c0bae..b529e53 100644 (file)
@@ -19,7 +19,6 @@
  */
 
 // INTERNAL INCLUDES
-#include <dali/integration-api/gl-abstraction.h> // for GLenum
 #include <dali/internal/common/shader-data.h>
 
 namespace Dali
index 41f77f5..f72f937 100644 (file)
@@ -19,7 +19,6 @@
 #include <dali/internal/render/shaders/program-controller.h>
 
 // INTERNAL INCLUDES
-#include <dali/integration-api/gl-defines.h>
 #include <dali/internal/common/shader-saver.h>
 #include <dali/internal/render/shaders/program.h>
 
index 8a9d1c5..db7c711 100644 (file)
@@ -28,7 +28,6 @@
 #include <dali/graphics-api/graphics-program.h>
 #include <dali/graphics-api/graphics-reflection.h>
 #include <dali/integration-api/debug.h>
-#include <dali/integration-api/gl-defines.h>
 #include <dali/internal/common/shader-data.h>
 #include <dali/internal/render/common/performance-monitor.h>
 #include <dali/internal/render/shaders/program-cache.h>