#define DALI_EGL_GRAPHICS_CONTROLLER_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
#include <dali/internal/graphics/gles-impl/gles-graphics-shader.h>
#include <dali/internal/graphics/gles-impl/gles-graphics-texture.h>
#include <dali/internal/graphics/gles-impl/gles-graphics-types.h>
+#include <dali/internal/graphics/gles-impl/gles-sync-pool.h>
+#include <dali/internal/graphics/gles-impl/gles-texture-dependency-checker.h>
#include <dali/internal/graphics/gles-impl/gles2-graphics-memory.h>
namespace Dali
{
class CommandBuffer;
class PipelineCache;
+class SyncPool;
+class TextureDependencyChecker;
} // namespace GLES
/**
{
public:
/**
- * @brief Deault constructor
+ * @brief Constructor
*/
- EglGraphicsController() = default;
+ EglGraphicsController();
/**
* @brief Destructor
Internal::Adaptor::EglSyncImplementation& GetEglSyncImplementation();
/**
+ * Mark the start of the frame.
+ *
+ * Note, this is used for logging & debugging, so is not part of the main Graphics API.
+ */
+ void FrameStart();
+
+ /**
* @copydoc Dali::Graphics::SubmitCommandBuffers()
*/
void SubmitCommandBuffers(const SubmitInfo& submitInfo) override;
/**
* @copydoc Dali::Graphics::WaitIdle()
*/
- void WaitIdle() override
- {
- }
+ void WaitIdle() override;
/**
* @copydoc Dali::Graphics::Pause()
void Shutdown() override
{
mIsShuttingDown = true;
- }
- /**
- * @copydoc Dali::Graphics::Destroy()
- */
- void Destroy() override
- {
// Final flush
Flush();
}
/**
+ * @copydoc Dali::Graphics::Destroy()
+ */
+ void Destroy() override
+ {
+ }
+
+ /**
* @copydoc Dali::Graphics::UpdateTextures()
*/
void UpdateTextures(const std::vector<TextureUpdateInfo>& updateInfoList,
/**
* @copydoc Dali::Graphics::GetTextureProperties()
*/
- const TextureProperties& GetTextureProperties(const Texture& texture) override
- {
- // for compiler not to moan
- static TextureProperties dummy{};
- return dummy;
- }
+ TextureProperties GetTextureProperties(const Texture& texture) override;
/**
* @copydoc Dali::Graphics::Controller::GetPipelineReflection()
*/
-
[[nodiscard]] const Reflection& GetProgramReflection(const Graphics::Program& program) override;
/**
}
/**
+ * @brief Pushes RenderPass to the discard queue
+ *
+ * Function is called from the UniquePtr custom deleter.
+ *
+ * @param[in] program Pointer to the RenderPass
+ */
+ void DiscardResource(GLES::RenderPass* renderPass)
+ {
+ mDiscardRenderPassQueue.push(renderPass);
+ }
+
+ /**
+ * @brief Pushes RenderTarget to the discard queue
+ *
+ * Function is called from the UniquePtr custom deleter.
+ *
+ * @param[in] program Pointer to the RenderTarget
+ */
+ void DiscardResource(GLES::RenderTarget* renderTarget)
+ {
+ mDiscardRenderTargetQueue.push(renderTarget);
+ }
+
+ /**
* @brief Pushes Shader to the discard queue
*
* Function is called from the UniquePtr custom deleter.
void ResolvePresentRenderTarget(GLES::RenderTarget* renderTarget);
/**
+ * Invoked after all rendering has finished. Used to clean up sync resources
+ */
+ void PostRender();
+
+ /**
* Creates a GLES context for the given render surface
*
* @param[in] surface The surface whose GLES context to be created.
return mCurrentContext;
}
+ /**
+ * @brief Returns EGL shared context
+ *
+ * @return valid EGL shared context
+ */
+ void* GetSharedContext() const
+ {
+ return mSharedContext;
+ }
+
+ GLES::SyncPool& GetSyncPool()
+ {
+ return mSyncPool;
+ }
+
+ std::size_t GetCapacity() const
+ {
+ return mCapacity;
+ }
+
private:
Integration::GlAbstraction* mGlAbstraction{nullptr};
Integration::GlContextHelperAbstraction* mGlContextHelperAbstraction{nullptr};
std::queue<GLES::Program*> mDiscardProgramQueue; ///< Discard queue for program resource
std::queue<GLES::Pipeline*> mDiscardPipelineQueue; ///< Discard queue of pipelines
+ std::queue<GLES::RenderPass*> mDiscardRenderPassQueue; ///< Discard queue for renderpass resource
+ std::queue<GLES::RenderTarget*> mDiscardRenderTargetQueue; ///< Discard queue for rendertarget resource
std::queue<GLES::Shader*> mDiscardShaderQueue; ///< Discard queue of shaders
std::queue<GLES::Sampler*> mDiscardSamplerQueue; ///< Discard queue of samplers
std::queue<const GLES::CommandBuffer*> mDiscardCommandBufferQueue; ///< Discard queue of command buffers
bool mIsShuttingDown{false}; ///< Indicates whether the controller is shutting down
std::queue<const GLES::CommandBuffer*> mPresentationCommandBuffers{}; ///< Queue of reusable command buffers used by presentation engine
+
+ void* mSharedContext{nullptr}; ///< Shared EGL context
+
+ GLES::TextureDependencyChecker mTextureDependencyChecker; // Checks if FBO textures need syncing
+ GLES::SyncPool mSyncPool;
+ std::size_t mCapacity{0u}; ///< Memory Usage (of command buffers)
};
} // namespace Graphics
} // namespace Dali
-#endif //DALI_EGL_GRAPHICS_CONTROLLER_H
+#endif // DALI_EGL_GRAPHICS_CONTROLLER_H