Shaders, Pipeline, Program test harness update 41/254341/2
authorAdam Bialogonski <adam.b@samsung.com>
Fri, 26 Feb 2021 16:29:57 +0000 (16:29 +0000)
committeradam.b <adam.b@samsung.com>
Fri, 26 Feb 2021 22:19:27 +0000 (22:19 +0000)
Change-Id: Id5fadf14b543fe09d9e175e8660c7b2192a1f597

16 files changed:
automated-tests/src/dali-scene-loader-internal/CMakeLists.txt
automated-tests/src/dali-scene-loader/CMakeLists.txt
automated-tests/src/dali-toolkit-internal/CMakeLists.txt
automated-tests/src/dali-toolkit-styling/CMakeLists.txt
automated-tests/src/dali-toolkit-third-party/CMakeLists.txt
automated-tests/src/dali-toolkit/CMakeLists.txt
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-pipeline.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-pipeline.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-program.cpp [new file with mode: 0644]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-program.h [new file with mode: 0644]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-reflection.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-reflection.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-shader.cpp [new file with mode: 0644]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-shader.h [new file with mode: 0644]

index 539bcd4..16f96f0 100755 (executable)
@@ -49,6 +49,8 @@ SET(TEST_HARNESS_SOURCES
   ${TEST_HARNESS_DIR}/test-graphics-texture.cpp
   ${TEST_HARNESS_DIR}/test-graphics-sampler.cpp
   ${TEST_HARNESS_DIR}/test-graphics-pipeline.cpp
   ${TEST_HARNESS_DIR}/test-graphics-texture.cpp
   ${TEST_HARNESS_DIR}/test-graphics-sampler.cpp
   ${TEST_HARNESS_DIR}/test-graphics-pipeline.cpp
+  ${TEST_HARNESS_DIR}/test-graphics-program.cpp
+  ${TEST_HARNESS_DIR}/test-graphics-shader.cpp
   ${TEST_HARNESS_DIR}/test-graphics-reflection.cpp
   ${TEST_HARNESS_DIR}/test-platform-abstraction.cpp
   ${TEST_HARNESS_DIR}/test-render-controller.cpp
   ${TEST_HARNESS_DIR}/test-graphics-reflection.cpp
   ${TEST_HARNESS_DIR}/test-platform-abstraction.cpp
   ${TEST_HARNESS_DIR}/test-render-controller.cpp
index 6c44670..f0d84fb 100755 (executable)
@@ -62,7 +62,9 @@ SET(TEST_HARNESS_SOURCES
   ${TEST_HARNESS_DIR}/test-graphics-controller.cpp
   ${TEST_HARNESS_DIR}/test-graphics-texture.cpp
   ${TEST_HARNESS_DIR}/test-graphics-sampler.cpp
   ${TEST_HARNESS_DIR}/test-graphics-controller.cpp
   ${TEST_HARNESS_DIR}/test-graphics-texture.cpp
   ${TEST_HARNESS_DIR}/test-graphics-sampler.cpp
+  ${TEST_HARNESS_DIR}/test-graphics-program.cpp
   ${TEST_HARNESS_DIR}/test-graphics-pipeline.cpp
   ${TEST_HARNESS_DIR}/test-graphics-pipeline.cpp
+  ${TEST_HARNESS_DIR}/test-graphics-shader.cpp
   ${TEST_HARNESS_DIR}/test-graphics-reflection.cpp
   ${TEST_HARNESS_DIR}/test-platform-abstraction.cpp
   ${TEST_HARNESS_DIR}/test-render-controller.cpp
   ${TEST_HARNESS_DIR}/test-graphics-reflection.cpp
   ${TEST_HARNESS_DIR}/test-platform-abstraction.cpp
   ${TEST_HARNESS_DIR}/test-render-controller.cpp
index cd5e140..cc18fe6 100755 (executable)
@@ -84,9 +84,11 @@ SET(TEST_HARNESS_SOURCES
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-command-buffer.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-texture.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-command-buffer.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-texture.cpp
+   ../dali-toolkit/dali-toolkit-test-utils/test-graphics-program.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-pipeline.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-reflection.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-sampler.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-pipeline.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-reflection.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-sampler.cpp
+   ../dali-toolkit/dali-toolkit-test-utils/test-graphics-shader.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp
index ebbc8cb..cc1488e 100644 (file)
@@ -51,8 +51,10 @@ SET(TEST_HARNESS_SOURCES
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-texture.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-pipeline.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-texture.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-pipeline.cpp
-   ../dali-toolkit/dali-toolkit-test-utils/test-graphics-reflection.cpp
+   ../dali-toolkit/dali-toolkit-test-utils/test-graphics-program.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-sampler.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-sampler.cpp
+   ../dali-toolkit/dali-toolkit-test-utils/test-graphics-shader.cpp
+   ../dali-toolkit/dali-toolkit-test-utils/test-graphics-reflection.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-native-image.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-native-image.cpp
index e8fa652..820a4a5 100644 (file)
@@ -38,6 +38,8 @@ SET(TEST_HARNESS_SOURCES
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-texture.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-sampler.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-pipeline.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-texture.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-sampler.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-pipeline.cpp
+   ../dali-toolkit/dali-toolkit-test-utils/test-graphics-program.cpp
+   ../dali-toolkit/dali-toolkit-test-utils/test-graphics-shader.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-reflection.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-graphics-reflection.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp
index 6dddc1a..ee1ff65 100755 (executable)
@@ -115,8 +115,10 @@ SET(TEST_HARNESS_SOURCES
   dali-toolkit-test-utils/test-graphics-controller.cpp
   dali-toolkit-test-utils/test-graphics-texture.cpp
   dali-toolkit-test-utils/test-graphics-pipeline.cpp
   dali-toolkit-test-utils/test-graphics-controller.cpp
   dali-toolkit-test-utils/test-graphics-texture.cpp
   dali-toolkit-test-utils/test-graphics-pipeline.cpp
+  dali-toolkit-test-utils/test-graphics-program.cpp
   dali-toolkit-test-utils/test-graphics-reflection.cpp
   dali-toolkit-test-utils/test-graphics-sampler.cpp
   dali-toolkit-test-utils/test-graphics-reflection.cpp
   dali-toolkit-test-utils/test-graphics-sampler.cpp
+  dali-toolkit-test-utils/test-graphics-shader.cpp
   dali-toolkit-test-utils/test-platform-abstraction.cpp
   dali-toolkit-test-utils/test-render-controller.cpp
   dali-toolkit-test-utils/test-trace-call-stack.cpp
   dali-toolkit-test-utils/test-platform-abstraction.cpp
   dali-toolkit-test-utils/test-render-controller.cpp
   dali-toolkit-test-utils/test-trace-call-stack.cpp
index 41d13c9..220e5e5 100644 (file)
@@ -20,6 +20,8 @@
 #include "test-graphics-command-buffer.h"
 #include "test-graphics-reflection.h"
 #include "test-graphics-sampler.h"
 #include "test-graphics-command-buffer.h"
 #include "test-graphics-reflection.h"
 #include "test-graphics-sampler.h"
+#include "test-graphics-shader.h"
+#include "test-graphics-program.h"
 #include "test-graphics-texture.h"
 
 #include <dali/integration-api/gl-defines.h>
 #include "test-graphics-texture.h"
 
 #include <dali/integration-api/gl-defines.h>
@@ -444,7 +446,9 @@ void TestGraphicsController::SubmitCommandBuffers(const Graphics::SubmitInfo& su
   namedParams["submitInfo"] << "cmdBuffer[" << submitInfo.cmdBuffer.size()
                             << "], flags:" << std::hex << submitInfo.flags;
 
   namedParams["submitInfo"] << "cmdBuffer[" << submitInfo.cmdBuffer.size()
                             << "], flags:" << std::hex << submitInfo.flags;
 
-  mCallStack.PushCall("Controller::SubmitCommandBuffers", "", namedParams);
+  mCallStack.PushCall("SubmitCommandBuffers", "", namedParams);
+
+  mSubmitStack.emplace_back(submitInfo);
 
   for(auto& graphicsCommandBuffer : submitInfo.cmdBuffer)
   {
 
   for(auto& graphicsCommandBuffer : submitInfo.cmdBuffer)
   {
@@ -576,7 +580,7 @@ void TestGraphicsController::PresentRenderTarget(Graphics::RenderTarget* renderT
 {
   TraceCallStack::NamedParams namedParams;
   namedParams["renderTarget"] << std::hex << renderTarget;
 {
   TraceCallStack::NamedParams namedParams;
   namedParams["renderTarget"] << std::hex << renderTarget;
-  mCallStack.PushCall("Controller::PresentRenderTarget", "", namedParams);
+  mCallStack.PushCall("PresentRenderTarget", "", namedParams);
 }
 
 /**
 }
 
 /**
@@ -584,7 +588,7 @@ void TestGraphicsController::PresentRenderTarget(Graphics::RenderTarget* renderT
  */
 void TestGraphicsController::WaitIdle()
 {
  */
 void TestGraphicsController::WaitIdle()
 {
-  mCallStack.PushCall("Controller::WaitIdle", "");
+  mCallStack.PushCall("WaitIdle", "");
 }
 
 /**
 }
 
 /**
@@ -592,7 +596,7 @@ void TestGraphicsController::WaitIdle()
  */
 void TestGraphicsController::Pause()
 {
  */
 void TestGraphicsController::Pause()
 {
-  mCallStack.PushCall("Controller::Pause", "");
+  mCallStack.PushCall("Pause", "");
 }
 
 /**
 }
 
 /**
@@ -600,7 +604,7 @@ void TestGraphicsController::Pause()
  */
 void TestGraphicsController::Resume()
 {
  */
 void TestGraphicsController::Resume()
 {
-  mCallStack.PushCall("Controller::Resume", "");
+  mCallStack.PushCall("Resume", "");
 }
 
 void TestGraphicsController::UpdateTextures(const std::vector<Graphics::TextureUpdateInfo>&       updateInfoList,
 }
 
 void TestGraphicsController::UpdateTextures(const std::vector<Graphics::TextureUpdateInfo>&       updateInfoList,
@@ -610,7 +614,7 @@ void TestGraphicsController::UpdateTextures(const std::vector<Graphics::TextureU
   namedParams["updateInfoList"] << "[" << updateInfoList.size() << "]:";
   namedParams["sourceList"] << "[" << sourceList.size() << "]:";
 
   namedParams["updateInfoList"] << "[" << updateInfoList.size() << "]:";
   namedParams["sourceList"] << "[" << sourceList.size() << "]:";
 
-  mCallStack.PushCall("Controller::UpdateTextures", "", namedParams);
+  mCallStack.PushCall("UpdateTextures", "", namedParams);
 
   // Call either TexImage2D or TexSubImage2D
   for(unsigned int i = 0; i < updateInfoList.size(); ++i)
 
   // Call either TexImage2D or TexSubImage2D
   for(unsigned int i = 0; i < updateInfoList.size(); ++i)
@@ -629,7 +633,7 @@ bool TestGraphicsController::EnableDepthStencilBuffer(bool enableDepth, bool ena
   TraceCallStack::NamedParams namedParams;
   namedParams["enableDepth"] << (enableDepth ? "T" : "F");
   namedParams["enableStencil"] << (enableStencil ? "T" : "F");
   TraceCallStack::NamedParams namedParams;
   namedParams["enableDepth"] << (enableDepth ? "T" : "F");
   namedParams["enableStencil"] << (enableStencil ? "T" : "F");
-  mCallStack.PushCall("Controller::EnableDepthStencilBuffer", "", namedParams);
+  mCallStack.PushCall("EnableDepthStencilBuffer", "", namedParams);
   return false;
 }
 
   return false;
 }
 
@@ -637,17 +641,17 @@ void TestGraphicsController::RunGarbageCollector(size_t numberOfDiscardedRendere
 {
   TraceCallStack::NamedParams namedParams;
   namedParams["numberOfDiscardedRenderers"] << numberOfDiscardedRenderers;
 {
   TraceCallStack::NamedParams namedParams;
   namedParams["numberOfDiscardedRenderers"] << numberOfDiscardedRenderers;
-  mCallStack.PushCall("Controller::RunGarbageCollector", "", namedParams);
+  mCallStack.PushCall("RunGarbageCollector", "", namedParams);
 }
 
 void TestGraphicsController::DiscardUnusedResources()
 {
 }
 
 void TestGraphicsController::DiscardUnusedResources()
 {
-  mCallStack.PushCall("Controller::DiscardUnusedResources", "");
+  mCallStack.PushCall("DiscardUnusedResources", "");
 }
 
 bool TestGraphicsController::IsDiscardQueueEmpty()
 {
 }
 
 bool TestGraphicsController::IsDiscardQueueEmpty()
 {
-  mCallStack.PushCall("Controller::IsDiscardQueueEmpty", "");
+  mCallStack.PushCall("IsDiscardQueueEmpty", "");
   return isDiscardQueueEmptyResult;
 }
 
   return isDiscardQueueEmptyResult;
 }
 
@@ -658,7 +662,7 @@ bool TestGraphicsController::IsDiscardQueueEmpty()
  */
 bool TestGraphicsController::IsDrawOnResumeRequired()
 {
  */
 bool TestGraphicsController::IsDrawOnResumeRequired()
 {
-  mCallStack.PushCall("Controller::IsDrawOnResumeRequired", "");
+  mCallStack.PushCall("IsDrawOnResumeRequired", "");
   return isDrawOnResumeRequiredResult;
 }
 
   return isDrawOnResumeRequiredResult;
 }
 
@@ -666,7 +670,7 @@ Graphics::UniquePtr<Graphics::Buffer> TestGraphicsController::CreateBuffer(const
 {
   std::ostringstream oss;
   oss << "bufferCreateInfo:" << createInfo;
 {
   std::ostringstream oss;
   oss << "bufferCreateInfo:" << createInfo;
-  mCallStack.PushCall("Controller::CreateBuffer", oss.str());
+  mCallStack.PushCall("CreateBuffer", oss.str());
   return Graphics::MakeUnique<TestGraphicsBuffer>(mCallStack, mGl, createInfo.size, createInfo.usage);
 }
 
   return Graphics::MakeUnique<TestGraphicsBuffer>(mCallStack, mGl, createInfo.size, createInfo.usage);
 }
 
@@ -674,13 +678,13 @@ Graphics::UniquePtr<Graphics::CommandBuffer> TestGraphicsController::CreateComma
 {
   std::ostringstream oss;
   oss << "commandBufferCreateInfo:" << commandBufferCreateInfo;
 {
   std::ostringstream oss;
   oss << "commandBufferCreateInfo:" << commandBufferCreateInfo;
-  mCallStack.PushCall("Controller::CreateCommandBuffer", oss.str());
+  mCallStack.PushCall("CreateCommandBuffer", oss.str());
   return Graphics::MakeUnique<TestGraphicsCommandBuffer>(mCommandBufferCallStack, mGl);
 }
 
 Graphics::UniquePtr<Graphics::RenderPass> TestGraphicsController::CreateRenderPass(const Graphics::RenderPassCreateInfo& renderPassCreateInfo, Graphics::UniquePtr<Graphics::RenderPass>&& oldRenderPass)
 {
   return Graphics::MakeUnique<TestGraphicsCommandBuffer>(mCommandBufferCallStack, mGl);
 }
 
 Graphics::UniquePtr<Graphics::RenderPass> TestGraphicsController::CreateRenderPass(const Graphics::RenderPassCreateInfo& renderPassCreateInfo, Graphics::UniquePtr<Graphics::RenderPass>&& oldRenderPass)
 {
-  mCallStack.PushCall("Controller::CreateRenderPass", "");
+  mCallStack.PushCall("CreateRenderPass", "");
   return nullptr;
 }
 
   return nullptr;
 }
 
@@ -688,47 +692,53 @@ Graphics::UniquePtr<Graphics::Texture> TestGraphicsController::CreateTexture(con
 {
   TraceCallStack::NamedParams namedParams;
   namedParams["textureCreateInfo"] << textureCreateInfo;
 {
   TraceCallStack::NamedParams namedParams;
   namedParams["textureCreateInfo"] << textureCreateInfo;
-  mCallStack.PushCall("Controller::CreateTexture", namedParams.str(), namedParams);
+  mCallStack.PushCall("CreateTexture", namedParams.str(), namedParams);
 
   return Graphics::MakeUnique<TestGraphicsTexture>(mGl, textureCreateInfo);
 }
 
 Graphics::UniquePtr<Graphics::Framebuffer> TestGraphicsController::CreateFramebuffer(const Graphics::FramebufferCreateInfo& framebufferCreateInfo, Graphics::UniquePtr<Graphics::Framebuffer>&& oldFramebuffer)
 {
 
   return Graphics::MakeUnique<TestGraphicsTexture>(mGl, textureCreateInfo);
 }
 
 Graphics::UniquePtr<Graphics::Framebuffer> TestGraphicsController::CreateFramebuffer(const Graphics::FramebufferCreateInfo& framebufferCreateInfo, Graphics::UniquePtr<Graphics::Framebuffer>&& oldFramebuffer)
 {
-  mCallStack.PushCall("Controller::CreateFramebuffer", "");
+  mCallStack.PushCall("CreateFramebuffer", "");
   return nullptr;
 }
 
 Graphics::UniquePtr<Graphics::Pipeline> TestGraphicsController::CreatePipeline(const Graphics::PipelineCreateInfo& pipelineCreateInfo, Graphics::UniquePtr<Graphics::Pipeline>&& oldPipeline)
 {
   return nullptr;
 }
 
 Graphics::UniquePtr<Graphics::Pipeline> TestGraphicsController::CreatePipeline(const Graphics::PipelineCreateInfo& pipelineCreateInfo, Graphics::UniquePtr<Graphics::Pipeline>&& oldPipeline)
 {
-  mCallStack.PushCall("Controller::CreatePipeline", "");
+  mCallStack.PushCall("CreatePipeline", "");
   return std::make_unique<TestGraphicsPipeline>(mGl, pipelineCreateInfo);
 }
 
   return std::make_unique<TestGraphicsPipeline>(mGl, pipelineCreateInfo);
 }
 
+Graphics::UniquePtr<Graphics::Program> TestGraphicsController::CreateProgram(const Graphics::ProgramCreateInfo& programCreateInfo, Graphics::UniquePtr<Graphics::Program>&& oldProgram)
+{
+  mCallStack.PushCall("CreateProgram", "");
+  return Graphics::MakeUnique<TestGraphicsProgram>(mGl, programCreateInfo, mVertexFormats);
+}
+
 Graphics::UniquePtr<Graphics::Shader> TestGraphicsController::CreateShader(const Graphics::ShaderCreateInfo& shaderCreateInfo, Graphics::UniquePtr<Graphics::Shader>&& oldShader)
 {
 Graphics::UniquePtr<Graphics::Shader> TestGraphicsController::CreateShader(const Graphics::ShaderCreateInfo& shaderCreateInfo, Graphics::UniquePtr<Graphics::Shader>&& oldShader)
 {
-  mCallStack.PushCall("Controller::CreateShader", "");
-  return nullptr;
+  mCallStack.PushCall("CreateShader", "");
+  return Graphics::MakeUnique<TestGraphicsShader>(mGl, shaderCreateInfo);
 }
 
 Graphics::UniquePtr<Graphics::Sampler> TestGraphicsController::CreateSampler(const Graphics::SamplerCreateInfo& samplerCreateInfo, Graphics::UniquePtr<Graphics::Sampler>&& oldSampler)
 {
   TraceCallStack::NamedParams namedParams;
   namedParams["samplerCreateInfo"] << samplerCreateInfo;
 }
 
 Graphics::UniquePtr<Graphics::Sampler> TestGraphicsController::CreateSampler(const Graphics::SamplerCreateInfo& samplerCreateInfo, Graphics::UniquePtr<Graphics::Sampler>&& oldSampler)
 {
   TraceCallStack::NamedParams namedParams;
   namedParams["samplerCreateInfo"] << samplerCreateInfo;
-  mCallStack.PushCall("Controller::CreateSampler", namedParams.str(), namedParams);
+  mCallStack.PushCall("CreateSampler", namedParams.str(), namedParams);
 
   return Graphics::MakeUnique<TestGraphicsSampler>(mGl, samplerCreateInfo);
 }
 
 Graphics::UniquePtr<Graphics::RenderTarget> TestGraphicsController::CreateRenderTarget(const Graphics::RenderTargetCreateInfo& renderTargetCreateInfo, Graphics::UniquePtr<Graphics::RenderTarget>&& oldRenderTarget)
 {
 
   return Graphics::MakeUnique<TestGraphicsSampler>(mGl, samplerCreateInfo);
 }
 
 Graphics::UniquePtr<Graphics::RenderTarget> TestGraphicsController::CreateRenderTarget(const Graphics::RenderTargetCreateInfo& renderTargetCreateInfo, Graphics::UniquePtr<Graphics::RenderTarget>&& oldRenderTarget)
 {
-  mCallStack.PushCall("Controller::CreateRenderTarget", "");
+  mCallStack.PushCall("CreateRenderTarget", "");
   return nullptr;
 }
 
 Graphics::UniquePtr<Graphics::Memory> TestGraphicsController::MapBufferRange(const Graphics::MapBufferInfo& mapInfo)
 {
   return nullptr;
 }
 
 Graphics::UniquePtr<Graphics::Memory> TestGraphicsController::MapBufferRange(const Graphics::MapBufferInfo& mapInfo)
 {
-  mCallStack.PushCall("Controller::MapBufferRange", "");
+  mCallStack.PushCall("MapBufferRange", "");
 
   auto buffer = static_cast<TestGraphicsBuffer*>(mapInfo.buffer);
   buffer->memory.resize(mapInfo.offset + mapInfo.size); // For initial testing, allow writes past capacity
 
   auto buffer = static_cast<TestGraphicsBuffer*>(mapInfo.buffer);
   buffer->memory.resize(mapInfo.offset + mapInfo.size); // For initial testing, allow writes past capacity
@@ -738,46 +748,51 @@ Graphics::UniquePtr<Graphics::Memory> TestGraphicsController::MapBufferRange(con
 
 Graphics::UniquePtr<Graphics::Memory> TestGraphicsController::MapTextureRange(const Graphics::MapTextureInfo& mapInfo)
 {
 
 Graphics::UniquePtr<Graphics::Memory> TestGraphicsController::MapTextureRange(const Graphics::MapTextureInfo& mapInfo)
 {
-  mCallStack.PushCall("Controller::MapTextureRange", "");
+  mCallStack.PushCall("MapTextureRange", "");
   return nullptr;
 }
 
 void TestGraphicsController::UnmapMemory(Graphics::UniquePtr<Graphics::Memory> memory)
 {
   return nullptr;
 }
 
 void TestGraphicsController::UnmapMemory(Graphics::UniquePtr<Graphics::Memory> memory)
 {
-  mCallStack.PushCall("Controller::UnmapMemory", "");
+  mCallStack.PushCall("UnmapMemory", "");
 }
 
 Graphics::MemoryRequirements TestGraphicsController::GetTextureMemoryRequirements(Graphics::Texture& texture) const
 {
 }
 
 Graphics::MemoryRequirements TestGraphicsController::GetTextureMemoryRequirements(Graphics::Texture& texture) const
 {
-  mCallStack.PushCall("Controller::GetTextureMemoryRequirements", "");
+  mCallStack.PushCall("GetTextureMemoryRequirements", "");
   return Graphics::MemoryRequirements{};
 }
 
 Graphics::MemoryRequirements TestGraphicsController::GetBufferMemoryRequirements(Graphics::Buffer& buffer) const
 {
   return Graphics::MemoryRequirements{};
 }
 
 Graphics::MemoryRequirements TestGraphicsController::GetBufferMemoryRequirements(Graphics::Buffer& buffer) const
 {
-  mCallStack.PushCall("Controller::GetBufferMemoryRequirements", "");
+  mCallStack.PushCall("GetBufferMemoryRequirements", "");
   return Graphics::MemoryRequirements{};
 }
 
 const Graphics::TextureProperties& TestGraphicsController::GetTextureProperties(const Graphics::Texture& texture)
 {
   static Graphics::TextureProperties textureProperties{};
   return Graphics::MemoryRequirements{};
 }
 
 const Graphics::TextureProperties& TestGraphicsController::GetTextureProperties(const Graphics::Texture& texture)
 {
   static Graphics::TextureProperties textureProperties{};
-  mCallStack.PushCall("Controller::GetTextureProperties", "");
+  mCallStack.PushCall("GetTextureProperties", "");
 
   return textureProperties;
 }
 
 
   return textureProperties;
 }
 
-const Graphics::Reflection& TestGraphicsController::GetPipelineReflection(const Graphics::Pipeline& pipeline)
+const Graphics::Reflection& TestGraphicsController::GetProgramReflection(const Graphics::Program& program)
 {
 {
-  static TestGraphicsReflection reflection(mGl);
-  mCallStack.PushCall("Controller::GetPipelineReflection", "");
+  mCallStack.PushCall("GetProgramReflection", "");
 
 
-  return reflection;
+  return static_cast<const TestGraphicsProgram*>(&program)->GetReflection();
 }
 
 bool TestGraphicsController::PipelineEquals(const Graphics::Pipeline& pipeline0, const Graphics::Pipeline& pipeline1) const
 {
 }
 
 bool TestGraphicsController::PipelineEquals(const Graphics::Pipeline& pipeline0, const Graphics::Pipeline& pipeline1) const
 {
-  mCallStack.PushCall("Controller::PipelineEquals", "");
+  mCallStack.PushCall("PipelineEquals", "");
+  return false;
+}
+
+bool TestGraphicsController::GetProgramParameter(Graphics::Program& program, uint32_t parameterId, void* outData )
+{
+  mCallStack.PushCall("GetProgramParameter", "");
   return false;
 }
 
   return false;
 }
 
index bf2ba21..9179a39 100644 (file)
@@ -176,6 +176,14 @@ public:
   Graphics::UniquePtr<Graphics::Pipeline> CreatePipeline(const Graphics::PipelineCreateInfo& pipelineCreateInfo, Graphics::UniquePtr<Graphics::Pipeline>&& oldPipeline) override;
 
   /**
   Graphics::UniquePtr<Graphics::Pipeline> CreatePipeline(const Graphics::PipelineCreateInfo& pipelineCreateInfo, Graphics::UniquePtr<Graphics::Pipeline>&& oldPipeline) override;
 
   /**
+   * @brief Creates new Program object
+   *
+   * @param[in] programCreateInfo The valid ProgramCreateInfo structure
+   * @return pointer to the Program object
+   */
+  Graphics::UniquePtr<Graphics::Program> CreateProgram(const Graphics::ProgramCreateInfo& programCreateInfo, Graphics::UniquePtr<Graphics::Program>&& oldProgram) override;
+
+  /**
    * @brief Creates new Shader object
    *
    * @param[in] shaderCreateInfo The valid ShaderCreateInfo structure
    * @brief Creates new Shader object
    *
    * @param[in] shaderCreateInfo The valid ShaderCreateInfo structure
@@ -268,12 +276,12 @@ public:
   const Graphics::TextureProperties& GetTextureProperties(const Graphics::Texture& texture) override;
 
   /**
   const Graphics::TextureProperties& GetTextureProperties(const Graphics::Texture& texture) override;
 
   /**
-   * @brief Returns the reflection of the given pipeline
+   * @brief Returns the reflection of the given program
    *
    *
-   * @param[in] pipeline The pipeline
-   * @return The reflection of the pipeline
+   * @param[in] program The program
+   * @return The reflection of the program
    */
    */
-  const Graphics::Reflection& GetPipelineReflection(const Graphics::Pipeline& pipeline) override;
+  const Graphics::Reflection& GetProgramReflection(const Graphics::Program& program) override;
 
   /**
    * @brief Tests whether two Pipelines are the same.
 
   /**
    * @brief Tests whether two Pipelines are the same.
@@ -284,9 +292,33 @@ public:
    */
   bool PipelineEquals(const Graphics::Pipeline& pipeline0, const Graphics::Pipeline& pipeline1) const override;
 
    */
   bool PipelineEquals(const Graphics::Pipeline& pipeline0, const Graphics::Pipeline& pipeline1) const override;
 
+public: // Test Functions
+  void SetVertexFormats(Property::Array& vfs)
+  {
+    mVertexFormats = vfs;
+  }
+
+  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;
+
 public:
 public:
-  mutable TraceCallStack mCallStack;
-  mutable TraceCallStack mCommandBufferCallStack;
+  mutable TraceCallStack                    mCallStack;
+  mutable TraceCallStack                    mCommandBufferCallStack;
+  mutable std::vector<Graphics::SubmitInfo> mSubmitStack;
 
   TestGlAbstraction              mGl;
   TestGlSyncAbstraction          mGlSyncAbstraction;
 
   TestGlAbstraction              mGl;
   TestGlSyncAbstraction          mGlSyncAbstraction;
@@ -294,6 +326,8 @@ public:
 
   bool isDiscardQueueEmptyResult{true};
   bool isDrawOnResumeRequiredResult{true};
 
   bool isDiscardQueueEmptyResult{true};
   bool isDrawOnResumeRequiredResult{true};
+
+  Property::Array mVertexFormats;
 };
 
 } // namespace Dali
 };
 
 } // namespace Dali
index 0cc4194..d303d56 100644 (file)
@@ -26,8 +26,8 @@ TestGraphicsPipeline::TestGraphicsPipeline(TestGlAbstraction& gl, const Graphics
   if(createInfo.colorBlendState)
     colorBlendState = *createInfo.colorBlendState;
 
   if(createInfo.colorBlendState)
     colorBlendState = *createInfo.colorBlendState;
 
-  if(createInfo.shaderState)
-    shaderState = *createInfo.shaderState;
+  if(createInfo.programState)
+    programState = *createInfo.programState;
 
   if(createInfo.viewportState)
     viewportState = *createInfo.viewportState;
 
   if(createInfo.viewportState)
     viewportState = *createInfo.viewportState;
index 666e0d4..a748e71 100644 (file)
 #include <dali/graphics-api/graphics-pipeline-create-info.h>
 #include <dali/graphics-api/graphics-pipeline.h>
 #include "test-gl-abstraction.h"
 #include <dali/graphics-api/graphics-pipeline-create-info.h>
 #include <dali/graphics-api/graphics-pipeline.h>
 #include "test-gl-abstraction.h"
+#include "test-graphics-program.h"
+#include "test-graphics-reflection.h"
 
 namespace Dali
 {
 
 namespace Dali
 {
+class TestGraphicsReflection;
+
+template<typename T>
+T* Uncast(const Graphics::Program* object)
+{
+  return const_cast<T*>(static_cast<const T*>(object));
+}
+
 class TestGraphicsPipeline : public Graphics::Pipeline
 {
 public:
   TestGraphicsPipeline(TestGlAbstraction& gl, const Graphics::PipelineCreateInfo& createInfo);
 
 class TestGraphicsPipeline : public Graphics::Pipeline
 {
 public:
   TestGraphicsPipeline(TestGlAbstraction& gl, const Graphics::PipelineCreateInfo& createInfo);
 
+  const TestGraphicsReflection& GetReflection() const
+  {
+    return Uncast<TestGraphicsProgram>(programState.program)->GetReflection();
+  }
+
+public:
   TestGlAbstraction& mGl;
 
   Graphics::ColorBlendState          colorBlendState;
   TestGlAbstraction& mGl;
 
   Graphics::ColorBlendState          colorBlendState;
-  std::vector<Graphics::ShaderState> shaderState;
+  Graphics::ProgramState             programState;
   Graphics::ViewportState            viewportState;
   Graphics::FramebufferState         framebufferState;
   Graphics::Pipeline                 basePipeline;
   Graphics::ViewportState            viewportState;
   Graphics::FramebufferState         framebufferState;
   Graphics::Pipeline                 basePipeline;
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-program.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-program.cpp
new file mode 100644 (file)
index 0000000..db5a9f7
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2021 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "test-graphics-program.h"
+
+namespace Dali
+{
+TestGraphicsProgram::TestGraphicsProgram(TestGlAbstraction& gl, const Graphics::ProgramCreateInfo& createInfo, Property::Array& vertexFormats)
+: mGl(gl),
+  mCreateInfo(createInfo),
+  mReflection(gl, vertexFormats)
+{
+}
+
+} // namespace Dali
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-program.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-program.h
new file mode 100644 (file)
index 0000000..2bd04de
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef DALI_TEST_GRAPHICS_PROGRAM_H
+#define DALI_TEST_GRAPHICS_PROGRAM_H
+
+/*
+ * Copyright (c) 2021 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dali/graphics-api/graphics-program-create-info.h>
+#include <dali/graphics-api/graphics-program.h>
+#include "test-gl-abstraction.h"
+#include "test-graphics-reflection.h"
+
+namespace Dali
+{
+class TestGraphicsProgram : public Graphics::Program
+{
+public:
+  TestGraphicsProgram(TestGlAbstraction& gl, const Graphics::ProgramCreateInfo& createInfo, Property::Array& vertexFormats);
+
+  // For API
+  const TestGraphicsReflection& GetReflection() const
+  {
+    // Build a reflection
+    return mReflection;
+  }
+
+  // For tests
+  TestGraphicsReflection& GetProgamReflection()
+  {
+    return mReflection;
+  }
+
+public:
+  TestGlAbstraction&          mGl;
+  Graphics::ProgramCreateInfo mCreateInfo;
+  TestGraphicsReflection      mReflection;
+};
+
+} // namespace Dali
+
+#endif //DALI_TEST_GRAPHICS_PROGRAM_H
index 9bce79a..c9ef2d0 100644 (file)
  */
 
 #include "test-graphics-reflection.h"
  */
 
 #include "test-graphics-reflection.h"
+#include <dali/public-api/object/property-map.h>
 
 namespace Dali
 {
 
 namespace Dali
 {
-TestGraphicsReflection::TestGraphicsReflection(TestGlAbstraction& gl)
+TestGraphicsReflection::TestGraphicsReflection(TestGlAbstraction& gl, Property::Array& vfs)
 : mGl(gl)
 {
 : mGl(gl)
 {
+  for(Property::Array::SizeType i = 0; i < vfs.Count(); ++i)
+  {
+    Property::Map* vertexFormat = vfs[i].GetMap();
+    if(vertexFormat)
+    {
+      for(Property::Map::SizeType j = 0; j < vertexFormat->Count(); ++j)
+      {
+        auto key = vertexFormat->GetKeyAt(j);
+        if(key.type == Property::Key::STRING)
+        {
+          mAttributes.push_back(key.stringKey);
+        }
+      }
+    }
+  }
 }
 
 uint32_t TestGraphicsReflection::GetVertexAttributeLocation(const std::string& name) const
 {
 }
 
 uint32_t TestGraphicsReflection::GetVertexAttributeLocation(const std::string& name) const
 {
+  // Automatically assign locations to named attributes when requested
+  auto iter = std::find(mAttributes.begin(), mAttributes.end(), name);
+  if(iter != mAttributes.end())
+  {
+    return iter - mAttributes.begin();
+  }
+  else
+  {
+    uint32_t location = mAttributes.size();
+    mAttributes.push_back(name);
+    return location;
+  }
   return 0u;
 }
 
   return 0u;
 }
 
@@ -40,7 +68,12 @@ std::string TestGraphicsReflection::GetVertexAttributeName(uint32_t location) co
 
 std::vector<uint32_t> TestGraphicsReflection::GetVertexAttributeLocations() const
 {
 
 std::vector<uint32_t> TestGraphicsReflection::GetVertexAttributeLocations() const
 {
-  return std::vector<uint32_t>{};
+  std::vector<uint32_t> locs;
+  for(uint32_t i = 0; i < mAttributes.size(); ++i)
+  {
+    locs.push_back(i);
+  }
+  return locs;
 }
 
 uint32_t TestGraphicsReflection::GetUniformBlockCount() const
 }
 
 uint32_t TestGraphicsReflection::GetUniformBlockCount() const
index 1c9f62b..9311e07 100644 (file)
@@ -25,7 +25,7 @@ namespace Dali
 class TestGraphicsReflection : public Graphics::Reflection
 {
 public:
 class TestGraphicsReflection : public Graphics::Reflection
 {
 public:
-  TestGraphicsReflection(TestGlAbstraction& gl);
+  TestGraphicsReflection(TestGlAbstraction& gl, Property::Array& vertexFormats);
 
   uint32_t                                   GetVertexAttributeLocation(const std::string& name) const override;
   Dali::Graphics::VertexInputAttributeFormat GetVertexAttributeFormat(uint32_t location) const override;
 
   uint32_t                                   GetVertexAttributeLocation(const std::string& name) const override;
   Dali::Graphics::VertexInputAttributeFormat GetVertexAttributeFormat(uint32_t location) const override;
@@ -44,7 +44,19 @@ public:
   std::vector<Dali::Graphics::UniformInfo>   GetSamplers() const override;
   Graphics::ShaderLanguage                   GetLanguage() const override;
 
   std::vector<Dali::Graphics::UniformInfo>   GetSamplers() const override;
   Graphics::ShaderLanguage                   GetLanguage() const override;
 
-  TestGlAbstraction& mGl;
+public: // Test methods
+  void SetAttributes(std::vector<std::string> locations)
+  {
+    mAttributes.clear();
+    mAttributes.resize(locations.size());
+    for(auto& location : locations)
+    {
+      mAttributes.push_back(location);
+    }
+  }
+
+  TestGlAbstraction&               mGl;
+  mutable std::vector<std::string> mAttributes;
 };
 
 } // namespace Dali
 };
 
 } // namespace Dali
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-shader.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-shader.cpp
new file mode 100644 (file)
index 0000000..db2d1a2
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2021 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "test-graphics-shader.h"
+
+namespace Dali
+{
+TestGraphicsShader::TestGraphicsShader(TestGlAbstraction& gl, const Graphics::ShaderCreateInfo& createInfo)
+: mGl(gl),
+  mCreateInfo(createInfo)
+{
+}
+
+} // namespace Dali
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-shader.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-shader.h
new file mode 100644 (file)
index 0000000..ad6f9c5
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef DALI_TEST_GRAPHICS_SHADER_H
+#define DALI_TEST_GRAPHICS_SHADER_H
+
+/*
+ * Copyright (c) 2021 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dali/graphics-api/graphics-shader-create-info.h>
+#include <dali/graphics-api/graphics-shader.h>
+#include "test-gl-abstraction.h"
+
+namespace Dali
+{
+class TestGraphicsShader : public Graphics::Shader
+{
+public:
+  TestGraphicsShader(TestGlAbstraction& gl, const Graphics::ShaderCreateInfo& createInfo);
+
+public:
+  TestGlAbstraction&         mGl;
+  Graphics::ShaderCreateInfo mCreateInfo;
+};
+
+} // namespace Dali
+
+#endif //DALI_TEST_GRAPHICS_SHADER_H