X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftest-graphics-controller.h;h=1c62119ae979ae49ce07f51b39cc1e75296dcde8;hp=e39c1a5c7910675516c78c4dead51dc3f6d87d00;hb=68d3700c2fe64a0f09c654840672f6d93ae8f35f;hpb=6097ddb9d7420625872d371cd5f44939d5240be8 diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.h index e39c1a5..1c62119 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.h @@ -21,6 +21,9 @@ #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" namespace Dali { @@ -34,6 +37,54 @@ std::ostream& operator<<(std::ostream& o, Graphics::SamplerFilter filterMode); std::ostream& operator<<(std::ostream& o, Graphics::SamplerMipmapMode mipmapMode); std::ostream& operator<<(std::ostream& o, const Graphics::SamplerCreateInfo& createInfo); +template +T* Uncast(const Graphics::CommandBuffer* object) +{ + return const_cast(static_cast(object)); +} + +template +T* Uncast(const Graphics::Texture* object) +{ + return const_cast(static_cast(object)); +} + +template +T* Uncast(const Graphics::Sampler* object) +{ + return const_cast(static_cast(object)); +} + +template +T* Uncast(const Graphics::Buffer* object) +{ + return const_cast(static_cast(object)); +} + +template +T* Uncast(const Graphics::Shader* object) +{ + return const_cast(static_cast(object)); +} + +template +T* Uncast(const Graphics::Framebuffer* object) +{ + return const_cast(static_cast(object)); +} + +template +T* Uncast(const Graphics::Pipeline* object) +{ + return const_cast(static_cast(object)); +} + +template +T* Uncast(const Graphics::RenderTarget* object) +{ + return const_cast(static_cast(object)); +} + class TestGraphicsController : public Dali::Graphics::Controller { public: @@ -85,6 +136,16 @@ public: 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. @@ -101,6 +162,12 @@ public: const std::vector& 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; @@ -175,6 +242,14 @@ public: Graphics::UniquePtr CreatePipeline(const Graphics::PipelineCreateInfo& pipelineCreateInfo, Graphics::UniquePtr&& oldPipeline) override; /** + * @brief Creates new Program object + * + * @param[in] programCreateInfo The valid ProgramCreateInfo structure + * @return pointer to the Program object + */ + Graphics::UniquePtr CreateProgram(const Graphics::ProgramCreateInfo& programCreateInfo, Graphics::UniquePtr&& oldProgram) override; + + /** * @brief Creates new Shader object * * @param[in] shaderCreateInfo The valid ShaderCreateInfo structure @@ -267,6 +342,14 @@ public: const Graphics::TextureProperties& GetTextureProperties(const Graphics::Texture& texture) override; /** + * @brief Returns the reflection of the given program + * + * @param[in] program The program + * @return The reflection of the program + */ + const Graphics::Reflection& GetProgramReflection(const Graphics::Program& program) override; + + /** * @brief Tests whether two Pipelines are the same. * * On the higher level, this function may help wit creating pipeline cache. @@ -275,9 +358,43 @@ public: */ bool PipelineEquals(const Graphics::Pipeline& pipeline0, const Graphics::Pipeline& pipeline1) const override; +public: // Test Functions + void SetVertexFormats(Property::Array& vfs) + { + mVertexFormats = vfs; + } + + void AddCustomUniforms(std::vector& customUniforms) + { + mCustomUniforms = customUniforms; + } + + void ClearSubmitStack() + { + mSubmitStack.clear(); + } + + /** + * @brief Retrieves program parameters + * + * This function can be used to retrieve data from internal implementation + * + * @param[in] program Valid program object + * @param[in] parameterId Integer parameter id + * @param[out] outData Pointer to output memory + * @return True on success + */ + 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 mCallStack; + mutable TraceCallStack mCommandBufferCallStack; + mutable TraceCallStack mFrameBufferCallStack; + mutable std::vector mSubmitStack; TestGlAbstraction mGl; TestGlSyncAbstraction mGlSyncAbstraction; @@ -285,6 +402,21 @@ public: bool isDiscardQueueEmptyResult{true}; bool isDrawOnResumeRequiredResult{true}; + + Property::Array mVertexFormats; + + struct ProgramCache + { + std::map> shaders; + TestGraphicsProgramImpl* programImpl; + }; + std::vector mProgramCache; + + struct PipelineCache + { + }; + + std::vector mCustomUniforms; }; } // namespace Dali