#define TEST_GRAPHICS_CONTROLLER_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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/graphics-api/graphics-controller.h>
#include "test-gl-abstraction.h"
#include "test-gl-context-helper-abstraction.h"
-#include "test-gl-sync-abstraction.h"
+#include "test-graphics-command-buffer.h"
#include "test-graphics-program.h"
#include "test-graphics-reflection.h"
+#include "test-graphics-sync-impl.h"
namespace Dali
{
std::ostream& operator<<(std::ostream& o, Graphics::SamplerMipmapMode mipmapMode);
std::ostream& operator<<(std::ostream& o, const Graphics::SamplerCreateInfo& createInfo);
+template<typename T>
+T* Uncast(const Graphics::CommandBuffer* object)
+{
+ return const_cast<T*>(static_cast<const T*>(object));
+}
+
+template<typename T>
+T* Uncast(const Graphics::Texture* object)
+{
+ return const_cast<T*>(static_cast<const T*>(object));
+}
+
+template<typename T>
+T* Uncast(const Graphics::Sampler* object)
+{
+ return const_cast<T*>(static_cast<const T*>(object));
+}
+
+template<typename T>
+T* Uncast(const Graphics::Buffer* object)
+{
+ return const_cast<T*>(static_cast<const T*>(object));
+}
+
+template<typename T>
+T* Uncast(const Graphics::Shader* object)
+{
+ return const_cast<T*>(static_cast<const T*>(object));
+}
+
+template<typename T>
+T* Uncast(const Graphics::Framebuffer* object)
+{
+ return const_cast<T*>(static_cast<const T*>(object));
+}
+
+template<typename T>
+T* Uncast(const Graphics::Pipeline* object)
+{
+ return const_cast<T*>(static_cast<const T*>(object));
+}
+
+template<typename T>
+T* Uncast(const Graphics::RenderTarget* object)
+{
+ return const_cast<T*>(static_cast<const T*>(object));
+}
+
+template<typename T>
+T* Uncast(const Graphics::SyncObject* object)
+{
+ return const_cast<T*>(static_cast<const T*>(object));
+}
+
class TestGraphicsController : public Dali::Graphics::Controller
{
public:
return mGl;
}
- Integration::GlSyncAbstraction& GetGlSyncAbstraction() override
+ Integration::GlContextHelperAbstraction& GetGlContextHelperAbstraction() override
{
- return mGlSyncAbstraction;
+ return mGlContextHelperAbstraction;
}
- Integration::GlContextHelperAbstraction& GetGlContextHelperAbstraction() override
+ TestGraphicsSyncImplementation& GetGraphicsSyncImpl()
{
- return mGlContextHelperAbstraction;
+ return mGraphicsSyncImpl;
}
void SubmitCommandBuffers(const Graphics::SubmitInfo& submitInfo) override;
void Resume() override;
/**
+ * @brief Lifecycle shutdown event
+ */
+ void Shutdown() override;
+
+ /**
+ * @brief Lifecycle destroy event
+ */
+ void Destroy() override;
+
+ /**
* @brief Executes batch update of textures
*
* This function may perform full or partial update of many textures.
const std::vector<Graphics::TextureUpdateSourceInfo>& sourceList) override;
/**
+ * Auto generates mipmaps for the texture
+ * @param[in] texture The texture
+ */
+ void GenerateTextureMipmaps(const Graphics::Texture& texture) override;
+
+ /**
* TBD: do we need those functions in the new implementation?
*/
bool EnableDepthStencilBuffer(bool enableDepth, bool enableStencil) override;
Graphics::UniquePtr<Graphics::RenderTarget> CreateRenderTarget(const Graphics::RenderTargetCreateInfo& renderTargetCreateInfo, Graphics::UniquePtr<Graphics::RenderTarget>&& oldRenderTarget) override;
/**
+ * @brief Creates new sync object
+ * Could add timeout etc to createinfo... but nah.
+ *
+ * @return pointer to the SyncObject
+ */
+ Graphics::UniquePtr<Graphics::SyncObject> CreateSyncObject(const Graphics::SyncObjectCreateInfo& syncObjectCreateInfo,
+ Graphics::UniquePtr<Graphics::SyncObject>&& oldSyncObject) override;
+
+ /**
* @brief Maps memory associated with Buffer object
*
* @param[in] mapInfo Filled details of mapped resource
*
- * @return Returns pointer to Memory object or Graphicsnullptr on error
+ * @return Returns pointer to Memory object or nullptr on error
*/
Graphics::UniquePtr<Graphics::Memory> MapBufferRange(const Graphics::MapBufferInfo& mapInfo) override;
*
* @return Returns the TextureProperties object
*/
- const Graphics::TextureProperties& GetTextureProperties(const Graphics::Texture& texture) override;
+ Graphics::TextureProperties GetTextureProperties(const Graphics::Texture& texture) override;
/**
* @brief Returns the reflection of the given program
*/
bool GetProgramParameter(Graphics::Program& program, uint32_t parameterId, void* outData) override;
+ void ProcessCommandBuffer(TestGraphicsCommandBuffer& commandBuffer);
+
+ void BindPipeline(TestGraphicsPipeline* pipeline);
+
public:
mutable TraceCallStack mCallStack;
mutable TraceCallStack mCommandBufferCallStack;
+ mutable TraceCallStack mFrameBufferCallStack;
mutable std::vector<Graphics::SubmitInfo> mSubmitStack;
TestGlAbstraction mGl;
- TestGlSyncAbstraction mGlSyncAbstraction;
+ TestGraphicsSyncImplementation mGraphicsSyncImpl;
TestGlContextHelperAbstraction mGlContextHelperAbstraction;
bool isDiscardQueueEmptyResult{true};
struct ProgramCache
{
std::map<Graphics::PipelineStage, std::vector<uint8_t>> shaders;
- TestGraphicsProgramImpl* programImpl;
+ TestGraphicsProgramImpl* programImpl;
};
std::vector<ProgramCache> mProgramCache;
+ struct PipelineCache
+ {
+ };
+
std::vector<UniformData> mCustomUniforms;
};