Cleaned up some of the circular dependency between GLES::Context & GLES::GraphicsCont...
[platform/core/uifw/dali-adaptor.git] / dali / internal / graphics / gles-impl / gles-context.h
index 12e62cd..f4cde6d 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_GRAPHICS_GLES_CONTEXT_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -31,6 +31,7 @@ class Pipeline;
 class RenderPass;
 class RenderTarget;
 class Texture;
+class TextureDependencyChecker;
 
 /**
  * @brief Context represents single GLES context
@@ -38,7 +39,7 @@ class Texture;
 class Context
 {
 public:
-  explicit Context(EglGraphicsController& controller);
+  explicit Context(EglGraphicsController& controller, Integration::GlAbstraction* glAbstraction);
 
   ~Context();
 
@@ -46,11 +47,14 @@ public:
    * @brief Flushes the context
    *
    * Flushes the context by issuing GL calls to set the required
-   * state.
+   * state. Causes a glWaitSync if any drawn textures are dependent
+   * on another context.
    *
    * @param[in] reset If true then state is reset unconditionally
+   * @param[in] drawCall the draws that need flushing
+   * @param[in] dependencyChecker The texture dependecy checker
    */
-  void Flush(bool reset, const GLES::DrawCallDescriptor& drawCall);
+  void Flush(bool reset, const GLES::DrawCallDescriptor& drawCall, GLES::TextureDependencyChecker& dependencyChecker);
 
   /**
    * @brief Returns context Id
@@ -125,10 +129,14 @@ public:
   void ResolveStandaloneUniforms();
 
   /**
-   * @brief Begins render pass for sepcified render target
+   * @brief Resolves GPU-based uniform buffers
+   */
+  void ResolveGpuUniformBuffers();
+
+  /**
+   * @brief Begins render pass for specified render target
    *
    * @param[in] renderPass render pass object to begin
-   * @param[in] renderTarget render target to be drawn onto
    */
   void BeginRenderPass(const BeginRenderPassDescriptor& renderPassBegin);
 
@@ -136,9 +144,9 @@ public:
    * @brief Ends render pass
    *
    * Ending render pass is necessary in order to ensure
-   * proper implicit synchronization is in place
+   * proper explicit synchronization is in place
    */
-  void EndRenderPass();
+  void EndRenderPass(TextureDependencyChecker& checker);
 
   /**
    * @brief Returns the cache of GL state in the context
@@ -186,7 +194,13 @@ public:
   void ActiveTexture(uint32_t textureBindingIndex);
   void BindTexture(GLenum target, BoundTextureType textureTypeId, uint32_t textureId);
   void GenerateMipmap(GLenum target);
-  void BindBuffer(GLenum target, uint32_t bufferId);
+
+  /**
+   * Binds the buffer.
+   * @return true if the buffer was actually bound, false if it's cached
+   */
+  bool BindBuffer(GLenum target, uint32_t bufferId);
+
   void DrawBuffers(uint32_t count, const GLenum* buffers);
   void BindFrameBuffer(GLenum target, uint32_t bufferId);
   void GenFramebuffers(uint32_t count, uint32_t* framebuffers);