Test harness for UBO 13/254713/4
authorRichard Huang <r.huang@samsung.com>
Mon, 8 Mar 2021 14:18:09 +0000 (14:18 +0000)
committerRichard Huang <r.huang@samsung.com>
Mon, 8 Mar 2021 16:58:49 +0000 (16:58 +0000)
Change-Id: Iff3b9687f8389015aefc24e9b64007a8a3f29252

17 files changed:
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-buffer.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-buffer.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-command-buffer.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-command-buffer.h
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-program.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-program.h
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/utc-Dali-ArcVisual.cpp
automated-tests/src/dali-toolkit/utc-Dali-BubbleEmitter.cpp
automated-tests/src/dali-toolkit/utc-Dali-ImageView.cpp
automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp
automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp
automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp

index 1d93731..292f8b4 100644 (file)
 
 namespace Dali
 {
 
 namespace Dali
 {
+
+struct UniformData
+{
+  std::string     name;
+  Property::Type  type;
+  UniformData( const std::string& name, Property::Type type = Property::Type::NONE)
+  : name(name), type(type)
+  {}
+};
+
 class DALI_CORE_API TestGlAbstraction : public Dali::Integration::GlAbstraction
 {
 public:
 class DALI_CORE_API TestGlAbstraction : public Dali::Integration::GlAbstraction
 {
 public:
@@ -899,7 +909,7 @@ public:
     if(it2 == uniformIDs.end())
     {
       // Uniform not found, so add it...
     if(it2 == uniformIDs.end())
     {
       // Uniform not found, so add it...
-      uniformIDs[name] = ++mLastUniformIdUsed;
+      uniformIDs[name] = mLastUniformIdUsed++;
       return mLastUniformIdUsed;
     }
 
       return mLastUniformIdUsed;
     }
 
@@ -971,9 +981,35 @@ public:
     mShaderTrace.PushCall("LinkProgram", out.str(), namedParams);
 
     mNumberOfActiveUniforms = 3;
     mShaderTrace.PushCall("LinkProgram", out.str(), namedParams);
 
     mNumberOfActiveUniforms = 3;
-    GetUniformLocation(program, "sTexture");
+
+    GetUniformLocation(program, "uRendererColor");
+    GetUniformLocation(program, "uCustom");
+    GetUniformLocation(program, "uCustom3");
+    GetUniformLocation(program, "uFadeColor");
+    GetUniformLocation(program, "uUniform1");
+    GetUniformLocation(program, "uUniform2");
+    GetUniformLocation(program, "uUniform3");
+    GetUniformLocation(program, "uFadeProgress");
+    GetUniformLocation(program, "uANormalMatrix");
     GetUniformLocation(program, "sEffect");
     GetUniformLocation(program, "sEffect");
+    GetUniformLocation(program, "sTexture");
+    GetUniformLocation(program, "sTextureRect");
     GetUniformLocation(program, "sGloss");
     GetUniformLocation(program, "sGloss");
+    GetUniformLocation(program, "uColor");
+    GetUniformLocation(program, "uModelMatrix");
+    GetUniformLocation(program, "uModelView");
+    GetUniformLocation(program, "uMvpMatrix");
+    GetUniformLocation(program, "uNormalMatrix");
+    GetUniformLocation(program, "uProjection");
+    GetUniformLocation(program, "uSize");
+    GetUniformLocation(program, "uViewMatrix");
+    GetUniformLocation(program, "uLightCameraProjectionMatrix");
+    GetUniformLocation(program, "uLightCameraViewMatrix");
+
+    for( const auto& uniform : mCustomUniformData )
+    {
+      GetUniformLocation(program, uniform.name.c_str());
+    }
   }
 
   inline void PixelStorei(GLenum pname, GLint param) override
   }
 
   inline void PixelStorei(GLenum pname, GLint param) override
@@ -1181,10 +1217,16 @@ public:
     out << std::hex << target << ", " << pname << ", " << param;
     std::string params = out.str();
 
     out << std::hex << target << ", " << pname << ", " << param;
     std::string params = out.str();
 
+    out.str("");
+    out << std::hex << target;
     TraceCallStack::NamedParams namedParams;
     TraceCallStack::NamedParams namedParams;
-    namedParams["target"] << std::hex << target;
-    namedParams["pname"] << std::hex << pname;
-    namedParams["param"] << param;
+    namedParams["target"] << out.str();
+    out.str("");
+    out << std::hex << pname;
+    namedParams["pname"] << out.str();
+    out.str("");
+    out << std::hex << param;
+    namedParams["param"] << out.str();
     mTexParameterTrace.PushCall("TexParameteri", params, namedParams);
   }
 
     mTexParameterTrace.PushCall("TexParameteri", params, namedParams);
   }
 
@@ -2270,7 +2312,7 @@ public: // TEST FUNCTIONS
       }
     }
 
       }
     }
 
-    fprintf(stderr, "Not found, printing possible values:\n");
+    fprintf(stderr, "%s Not found, printing possible values:\n", name);
     for(ProgramUniformMap::const_iterator program_it = mUniforms.begin();
         program_it != mUniforms.end();
         ++program_it)
     for(ProgramUniformMap::const_iterator program_it = mUniforms.begin();
         program_it != mUniforms.end();
         ++program_it)
@@ -2289,7 +2331,7 @@ public: // TEST FUNCTIONS
         if(mProgramUniforms.GetUniformValue(programId, uniformId, origValue))
         {
           std::stringstream out;
         if(mProgramUniforms.GetUniformValue(programId, uniformId, origValue))
         {
           std::stringstream out;
-          out << uniform_it->first << ": " << origValue;
+          out << "Program: " << programId << ", " << uniform_it->first << ": " << origValue;
           fprintf(stderr, "%s\n", out.str().c_str());
         }
       }
           fprintf(stderr, "%s\n", out.str().c_str());
         }
       }
@@ -2323,6 +2365,11 @@ public: // TEST FUNCTIONS
     return false;
   }
 
     return false;
   }
 
+  inline void SetCustomUniforms(std::vector<UniformData>& customUniformData)
+  {
+    mCustomUniformData = customUniformData;
+  }
+
   inline GLuint GetLastShaderCompiled() const
   {
     return mLastShaderCompiled;
   inline GLuint GetLastShaderCompiled() const
   {
     return mLastShaderCompiled;
@@ -2506,6 +2553,8 @@ private:
   typedef std::map<GLuint, UniformIDMap> ProgramUniformMap;
   ProgramUniformMap                      mUniforms;
 
   typedef std::map<GLuint, UniformIDMap> ProgramUniformMap;
   ProgramUniformMap                      mUniforms;
 
+  std::vector<UniformData>               mCustomUniformData{};
+
   template<typename T>
   struct ProgramUniformValue : public std::map<GLuint, std::map<GLint, T> >
   {
   template<typename T>
   struct ProgramUniformValue : public std::map<GLuint, std::map<GLint, T> >
   {
index 90640e5..b64b9ee 100644 (file)
@@ -15,6 +15,8 @@
  */
 
 #include "test-graphics-buffer.h"
  */
 
 #include "test-graphics-buffer.h"
+#include "test-graphics-program.h"
+#include "test-graphics-reflection.h"
 #include <sstream>
 #include "dali-test-suite-utils.h"
 
 #include <sstream>
 #include "dali-test-suite-utils.h"
 
@@ -78,4 +80,72 @@ GLenum TestGraphicsBuffer::GetTarget()
   return target;
 }
 
   return target;
 }
 
+void TestGraphicsBuffer::BindAsUniformBuffer( const TestGraphicsProgram* program ) const
+{
+  auto* reflection = static_cast<const TestGraphicsReflection*>(&program->GetReflection());
+
+  Graphics::UniformBlockInfo uboInfo{};
+  reflection->GetUniformBlock(0, uboInfo);
+
+  auto* data = memory.data();
+
+  for( const auto& member : uboInfo.members )
+  {
+    auto type = reflection->GetMemberType( 0, member.location );
+    switch(type)
+    {
+      case Property::VECTOR4:
+      {
+        auto value = *reinterpret_cast<const Dali::Vector4*>(data+member.offset);
+        mGl.Uniform4f( member.location, value.x, value.y, value.z, value.w );
+        break;
+      }
+      case Property::VECTOR3:
+      {
+        auto value = *reinterpret_cast<const Dali::Vector3*>(data+member.offset);
+        mGl.Uniform3f( member.location, value.x, value.y, value.z );
+        break;
+      }
+      case Property::VECTOR2:
+      {
+        auto value = *reinterpret_cast<const Dali::Vector2*>(data+member.offset);
+        mGl.Uniform2f( member.location, value.x, value.y );
+        break;
+      }
+      case Property::FLOAT:
+      {
+        auto value = *reinterpret_cast<const float*>(data+member.offset);
+        fprintf(stderr, "BindAsUniformBuffer: %s, value: %f\n", member.name.c_str(), value);
+        mGl.Uniform1f( member.location, value );
+        break;
+      }
+      case Property::INTEGER:
+      {
+        auto ptr = reinterpret_cast<const GLint*>(data+member.offset);
+        auto value = *ptr;
+        mGl.Uniform1i( member.location, value );
+        break;
+      }
+      case Property::MATRIX:
+      {
+        auto value = reinterpret_cast<const float*>(data+member.offset);
+        mGl.UniformMatrix4fv( member.location, 1, GL_FALSE, value );
+        break;
+      }
+      case Property::MATRIX3:
+      {
+        auto value = reinterpret_cast<const float*>(data+member.offset);
+        mGl.UniformMatrix3fv( member.location, 1, GL_FALSE, value );
+        break;
+      }
+      default:
+      {
+        fprintf(stderr, "\n%s type not found\n", member.name.c_str());
+      }
+    }
+  }
+
+
+}
+
 } // namespace Dali
 } // namespace Dali
index c4abc3e..64107cf 100644 (file)
@@ -25,6 +25,7 @@
 
 namespace Dali
 {
 
 namespace Dali
 {
+class TestGraphicsProgram;
 class TestGraphicsBuffer : public Graphics::Buffer
 {
 public:
 class TestGraphicsBuffer : public Graphics::Buffer
 {
 public:
@@ -34,6 +35,13 @@ public:
   void   Upload(uint32_t offset, uint32_t size);
   GLenum GetTarget();
 
   void   Upload(uint32_t offset, uint32_t size);
   GLenum GetTarget();
 
+  bool IsCPUAllocated() const
+  {
+    return true;
+  }
+
+  void BindAsUniformBuffer( const TestGraphicsProgram* program ) const;
+
   TraceCallStack&            mCallStack;
   TestGlAbstraction&         mGl;
   std::vector<uint8_t>       memory;
   TraceCallStack&            mCallStack;
   TestGlAbstraction&         mGl;
   std::vector<uint8_t>       memory;
index a0dee4a..70f3f0e 100644 (file)
@@ -24,134 +24,53 @@ TestGraphicsCommandBuffer::TestGraphicsCommandBuffer(TraceCallStack& callstack,
 {
 }
 
 {
 }
 
-void TestGraphicsCommandBuffer::BindVertexBuffers(uint32_t                             firstBinding,
-                                                  std::vector<const Graphics::Buffer*> buffers,
-                                                  std::vector<uint32_t>                offsets)
+int TestGraphicsCommandBuffer::GetDrawCallsCount()
 {
 {
-  mVertexBufferBindings.firstBinding = firstBinding;
-  mVertexBufferBindings.buffers      = buffers; // Copy
-  mVertexBufferBindings.offsets      = offsets; // Copy
-  mCallStack.PushCall("BindVertexBuffers", "");
-}
-
-void TestGraphicsCommandBuffer::BindUniformBuffers(const std::vector<Graphics::UniformBufferBinding>& bindings)
-{
-  mCallStack.PushCall("BindUniformBuffers", "");
-}
-
-void TestGraphicsCommandBuffer::BindPipeline(const Graphics::Pipeline& pipeline)
-{
-  mPipeline = static_cast<TestGraphicsPipeline*>(const_cast<Graphics::Pipeline*>(&pipeline));
-  mCallStack.PushCall("BindPipeline", "");
-}
-
-void TestGraphicsCommandBuffer::BindTextures(std::vector<Graphics::TextureBinding>& textureBindings)
-{
-  mCallStack.PushCall("BindTextures", "");
-  for(auto& binding : textureBindings)
+  int count = 0;
+  for( auto& cmd : mCommands )
   {
   {
-    mTextureBindings.push_back(binding);
+    if( cmd.type == CommandType::DRAW ||
+      cmd.type == CommandType::DRAW_INDEXED ||
+      cmd.type == CommandType::DRAW_INDEXED_INDIRECT )
+    {
+      ++count;
+    }
   }
   }
+  return count;
 }
 
 }
 
-void TestGraphicsCommandBuffer::BindSamplers(std::vector<Graphics::SamplerBinding>& samplerBindings)
-{
-  mCallStack.PushCall("BindSamplers", "");
-}
-
-void TestGraphicsCommandBuffer::BindPushConstants(void*    data,
-                                                  uint32_t size,
-                                                  uint32_t binding)
-{
-  mCallStack.PushCall("BindPushConstants", "");
-}
-
-void TestGraphicsCommandBuffer::BindIndexBuffer(const Graphics::Buffer& buffer,
-                                                uint32_t                offset,
-                                                Graphics::Format        format)
-{
-  mIndexBufferBinding.buffer = &buffer;
-  mIndexBufferBinding.offset = offset;
-  mIndexBufferBinding.format = format;
-  mCallStack.PushCall("BindIndexBuffer", "");
-}
-
-void TestGraphicsCommandBuffer::BeginRenderPass(
-  Graphics::RenderPass&             renderPass,
-  Graphics::RenderTarget&           renderTarget,
-  Graphics::Extent2D                renderArea,
-  std::vector<Graphics::ClearValue> clearValues)
-{
-  mCallStack.PushCall("BeginRenderPass", "");
-}
-
-void TestGraphicsCommandBuffer::EndRenderPass()
-{
-  mCallStack.PushCall("EndRenderPass", "");
-}
-
-void TestGraphicsCommandBuffer::Draw(
-  uint32_t vertexCount,
-  uint32_t instanceCount,
-  uint32_t firstVertex,
-  uint32_t firstInstance)
-{
-  drawCommand.drawType                      = Draw::DrawType::Unindexed;
-  drawCommand.u.unindexedDraw.vertexCount   = vertexCount;
-  drawCommand.u.unindexedDraw.instanceCount = instanceCount;
-  drawCommand.u.unindexedDraw.firstVertex   = firstVertex;
-  drawCommand.u.unindexedDraw.firstInstance = firstInstance;
-  mCallStack.PushCall("Draw", "");
-}
-
-void TestGraphicsCommandBuffer::DrawIndexed(
-  uint32_t indexCount,
-  uint32_t instanceCount,
-  uint32_t firstIndex,
-  int32_t  vertexOffset,
-  uint32_t firstInstance)
-{
-  drawCommand.drawType                    = TestGraphicsCommandBuffer::Draw::DrawType::Indexed;
-  drawCommand.u.indexedDraw.indexCount    = indexCount;
-  drawCommand.u.indexedDraw.instanceCount = instanceCount;
-  drawCommand.u.indexedDraw.firstIndex    = firstIndex;
-  drawCommand.u.indexedDraw.vertexOffset  = vertexOffset;
-  drawCommand.u.indexedDraw.firstInstance = firstInstance;
-  mCallStack.PushCall("DrawIndexed", "");
-}
-
-void TestGraphicsCommandBuffer::DrawIndexedIndirect(
-  Graphics::Buffer& buffer,
-  uint32_t          offset,
-  uint32_t          drawCount,
-  uint32_t          stride)
-{
-  mCallStack.PushCall("DrawIndexedIndirect", "");
-}
-
-void TestGraphicsCommandBuffer::Reset(Graphics::CommandBuffer& commandBuffer)
+void TestGraphicsCommandBuffer::GetStateForDrawCall( int drawCallIndex )
 {
 {
-  mCallStack.PushCall("Reset", "");
-}
-
-void TestGraphicsCommandBuffer::SetScissor(Graphics::Extent2D value)
-{
-  mCallStack.PushCall("SetScissor", "");
-}
-
-void TestGraphicsCommandBuffer::SetScissorTestEnable(bool value)
-{
-  mCallStack.PushCall("SetScissorTestEnable", "");
-}
-
-void TestGraphicsCommandBuffer::SetViewport(Graphics::Viewport value)
-{
-  mCallStack.PushCall("SetViewport", "");
+  int index = 0;
+  std::vector<Command> mCommandStack{};
+  for( auto& cmd : mCommands )
+  {
+    mCommandStack.push_back(cmd);
+    if( cmd.type == CommandType::DRAW ||
+        cmd.type == CommandType::DRAW_INDEXED ||
+        cmd.type == CommandType::DRAW_INDEXED_INDIRECT )
+    {
+      if( index == drawCallIndex )
+      {
+        break;
+      }
+      mCommandStack.clear();
+      ++index;
+    }
+  }
 }
 
 }
 
-void TestGraphicsCommandBuffer::SetViewportEnable(bool value)
+std::vector<Command*> TestGraphicsCommandBuffer::GetCommandsByType( CommandTypeMask mask )
 {
 {
-  mCallStack.PushCall("SetViewportEnable", "");
+  std::vector<Command*> mCommandStack{};
+  for( auto& cmd : mCommands )
+  {
+    if(uint32_t(cmd.type) == (mask & uint32_t(cmd.type)) )
+    {
+      mCommandStack.emplace_back( &cmd );
+    }
+  }
+  return mCommandStack;
 }
 
 } // namespace Dali
 }
 
 } // namespace Dali
index 151a9df..b4cb9b0 100644 (file)
 #include <vector>
 #include "test-gl-abstraction.h"
 #include "test-graphics-pipeline.h"
 #include <vector>
 #include "test-gl-abstraction.h"
 #include "test-graphics-pipeline.h"
+#include "test-graphics-buffer.h"
 #include "test-trace-call-stack.h"
 
 namespace Dali
 {
 #include "test-trace-call-stack.h"
 
 namespace Dali
 {
+class TestGraphicsTexture;
+class TestGraphicsBuffer;
+class TestGraphicsSampler;
+class TestGraphicsPipeline;
+
+enum class CommandType
+{
+  FLUSH = 1 << 0,
+  BIND_TEXTURES = 1 << 1,
+  BIND_SAMPLERS = 1 << 2,
+  BIND_VERTEX_BUFFERS = 1 << 3,
+  BIND_INDEX_BUFFER = 1 << 4,
+  BIND_UNIFORM_BUFFER = 1 << 5,
+  BIND_PIPELINE = 1 << 6,
+  DRAW = 1 << 7,
+  DRAW_INDEXED = 1 << 8,
+  DRAW_INDEXED_INDIRECT = 1 << 9
+};
+
+using CommandTypeMask = uint32_t;
+template<typename T>
+inline CommandTypeMask operator|(T flags, CommandType bit)
+{
+  return static_cast<CommandTypeMask>(flags) | static_cast<CommandTypeMask>(bit);
+}
+
+/**
+ * @brief Descriptor of single buffer binding within
+ * command buffer.
+ */
+struct VertexBufferBindingDescriptor
+{
+  const TestGraphicsBuffer* buffer{nullptr};
+  uint32_t            offset{0u};
+};
+
+/**
+ * @brief Descriptor of ix buffer binding within
+ * command buffer.
+ */
+struct IndexBufferBindingDescriptor
+{
+  const TestGraphicsBuffer* buffer{nullptr};
+  uint32_t            offset{};
+  Graphics::Format    format{};
+};
+
+/**
+ * @brief Descriptor of uniform buffer binding within
+ * command buffer.
+ */
+struct UniformBufferBindingDescriptor
+{
+  const TestGraphicsBuffer* buffer{nullptr};
+  uint32_t            binding{0u};
+  uint32_t            offset{0u};
+  bool                emulated; ///<true if UBO is emulated for old gfx API
+};
+
+/**
+ * @brief The descriptor of draw call
+ */
+struct DrawCallDescriptor
+{
+  /**
+   * @brief Enum specifying type of the draw call
+   */
+  enum class Type
+  {
+    DRAW,
+    DRAW_INDEXED,
+    DRAW_INDEXED_INDIRECT
+  };
+
+  Type type{}; ///< Type of the draw call
+
+  /**
+   * Union contains data for all types of draw calls.
+   */
+  union
+  {
+    /**
+     * @brief Vertex array draw
+     */
+    struct
+    {
+      uint32_t vertexCount;
+      uint32_t instanceCount;
+      uint32_t firstVertex;
+      uint32_t firstInstance;
+    } draw;
+
+    /**
+     * @brief Indexed draw
+     */
+    struct
+    {
+      uint32_t indexCount;
+      uint32_t instanceCount;
+      uint32_t firstIndex;
+      int32_t  vertexOffset;
+      uint32_t firstInstance;
+    } drawIndexed;
+
+    /**
+     * @brief Indexed draw indirect
+     */
+    struct
+    {
+      const TestGraphicsBuffer* buffer;
+      uint32_t            offset;
+      uint32_t            drawCount;
+      uint32_t            stride;
+    } drawIndexedIndirect;
+  };
+};
+
+/**
+ * Command structure allocates memory to store a single command
+ */
+struct Command
+{
+  Command()
+  {
+  }
+
+  ~Command()
+  {
+  }
+
+  /**
+   * @brief Copy constructor
+   * @param[in] rhs Command
+   */
+  Command(const Command& rhs)
+  {
+    switch(rhs.type)
+    {
+      case CommandType::BIND_VERTEX_BUFFERS:
+      {
+        bindVertexBuffers = rhs.bindVertexBuffers;
+        break;
+      }
+      case CommandType::BIND_INDEX_BUFFER:
+      {
+        bindIndexBuffer = rhs.bindIndexBuffer;
+        break;
+      }
+      case CommandType::BIND_SAMPLERS:
+      {
+        bindSamplers = rhs.bindSamplers;
+        break;
+      }
+      case CommandType::BIND_TEXTURES:
+      {
+        bindTextures = rhs.bindTextures;
+        break;
+      }
+      case CommandType::BIND_PIPELINE:
+      {
+        bindPipeline = rhs.bindPipeline;
+        break;
+      }
+      case CommandType::BIND_UNIFORM_BUFFER:
+      {
+        bindUniformBuffers = rhs.bindUniformBuffers;
+        break;
+      }
+      case CommandType::DRAW:
+      {
+        draw.type = rhs.draw.type;
+        draw.draw = rhs.draw.draw;
+        break;
+      }
+      case CommandType::DRAW_INDEXED:
+      {
+        draw.type        = rhs.draw.type;
+        draw.drawIndexed = rhs.draw.drawIndexed;
+        break;
+      }
+      case CommandType::DRAW_INDEXED_INDIRECT:
+      {
+        draw.type                = rhs.draw.type;
+        draw.drawIndexedIndirect = rhs.draw.drawIndexedIndirect;
+        break;
+      }
+      case CommandType::FLUSH:
+      {
+        // Nothing to do
+        break;
+      }
+    }
+    type = rhs.type;
+  }
+
+  /**
+   * @brief Copy constructor
+   * @param[in] rhs Command
+   */
+  Command(Command&& rhs) noexcept
+  {
+    switch(rhs.type)
+    {
+      case CommandType::BIND_VERTEX_BUFFERS:
+      {
+        bindVertexBuffers = std::move(rhs.bindVertexBuffers);
+        break;
+      }
+      case CommandType::BIND_INDEX_BUFFER:
+      {
+        bindIndexBuffer = rhs.bindIndexBuffer;
+        break;
+      }
+      case CommandType::BIND_UNIFORM_BUFFER:
+      {
+        bindUniformBuffers = std::move(rhs.bindUniformBuffers);
+        break;
+      }
+      case CommandType::BIND_SAMPLERS:
+      {
+        bindSamplers = std::move(rhs.bindSamplers);
+        break;
+      }
+      case CommandType::BIND_TEXTURES:
+      {
+        bindTextures = std::move(rhs.bindTextures);
+        break;
+      }
+      case CommandType::BIND_PIPELINE:
+      {
+        bindPipeline = rhs.bindPipeline;
+        break;
+      }
+      case CommandType::DRAW:
+      {
+        draw.type = rhs.draw.type;
+        draw.draw = rhs.draw.draw;
+        break;
+      }
+      case CommandType::DRAW_INDEXED:
+      {
+        draw.type        = rhs.draw.type;
+        draw.drawIndexed = rhs.draw.drawIndexed;
+        break;
+      }
+      case CommandType::DRAW_INDEXED_INDIRECT:
+      {
+        draw.type                = rhs.draw.type;
+        draw.drawIndexedIndirect = rhs.draw.drawIndexedIndirect;
+        break;
+      }
+      case CommandType::FLUSH:
+      {
+        // Nothing to do
+        break;
+      }
+    }
+    type = rhs.type;
+  }
+
+  CommandType type{CommandType::FLUSH}; ///< Type of command
+
+  union
+  {
+    struct
+    {
+      std::vector<Graphics::TextureBinding> textureBindings;
+    } bindTextures{};
+
+    // BindSampler command
+    struct
+    {
+      std::vector<Graphics::SamplerBinding> samplerBindings;
+    } bindSamplers;
+
+    struct
+    {
+      using Binding = VertexBufferBindingDescriptor;
+      std::vector<Binding> vertexBufferBindings;
+    } bindVertexBuffers;
+
+    struct : public IndexBufferBindingDescriptor
+    {
+    } bindIndexBuffer;
+
+    struct
+    {
+      std::vector<UniformBufferBindingDescriptor> uniformBufferBindings{};
+      UniformBufferBindingDescriptor              standaloneUniformsBufferBinding{};
+    } bindUniformBuffers;
+
+    struct
+    {
+      const TestGraphicsPipeline* pipeline{nullptr};
+    } bindPipeline;
+
+    struct : public DrawCallDescriptor
+    {
+    } draw;
+  };
+};
+
+
 class TestGraphicsCommandBuffer : public Graphics::CommandBuffer
 {
 public:
   TestGraphicsCommandBuffer(TraceCallStack& callstack, TestGlAbstraction& glAbstraction);
 class TestGraphicsCommandBuffer : public Graphics::CommandBuffer
 {
 public:
   TestGraphicsCommandBuffer(TraceCallStack& callstack, TestGlAbstraction& glAbstraction);
+  ~TestGraphicsCommandBuffer()
+  {
+
+  }
 
   void BindVertexBuffers(uint32_t                             firstBinding,
                          std::vector<const Graphics::Buffer*> buffers,
 
   void BindVertexBuffers(uint32_t                             firstBinding,
                          std::vector<const Graphics::Buffer*> buffers,
-                         std::vector<uint32_t>                offsets);
+                         std::vector<uint32_t>                offsets) override
+  {
+    mCommands.emplace_back();
+    mCommands.back().type = CommandType::BIND_VERTEX_BUFFERS;
+    auto& bindings        = mCommands.back().bindVertexBuffers.vertexBufferBindings;
+    if(bindings.size() < firstBinding + buffers.size())
+    {
+      bindings.resize(firstBinding + buffers.size());
+      auto index = firstBinding;
+      for(auto& buf : buffers)
+      {
+        bindings[index].buffer = static_cast<const TestGraphicsBuffer*>(buf);
+        bindings[index].offset = offsets[index - firstBinding];
+        index++;
+      }
+    }
+    mCallStack.PushCall("BindVertexBuffers", "");
+  }
 
 
-  void BindUniformBuffers(const std::vector<Graphics::UniformBufferBinding>& bindings);
+  void BindUniformBuffers(const std::vector<Graphics::UniformBufferBinding>& bindings) override
+  {
+    printf("BindUniformBuffers: bindings.size(): %lu\n", bindings.size());
 
 
-  void BindPipeline(const Graphics::Pipeline& pipeline);
+    mCommands.emplace_back();
+    auto& cmd     = mCommands.back();
+    cmd.type      = CommandType::BIND_UNIFORM_BUFFER;
+    auto& bindCmd = cmd.bindUniformBuffers;
+    for(const auto& binding : bindings)
+    {
+      if(binding.buffer)
+      {
+        auto testBuffer = static_cast<const TestGraphicsBuffer*>(binding.buffer);
+        if(testBuffer->IsCPUAllocated()) // standalone uniforms
+        {
+          bindCmd.standaloneUniformsBufferBinding.buffer   = testBuffer;
+          bindCmd.standaloneUniformsBufferBinding.offset   = binding.offset;
+          bindCmd.standaloneUniformsBufferBinding.binding  = binding.binding;
+          bindCmd.standaloneUniformsBufferBinding.emulated = true;
+        }
+        else // Bind regular UBO
+        {
+          // resize binding slots
+          if(binding.binding >= bindCmd.uniformBufferBindings.size())
+          {
+            bindCmd.uniformBufferBindings.resize(binding.binding + 1);
+          }
+          auto& slot    = bindCmd.uniformBufferBindings[binding.binding];
+          slot.buffer   = testBuffer;
+          slot.offset   = binding.offset;
+          slot.binding  = binding.binding;
+          slot.emulated = false;
+        }
+      }
+    }
+    mCallStack.PushCall("BindUniformBuffers", "");
+  }
 
 
-  void BindTextures(std::vector<Graphics::TextureBinding>& textureBindings);
+  void BindPipeline(const Graphics::Pipeline& pipeline) override
+  {
+    mCommands.emplace_back();
+    mCommands.back().type                  = CommandType::BIND_PIPELINE;
+    mCommands.back().bindPipeline.pipeline = static_cast<const TestGraphicsPipeline*>(&pipeline);
+    mCallStack.PushCall("BindPipeline", "");
+  }
 
 
-  void BindSamplers(std::vector<Graphics::SamplerBinding>& samplerBindings);
+  void BindTextures(std::vector<Graphics::TextureBinding>& textureBindings) override
+  {
+    mCommands.emplace_back();
+    mCommands.back().type                         = CommandType::BIND_TEXTURES;
+    mCommands.back().bindTextures.textureBindings = std::move(textureBindings);
+    mCallStack.PushCall("BindTextures", "");
+  }
+
+  void BindSamplers(std::vector<Graphics::SamplerBinding>& samplerBindings) override
+  {
+    mCommands.emplace_back();
+    mCommands.back().bindSamplers.samplerBindings = std::move(samplerBindings);
+    mCallStack.PushCall("BindSamplers", "");
+  }
 
   void BindPushConstants(void*    data,
                          uint32_t size,
 
   void BindPushConstants(void*    data,
                          uint32_t size,
-                         uint32_t binding);
+                         uint32_t binding) override
+  {
+    mCallStack.PushCall("BindPushConstants", "");
+  }
 
   void BindIndexBuffer(const Graphics::Buffer& buffer,
                        uint32_t                offset,
 
   void BindIndexBuffer(const Graphics::Buffer& buffer,
                        uint32_t                offset,
-                       Graphics::Format        format);
+                       Graphics::Format                  format) override
+  {
+    mCommands.emplace_back();
+    mCommands.back().type                   = CommandType::BIND_INDEX_BUFFER;
+    mCommands.back().bindIndexBuffer.buffer = static_cast<const TestGraphicsBuffer*>(&buffer);
+    mCommands.back().bindIndexBuffer.offset = offset;
+    mCommands.back().bindIndexBuffer.format = format;
+    mCallStack.PushCall("BindIndexBuffer", "");
+  }
 
 
-  void BeginRenderPass(Graphics::RenderPass&             renderPass,
-                       Graphics::RenderTarget&           renderTarget,
-                       Graphics::Extent2D                renderArea,
-                       std::vector<Graphics::ClearValue> clearValues);
+  void BeginRenderPass(
+    Graphics::RenderPass&   renderPass,
+    Graphics::RenderTarget& renderTarget,
+    Graphics::Extent2D                renderArea,
+    std::vector<Graphics::ClearValue> clearValues) override
+  {
+    mCallStack.PushCall("BeginRenderPass", "");
+  }
 
 
-  void EndRenderPass();
+  /**
+   * @brief Ends current render pass
+   *
+   * This command must be issued in order to finalize the render pass.
+   * It's up to the implementation whether anything has to be done but
+   * the Controller may use end RP marker in order to resolve resource
+   * dependencies (for example, to know when target texture is ready
+   * before passing it to another render pass).
+   */
+  void EndRenderPass() override
+  {
+    mCallStack.PushCall("EndRenderPass", "");
+  }
 
   void Draw(
     uint32_t vertexCount,
     uint32_t instanceCount,
     uint32_t firstVertex,
 
   void Draw(
     uint32_t vertexCount,
     uint32_t instanceCount,
     uint32_t firstVertex,
-    uint32_t firstInstance);
+    uint32_t firstInstance) override
+  {
+    mCommands.emplace_back();
+    mCommands.back().type  = CommandType::DRAW;
+    auto& cmd              = mCommands.back().draw;
+    cmd.type               = DrawCallDescriptor::Type::DRAW;
+    cmd.draw.vertexCount   = vertexCount;
+    cmd.draw.instanceCount = instanceCount;
+    cmd.draw.firstInstance = firstInstance;
+    cmd.draw.firstVertex   = firstVertex;
+    mCallStack.PushCall("Draw", "");
+  }
 
   void DrawIndexed(
     uint32_t indexCount,
     uint32_t instanceCount,
     uint32_t firstIndex,
     int32_t  vertexOffset,
 
   void DrawIndexed(
     uint32_t indexCount,
     uint32_t instanceCount,
     uint32_t firstIndex,
     int32_t  vertexOffset,
-    uint32_t firstInstance);
+    uint32_t firstInstance) override
+  {
+    mCommands.emplace_back();
+    mCommands.back().type         = CommandType::DRAW_INDEXED;
+    auto& cmd                     = mCommands.back().draw;
+    cmd.type                      = DrawCallDescriptor::Type::DRAW_INDEXED;
+    cmd.drawIndexed.firstIndex    = firstIndex;
+    cmd.drawIndexed.firstInstance = firstInstance;
+    cmd.drawIndexed.indexCount    = indexCount;
+    cmd.drawIndexed.vertexOffset  = vertexOffset;
+    cmd.drawIndexed.instanceCount = instanceCount;
+    mCallStack.PushCall("DrawIndexed", "");
+  }
 
   void DrawIndexedIndirect(
     Graphics::Buffer& buffer,
     uint32_t          offset,
     uint32_t          drawCount,
 
   void DrawIndexedIndirect(
     Graphics::Buffer& buffer,
     uint32_t          offset,
     uint32_t          drawCount,
-    uint32_t          stride);
-
-  void Reset(Graphics::CommandBuffer& commandBuffer);
-
-  void SetScissor(Graphics::Extent2D value);
-
-  void SetScissorTestEnable(bool value);
+    uint32_t          stride) override
+  {
+    mCommands.emplace_back();
+    mCommands.back().type             = CommandType::DRAW_INDEXED_INDIRECT;
+    auto& cmd                         = mCommands.back().draw;
+    cmd.type                          = DrawCallDescriptor::Type::DRAW_INDEXED_INDIRECT;
+    cmd.drawIndexedIndirect.buffer    = static_cast<const TestGraphicsBuffer*>(&buffer);
+    cmd.drawIndexedIndirect.offset    = offset;
+    cmd.drawIndexedIndirect.drawCount = drawCount;
+    cmd.drawIndexedIndirect.stride    = stride;
+    mCallStack.PushCall("DrawIndexedIndirect", "");
+  }
 
 
-  void SetViewport(Graphics::Viewport value);
+  void Reset() override
+  {
+    mCommands.clear();
+    mCallStack.PushCall("Reset", "");
+  }
 
 
-  void SetViewportEnable(bool value);
+  void SetScissor(Graphics::Extent2D value) override
+  {
+    mCallStack.PushCall("SetScissor", "");
+  }
 
 
-public:
-  TraceCallStack&                       mCallStack;
-  TestGlAbstraction&                    mGlAbstraction;
-  TestGraphicsPipeline*                 mPipeline{nullptr};
-  std::vector<Graphics::TextureBinding> mTextureBindings{};
+  void SetScissorTestEnable(bool value) override
+  {
+    mCallStack.PushCall("SetScissorTestEnable", "");
+  }
 
 
-  struct VertexBuffersBinding
+  void SetViewport(Graphics::Viewport value) override
   {
   {
-    uint32_t                             firstBinding;
-    std::vector<const Graphics::Buffer*> buffers;
-    std::vector<uint32_t>                offsets;
-  };
-  VertexBuffersBinding mVertexBufferBindings{};
+    mCallStack.PushCall("SetViewport", "");
+  }
 
 
-  struct IndexBufferBinding
+  void SetViewportEnable(bool value) override
   {
   {
-    const Graphics::Buffer* buffer;
-    uint32_t                offset;
-    Graphics::Format        format;
-  };
-  IndexBufferBinding mIndexBufferBinding{};
+    mCallStack.PushCall("SetViewportEnable", "");
+  }
 
 
-  struct Draw
+  [[nodiscard]] const std::vector<Command>& GetCommands() const
   {
   {
-    enum class DrawType
-    {
-      Indexed,
-      Unindexed
-    } drawType;
-    union
-    {
-      struct IndexedDraw
-      {
-        uint32_t indexCount;
-        uint32_t instanceCount;
-        uint32_t firstIndex;
-        int32_t  vertexOffset;
-        uint32_t firstInstance;
-      } indexedDraw;
-      struct UnindexedDraw
-      {
-        uint32_t vertexCount;
-        uint32_t instanceCount;
-        uint32_t firstVertex;
-        uint32_t firstInstance;
-      } unindexedDraw;
-    } u;
-  } drawCommand;
+    return mCommands;
+  }
+
+  /**
+   * Returns number of draw commands
+   * @return
+   */
+  int GetDrawCallsCount();
+
+  /**
+   * Retrieves state resolve for selected draw call
+   * @param drawCommandIndex
+   */
+  void GetStateForDrawCall( int drawCallIndex );
+
+  /**
+   * Retrieves commands of specified type
+   */
+  std::vector<Command*> GetCommandsByType( CommandTypeMask mask );
+
+
+private:
+  TraceCallStack&                       mCallStack;
+  TestGlAbstraction&                    mGlAbstraction;
+  std::vector<Command> mCommands;
 };
 
 } // namespace Dali
 };
 
 } // namespace Dali
index fe9c329..782835e 100644 (file)
@@ -458,121 +458,156 @@ void TestGraphicsController::SubmitCommandBuffers(const Graphics::SubmitInfo& su
   for(auto& graphicsCommandBuffer : submitInfo.cmdBuffer)
   {
     auto commandBuffer = Uncast<TestGraphicsCommandBuffer>(graphicsCommandBuffer);
   for(auto& graphicsCommandBuffer : submitInfo.cmdBuffer)
   {
     auto commandBuffer = Uncast<TestGraphicsCommandBuffer>(graphicsCommandBuffer);
-    for(auto& binding : commandBuffer->mTextureBindings)
+
+    auto value = commandBuffer->GetCommandsByType(0 | CommandType::BIND_TEXTURES);
+    if(!value.empty())
     {
     {
-      if(binding.texture)
+      // must be fixed
+      for (auto &binding : value[0]->bindTextures.textureBindings)
       {
       {
-        auto texture = Uncast<TestGraphicsTexture>(binding.texture);
+        if (binding.texture)
+        {
+          auto texture = Uncast<TestGraphicsTexture>(binding.texture);
 
 
-        texture->Bind(binding.binding);
+          texture->Bind(binding.binding);
 
 
-        if(binding.sampler)
-        {
-          auto sampler = Uncast<TestGraphicsSampler>(binding.sampler);
-          if(sampler)
+          if (binding.sampler)
           {
           {
-            sampler->Apply(texture->GetTarget());
+            auto sampler = Uncast<TestGraphicsSampler>(binding.sampler);
+            if (sampler)
+            {
+              sampler->Apply(texture->GetTarget());
+            }
           }
           }
-        }
 
 
-        texture->Prepare(); // Ensure native texture is ready
+          texture->Prepare(); // Ensure native texture is ready
+        }
       }
     }
 
     // IndexBuffer binding,
       }
     }
 
     // IndexBuffer binding,
-    auto& indexBufferBinding = commandBuffer->mIndexBufferBinding;
-    if(indexBufferBinding.buffer)
+    auto bindIndexBufferCmds = commandBuffer->GetCommandsByType(0 | CommandType::BIND_INDEX_BUFFER);
+    if (!bindIndexBufferCmds.empty())
     {
     {
-      auto buffer = Uncast<TestGraphicsBuffer>(indexBufferBinding.buffer);
-      buffer->Bind();
+      auto &indexBufferBinding = bindIndexBufferCmds[0]->bindIndexBuffer;
+      if (indexBufferBinding.buffer)
+      {
+        auto buffer = Uncast<TestGraphicsBuffer>(indexBufferBinding.buffer);
+        buffer->Bind();
+      }
     }
 
     // VertexBuffer binding,
     }
 
     // VertexBuffer binding,
-    for(auto graphicsBuffer : commandBuffer->mVertexBufferBindings.buffers)
+    auto bindVertexBufferCmds = commandBuffer->GetCommandsByType(0 | CommandType::BIND_VERTEX_BUFFERS);
+    if (!bindVertexBufferCmds.empty())
     {
     {
-      auto vertexBuffer = Uncast<TestGraphicsBuffer>(graphicsBuffer);
-      vertexBuffer->Bind();
+      for (auto &binding : bindVertexBufferCmds[0]->bindVertexBuffers.vertexBufferBindings)
+      {
+        auto graphicsBuffer = binding.buffer;
+        auto vertexBuffer   = Uncast<TestGraphicsBuffer>(graphicsBuffer);
+        vertexBuffer->Bind();
+      }
     }
     }
-
     // Pipeline attribute setup
     // Pipeline attribute setup
-    auto& vi = commandBuffer->mPipeline->vertexInputState;
-    for(auto& attribute : vi.attributes)
-    {
-      mGl.EnableVertexAttribArray(attribute.location);
-      uint32_t attributeOffset = attribute.offset;
-      GLsizei  stride          = vi.bufferBindings[attribute.binding].stride;
-
-      mGl.VertexAttribPointer(attribute.location,
-                              GetNumComponents(attribute.format),
-                              GetGlType(attribute.format),
-                              GL_FALSE, // Not normalized
-                              stride,
-                              reinterpret_cast<void*>(attributeOffset));
-    }
-
-    // Cull face setup
-    auto& rasterizationState = commandBuffer->mPipeline->rasterizationState;
-    if(rasterizationState.cullMode == Graphics::CullMode::NONE)
+    auto bindPipelineCmds     = commandBuffer->GetCommandsByType(0 | CommandType::BIND_PIPELINE);
+    if (!bindPipelineCmds.empty())
     {
     {
-      mGl.Disable(GL_CULL_FACE);
-    }
-    else
-    {
-      mGl.Enable(GL_CULL_FACE);
-      mGl.CullFace(GetCullFace(rasterizationState.cullMode));
-    }
-
-    mGl.FrontFace(GetFrontFace(rasterizationState.frontFace));
-    // We don't modify glPolygonMode in our context/abstraction from GL_FILL (the GL default),
-    // so it isn't present in the API (and won't have any tests!)
+      auto      pipeline = bindPipelineCmds[0]->bindPipeline.pipeline;
+      auto      &vi      = pipeline->vertexInputState;
+      for (auto &attribute : vi.attributes)
+      {
+        mGl.EnableVertexAttribArray(attribute.location);
+        uint32_t attributeOffset = attribute.offset;
+        GLsizei  stride          = vi.bufferBindings[attribute.binding].stride;
+
+        mGl.VertexAttribPointer(attribute.location,
+                                GetNumComponents(attribute.format),
+                                GetGlType(attribute.format),
+                                GL_FALSE, // Not normalized
+                                stride,
+                                reinterpret_cast<void *>(attributeOffset));
+      }
+      // Cull face setup
+      auto &rasterizationState = pipeline->rasterizationState;
+      if (rasterizationState.cullMode == Graphics::CullMode::NONE)
+      {
+        mGl.Disable(GL_CULL_FACE);
+      }
+      else
+      {
+        mGl.Enable(GL_CULL_FACE);
+        mGl.CullFace(GetCullFace(rasterizationState.cullMode));
+      }
 
 
-    // Blending setup
-    auto& colorBlendState = commandBuffer->mPipeline->colorBlendState;
-    if(colorBlendState.blendEnable)
-    {
-      mGl.Enable(GL_BLEND);
+      mGl.FrontFace(GetFrontFace(rasterizationState.frontFace));
+      // We don't modify glPolygonMode in our context/abstraction from GL_FILL (the GL default),
+      // so it isn't present in the API (and won't have any tests!)
 
 
-      mGl.BlendFuncSeparate(GetBlendFactor(colorBlendState.srcColorBlendFactor),
-                            GetBlendFactor(colorBlendState.dstColorBlendFactor),
-                            GetBlendFactor(colorBlendState.srcAlphaBlendFactor),
-                            GetBlendFactor(colorBlendState.dstAlphaBlendFactor));
-      if(colorBlendState.colorBlendOp != colorBlendState.alphaBlendOp)
+      // Blending setup
+      auto &colorBlendState = pipeline->colorBlendState;
+      if (colorBlendState.blendEnable)
       {
       {
-        mGl.BlendEquationSeparate(GetBlendOp(colorBlendState.colorBlendOp), GetBlendOp(colorBlendState.alphaBlendOp));
+        mGl.Enable(GL_BLEND);
+
+        mGl.BlendFuncSeparate(GetBlendFactor(colorBlendState.srcColorBlendFactor),
+                              GetBlendFactor(colorBlendState.dstColorBlendFactor),
+                              GetBlendFactor(colorBlendState.srcAlphaBlendFactor),
+                              GetBlendFactor(colorBlendState.dstAlphaBlendFactor));
+        if (colorBlendState.colorBlendOp != colorBlendState.alphaBlendOp)
+        {
+          mGl.BlendEquationSeparate(GetBlendOp(colorBlendState.colorBlendOp), GetBlendOp(colorBlendState.alphaBlendOp));
+        }
+        else
+        {
+          mGl.BlendEquation(GetBlendOp(colorBlendState.colorBlendOp));
+        }
+        mGl.BlendColor(colorBlendState.blendConstants[0],
+                       colorBlendState.blendConstants[1],
+                       colorBlendState.blendConstants[2],
+                       colorBlendState.blendConstants[3]);
       }
       else
       {
       }
       else
       {
-        mGl.BlendEquation(GetBlendOp(colorBlendState.colorBlendOp));
+        mGl.Disable(GL_BLEND);
       }
       }
-      mGl.BlendColor(colorBlendState.blendConstants[0],
-                     colorBlendState.blendConstants[1],
-                     colorBlendState.blendConstants[2],
-                     colorBlendState.blendConstants[3]);
-    }
-    else
-    {
-      mGl.Disable(GL_BLEND);
-    }
 
 
-    // draw call
-    auto topology = commandBuffer->mPipeline->inputAssemblyState.topology;
+      // draw call
+      auto topology = pipeline->inputAssemblyState.topology;
 
 
-    if(commandBuffer->drawCommand.drawType == TestGraphicsCommandBuffer::Draw::DrawType::Indexed)
-    {
-      mGl.DrawElements(GetTopology(topology),
-                       static_cast<GLsizei>(commandBuffer->drawCommand.u.indexedDraw.indexCount),
-                       GL_UNSIGNED_SHORT,
-                       reinterpret_cast<void*>(commandBuffer->drawCommand.u.indexedDraw.firstIndex));
-    }
-    else
-    {
-      mGl.DrawArrays(GetTopology(topology), 0, commandBuffer->drawCommand.u.unindexedDraw.vertexCount);
-    }
+      // UniformBuffer binding (once we know pipeline)
+      auto bindUniformBuffersCmds = commandBuffer->GetCommandsByType(0 | CommandType::BIND_UNIFORM_BUFFER);
+      if (!bindUniformBuffersCmds.empty())
+      {
+        auto buffer = bindUniformBuffersCmds[0]->bindUniformBuffers.standaloneUniformsBufferBinding;
 
 
-    // attribute clear
-    for(auto& attribute : vi.attributes)
-    {
-      mGl.DisableVertexAttribArray(attribute.location);
+        // based on reflection, issue gl calls
+        buffer.buffer->BindAsUniformBuffer( static_cast<const TestGraphicsProgram*>(pipeline->programState.program) );
+      }
+
+      auto drawCmds = commandBuffer->GetCommandsByType( 0 |
+        CommandType::DRAW |
+        CommandType::DRAW_INDEXED_INDIRECT |
+        CommandType::DRAW_INDEXED );
+
+      if(!drawCmds.empty())
+      {
+        if (drawCmds[0]->draw.type == DrawCallDescriptor::Type::DRAW_INDEXED )
+        {
+          mGl.DrawElements(GetTopology(topology),
+                           static_cast<GLsizei>(drawCmds[0]->draw.drawIndexed.indexCount),
+                           GL_UNSIGNED_SHORT,
+                           reinterpret_cast<void *>(drawCmds[0]->draw.drawIndexed.firstIndex));
+        }
+        else
+        {
+          mGl.DrawArrays(GetTopology(topology), 0, drawCmds[0]->draw.draw.vertexCount);
+        }
+      }
+      // attribute clear
+      for (auto &attribute : vi.attributes)
+      {
+        mGl.DisableVertexAttribArray(attribute.location);
+      }
     }
   }
 }
     }
   }
 }
@@ -737,7 +772,7 @@ Graphics::UniquePtr<Graphics::Program> TestGraphicsController::CreateProgram(con
   }
 
   mProgramCache.emplace_back();
   }
 
   mProgramCache.emplace_back();
-  mProgramCache.back().programImpl = new TestGraphicsProgramImpl(mGl, programCreateInfo, mVertexFormats);
+  mProgramCache.back().programImpl = new TestGraphicsProgramImpl(mGl, programCreateInfo, mVertexFormats, mCustomUniforms);
   for(auto& shader : *(programCreateInfo.shaderState))
   {
     auto graphicsShader                                = Uncast<TestGraphicsShader>(shader.shader);
   for(auto& shader : *(programCreateInfo.shaderState))
   {
     auto graphicsShader                                = Uncast<TestGraphicsShader>(shader.shader);
index fa2fd63..cbe78ec 100644 (file)
@@ -299,6 +299,11 @@ public: // Test Functions
     mVertexFormats = vfs;
   }
 
     mVertexFormats = vfs;
   }
 
+  void AddCustomUniforms(std::vector<UniformData>& customUniforms)
+  {
+    mCustomUniforms = customUniforms;
+  }
+
   void ClearSubmitStack()
   {
     mSubmitStack.clear();
   void ClearSubmitStack()
   {
     mSubmitStack.clear();
@@ -336,6 +341,8 @@ public:
     TestGraphicsProgramImpl*                       programImpl;
   };
   std::vector<ProgramCache> mProgramCache;
     TestGraphicsProgramImpl*                       programImpl;
   };
   std::vector<ProgramCache> mProgramCache;
+
+  std::vector<UniformData> mCustomUniforms;
 };
 
 } // namespace Dali
 };
 
 } // namespace Dali
index 9a0afa6..0bf698a 100644 (file)
 
 namespace Dali
 {
 
 namespace Dali
 {
-TestGraphicsProgramImpl::TestGraphicsProgramImpl(TestGlAbstraction& gl, const Graphics::ProgramCreateInfo& createInfo, Property::Array& vertexFormats)
+TestGraphicsProgramImpl::TestGraphicsProgramImpl(TestGlAbstraction& gl, const Graphics::ProgramCreateInfo& createInfo, Property::Array& vertexFormats, std::vector<UniformData>& customUniforms)
 : mGl(gl),
   mCreateInfo(createInfo),
 : mGl(gl),
   mCreateInfo(createInfo),
-  mReflection(gl, vertexFormats)
+  mReflection(gl, vertexFormats, createInfo, customUniforms)
 {
   mId = mGl.CreateProgram();
 {
   mId = mGl.CreateProgram();
-  mGl.LinkProgram(1); // Ensure active sampler uniforms are set
+
+  // Ensure active sampler uniforms are set
+  mGl.SetCustomUniforms(customUniforms);
+  mGl.LinkProgram(mId);
 }
 
 bool TestGraphicsProgramImpl::GetParameter(uint32_t parameterId, void* outData)
 }
 
 bool TestGraphicsProgramImpl::GetParameter(uint32_t parameterId, void* outData)
@@ -33,9 +36,9 @@ bool TestGraphicsProgramImpl::GetParameter(uint32_t parameterId, void* outData)
   return true;
 }
 
   return true;
 }
 
-TestGraphicsProgram::TestGraphicsProgram(TestGlAbstraction& gl, const Graphics::ProgramCreateInfo& createInfo, Property::Array& vertexFormats)
+TestGraphicsProgram::TestGraphicsProgram(TestGlAbstraction& gl, const Graphics::ProgramCreateInfo& createInfo, Property::Array& vertexFormats, std::vector<UniformData>& customUniforms)
 {
 {
-  mImpl = new TestGraphicsProgramImpl(gl, createInfo, vertexFormats);
+  mImpl = new TestGraphicsProgramImpl(gl, createInfo, vertexFormats, customUniforms);
 }
 
 TestGraphicsProgram::TestGraphicsProgram(TestGraphicsProgramImpl* impl)
 }
 
 TestGraphicsProgram::TestGraphicsProgram(TestGraphicsProgramImpl* impl)
index c098718..3aae276 100644 (file)
@@ -27,7 +27,7 @@ namespace Dali
 class TestGraphicsProgramImpl
 {
 public:
 class TestGraphicsProgramImpl
 {
 public:
-  TestGraphicsProgramImpl(TestGlAbstraction& gl, const Graphics::ProgramCreateInfo& createInfo, Property::Array& vertexFormats);
+  TestGraphicsProgramImpl(TestGlAbstraction& gl, const Graphics::ProgramCreateInfo& createInfo, Property::Array& vertexFormats, std::vector<UniformData>& customUniforms);
 
   // For API
   const TestGraphicsReflection& GetReflection() const
 
   // For API
   const TestGraphicsReflection& GetReflection() const
@@ -54,7 +54,7 @@ public:
 class TestGraphicsProgram : public Graphics::Program
 {
 public:
 class TestGraphicsProgram : public Graphics::Program
 {
 public:
-  TestGraphicsProgram(TestGlAbstraction& gl, const Graphics::ProgramCreateInfo& createInfo, Property::Array& vertexFormats);
+  TestGraphicsProgram(TestGlAbstraction& gl, const Graphics::ProgramCreateInfo& createInfo, Property::Array& vertexFormats, std::vector<UniformData>& customUniforms);
   TestGraphicsProgram(TestGraphicsProgramImpl* impl);
 
   const TestGraphicsReflection& GetReflection() const
   TestGraphicsProgram(TestGraphicsProgramImpl* impl);
 
   const TestGraphicsReflection& GetReflection() const
index c9ef2d0..883eb2d 100644 (file)
  */
 
 #include "test-graphics-reflection.h"
  */
 
 #include "test-graphics-reflection.h"
-#include <dali/public-api/object/property-map.h>
+#include "test-graphics-shader.h"
 
 
+#include <dali/public-api/object/property-map.h>
+#include <vector>
+#include <string>
 namespace Dali
 {
 namespace Dali
 {
-TestGraphicsReflection::TestGraphicsReflection(TestGlAbstraction& gl, Property::Array& vfs)
-: mGl(gl)
+namespace
+{
+static const std::vector<UniformData> UNIFORMS =
+{
+  UniformData("uRendererColor",Property::Type::FLOAT),
+  UniformData("uCustom", Property::Type::INTEGER),
+  UniformData("uCustom3", Property::Type::VECTOR3),
+  UniformData("uFadeColor", Property::Type::VECTOR4),
+  UniformData("uUniform1", Property::Type::VECTOR4),
+  UniformData("uUniform2", Property::Type::VECTOR4),
+  UniformData("uUniform3", Property::Type::VECTOR4),
+  UniformData("uFadeProgress", Property::Type::FLOAT),
+  UniformData("uANormalMatrix", Property::Type::MATRIX3),
+  UniformData("sEffect", Property::Type::FLOAT),
+  UniformData("sTexture", Property::Type::FLOAT),
+  UniformData("sTextureRect", Property::Type::FLOAT),
+  UniformData("sGloss", Property::Type::FLOAT),
+  UniformData("uColor", Property::Type::VECTOR4),
+  UniformData("uModelMatrix", Property::Type::MATRIX),
+  UniformData("uModelView", Property::Type::MATRIX),
+  UniformData("uMvpMatrix", Property::Type::MATRIX),
+  UniformData("uNormalMatrix", Property::Type::MATRIX3),
+  UniformData("uProjection", Property::Type::MATRIX),
+  UniformData("uSize", Property::Type::VECTOR3),
+  UniformData("uViewMatrix", Property::Type::MATRIX),
+  UniformData("uLightCameraProjectionMatrix", Property::Type::MATRIX),
+  UniformData("uLightCameraViewMatrix", Property::Type::MATRIX),
+};
+}
+
+TestGraphicsReflection::TestGraphicsReflection(TestGlAbstraction& gl, Property::Array& vfs, const Graphics::ProgramCreateInfo& createInfo, std::vector<UniformData>& customUniforms)
+  : mGl(gl),
+    mCustomUniforms(customUniforms)
 {
   for(Property::Array::SizeType i = 0; i < vfs.Count(); ++i)
   {
 {
   for(Property::Array::SizeType i = 0; i < vfs.Count(); ++i)
   {
@@ -37,6 +71,40 @@ TestGraphicsReflection::TestGraphicsReflection(TestGlAbstraction& gl, Property::
       }
     }
   }
       }
     }
   }
+
+  mDefaultUniformBlock.name = "";
+  mDefaultUniformBlock.members = {};
+  mDefaultUniformBlock.binding = 0;
+  mDefaultUniformBlock.size = 64 * (UNIFORMS.size() + mCustomUniforms.size());
+  mDefaultUniformBlock.descriptorSet = 0;
+  mDefaultUniformBlock.members.clear();
+  int loc = 0;
+  for( const auto& data : UNIFORMS )
+  {
+    mDefaultUniformBlock.members.emplace_back();
+    auto& item = mDefaultUniformBlock.members.back();
+    item.name = data.name;
+    item.binding = 0;
+    item.offset = loc*64;
+    item.location = loc++;
+    item.bufferIndex = 0;
+    item.uniformClass = Graphics::UniformClass::UNIFORM;
+  }
+
+  for( const auto& data : mCustomUniforms )
+  {
+    fprintf(stderr, "\ncustom uniforms: %s\n", data.name.c_str());
+    mDefaultUniformBlock.members.emplace_back();
+    auto& item = mDefaultUniformBlock.members.back();
+    item.name = data.name;
+    item.binding = 0;
+    item.offset = loc*64;
+    item.location = loc++;
+    item.bufferIndex = 0;
+    item.uniformClass = Graphics::UniformClass::UNIFORM;
+  }
+
+  mUniformBlocks.push_back(mDefaultUniformBlock);
 }
 
 uint32_t TestGraphicsReflection::GetVertexAttributeLocation(const std::string& name) const
 }
 
 uint32_t TestGraphicsReflection::GetVertexAttributeLocation(const std::string& name) const
@@ -78,7 +146,7 @@ std::vector<uint32_t> TestGraphicsReflection::GetVertexAttributeLocations() cons
 
 uint32_t TestGraphicsReflection::GetUniformBlockCount() const
 {
 
 uint32_t TestGraphicsReflection::GetUniformBlockCount() const
 {
-  return 0u;
+  return mUniformBlocks.size();
 }
 
 uint32_t TestGraphicsReflection::GetUniformBlockBinding(uint32_t index) const
 }
 
 uint32_t TestGraphicsReflection::GetUniformBlockBinding(uint32_t index) const
@@ -88,11 +156,36 @@ uint32_t TestGraphicsReflection::GetUniformBlockBinding(uint32_t index) const
 
 uint32_t TestGraphicsReflection::GetUniformBlockSize(uint32_t index) const
 {
 
 uint32_t TestGraphicsReflection::GetUniformBlockSize(uint32_t index) const
 {
-  return 0u;
+  // 64 bytes per uniform (64 = 4x4 matrix)
+  // TODO: fix if array will be used
+  return 64 * (UNIFORMS.size() + mCustomUniforms.size());
 }
 
 bool TestGraphicsReflection::GetUniformBlock(uint32_t index, Dali::Graphics::UniformBlockInfo& out) const
 {
 }
 
 bool TestGraphicsReflection::GetUniformBlock(uint32_t index, Dali::Graphics::UniformBlockInfo& out) const
 {
+  if(index >= mUniformBlocks.size())
+  {
+    return false;
+  }
+
+  const auto& block = mUniformBlocks[index];
+
+  out.name          = block.name;
+  out.binding       = block.binding;
+  out.descriptorSet = block.descriptorSet;
+  auto membersSize  = block.members.size();
+  out.members.resize(membersSize);
+  out.size = block.size;
+  for(auto i = 0u; i < out.members.size(); ++i)
+  {
+    const auto& memberUniform   = block.members[i];
+    out.members[i].name         = memberUniform.name;
+    out.members[i].binding      = block.binding;
+    out.members[i].uniformClass = Graphics::UniformClass::UNIFORM;
+    out.members[i].offset       = memberUniform.offset;
+    out.members[i].location     = memberUniform.location;
+  }
+
   return true;
 }
 
   return true;
 }
 
@@ -108,17 +201,38 @@ std::string TestGraphicsReflection::GetUniformBlockName(uint32_t blockIndex) con
 
 uint32_t TestGraphicsReflection::GetUniformBlockMemberCount(uint32_t blockIndex) const
 {
 
 uint32_t TestGraphicsReflection::GetUniformBlockMemberCount(uint32_t blockIndex) const
 {
-  return 0u;
+  if(blockIndex < mUniformBlocks.size())
+  {
+    return static_cast<uint32_t>(mUniformBlocks[blockIndex].members.size());
+  }
+  else
+  {
+    return 0u;
+  }
 }
 
 std::string TestGraphicsReflection::GetUniformBlockMemberName(uint32_t blockIndex, uint32_t memberLocation) const
 {
 }
 
 std::string TestGraphicsReflection::GetUniformBlockMemberName(uint32_t blockIndex, uint32_t memberLocation) const
 {
-  return std::string{};
+  if(blockIndex < mUniformBlocks.size() && memberLocation < mUniformBlocks[blockIndex].members.size())
+  {
+    return mUniformBlocks[blockIndex].members[memberLocation].name;
+  }
+  else
+  {
+    return std::string();
+  }
 }
 
 uint32_t TestGraphicsReflection::GetUniformBlockMemberOffset(uint32_t blockIndex, uint32_t memberLocation) const
 {
 }
 
 uint32_t TestGraphicsReflection::GetUniformBlockMemberOffset(uint32_t blockIndex, uint32_t memberLocation) const
 {
-  return 0u;
+  if(blockIndex < mUniformBlocks.size() && memberLocation < mUniformBlocks[blockIndex].members.size())
+  {
+    return mUniformBlocks[blockIndex].members[memberLocation].offset;
+  }
+  else
+  {
+    return 0u;
+  }
 }
 
 bool TestGraphicsReflection::GetNamedUniform(const std::string& name, Dali::Graphics::UniformInfo& out) const
 }
 
 bool TestGraphicsReflection::GetNamedUniform(const std::string& name, Dali::Graphics::UniformInfo& out) const
@@ -136,4 +250,9 @@ Graphics::ShaderLanguage TestGraphicsReflection::GetLanguage() const
   return Graphics::ShaderLanguage::GLSL_3_1;
 }
 
   return Graphics::ShaderLanguage::GLSL_3_1;
 }
 
+Dali::Property::Type TestGraphicsReflection::GetMemberType( int blockIndex, int location) const
+{
+  return location < static_cast<int>(UNIFORMS.size()) ? UNIFORMS[location].type : mCustomUniforms[location - UNIFORMS.size()].type;
+}
+
 } // namespace Dali
 } // namespace Dali
index 9311e07..9e71989 100644 (file)
  */
 
 #include <dali/graphics-api/graphics-reflection.h>
  */
 
 #include <dali/graphics-api/graphics-reflection.h>
+#include <dali/graphics-api/graphics-program-create-info.h>
 #include "test-gl-abstraction.h"
 
 namespace Dali
 {
 #include "test-gl-abstraction.h"
 
 namespace Dali
 {
+
 class TestGraphicsReflection : public Graphics::Reflection
 {
 public:
 class TestGraphicsReflection : public Graphics::Reflection
 {
 public:
-  TestGraphicsReflection(TestGlAbstraction& gl, Property::Array& vertexFormats);
+  TestGraphicsReflection(TestGlAbstraction& gl, Property::Array& vertexFormats, const Graphics::ProgramCreateInfo& createInfo, std::vector<UniformData>& customUniforms);
 
   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;
@@ -55,8 +57,14 @@ public: // Test methods
     }
   }
 
     }
   }
 
+  Dali::Property::Type GetMemberType( int blockIndex, int location) const;
+
   TestGlAbstraction&               mGl;
   mutable std::vector<std::string> mAttributes;
   TestGlAbstraction&               mGl;
   mutable std::vector<std::string> mAttributes;
+  std::vector<UniformData>         mCustomUniforms;
+
+  Graphics::UniformBlockInfo              mDefaultUniformBlock{};       ///< The emulated UBO containing all the standalone uniforms
+  std::vector<Graphics::UniformBlockInfo> mUniformBlocks{};             ///< List of uniform blocks
 };
 
 } // namespace Dali
 };
 
 } // namespace Dali
index 0bde103..583ce16 100644 (file)
@@ -249,6 +249,16 @@ int UtcDaliArcVisualUpdateProperty(void)
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliArcVisualUpdateProperty" );
 
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliArcVisualUpdateProperty" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("thickness", Property::Type::FLOAT),
+    UniformData("startAngle", Property::Type::FLOAT),
+    UniformData("sweepAngle", Property::Type::FLOAT),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   TestGlAbstraction& gl = application.GetGlAbstraction();
 
   float thickness = 20.0f;
   TestGlAbstraction& gl = application.GetGlAbstraction();
 
   float thickness = 20.0f;
index b5a0d5f..7fa50ed 100644 (file)
@@ -193,6 +193,14 @@ int UtcDaliBubbleEmitterSetBubbleScale(void)
   ToolkitTestApplication application;
   tet_infoline( " UtcDaliBubbleEmitterSetBubbleScale " );
 
   ToolkitTestApplication application;
   tet_infoline( " UtcDaliBubbleEmitterSetBubbleScale " );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uDynamicScale", Property::Type::FLOAT),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   Texture shapeImage = CreateSolidColorTexture( application, Color::GREEN, 5, 5 );
   BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 150, Vector2( 5.f, 10.f ));
   DALI_TEST_CHECK(emitter);
   Texture shapeImage = CreateSolidColorTexture( application, Color::GREEN, 5, 5 );
   BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 150, Vector2( 5.f, 10.f ));
   DALI_TEST_CHECK(emitter);
@@ -313,9 +321,19 @@ int UtcDaliBubbleEmitterEmitBubble(void)
 
 int UtcDaliBubbleEmitterRestore(void)
 {
 
 int UtcDaliBubbleEmitterRestore(void)
 {
+#ifdef OLD_GRAPHICS_TEST
   ToolkitTestApplication application;
   tet_infoline( " UtcDaliBubbleEmitterRestore " );
 
   ToolkitTestApplication application;
   tet_infoline( " UtcDaliBubbleEmitterRestore " );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uPercentage[0]", Property::Type::FLOAT),
+    UniformData("uStartEndPosition[0]", Property::Type::VECTOR4),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   Vector2 movementArea(50.f,50.f);
   Texture shapeImage = CreateSolidColorTexture( application, Color::GREEN, 5, 5 );
   BubbleEmitter emitter = BubbleEmitter::New( movementArea,shapeImage, 90, Vector2( 5.f, 10.f ));
   Vector2 movementArea(50.f,50.f);
   Texture shapeImage = CreateSolidColorTexture( application, Color::GREEN, 5, 5 );
   BubbleEmitter emitter = BubbleEmitter::New( movementArea,shapeImage, 90, Vector2( 5.f, 10.f ));
@@ -365,6 +383,9 @@ int UtcDaliBubbleEmitterRestore(void)
 
   DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uStartEndPosition[0]", startEndPosValue ) );
   DALI_TEST_EQUALS( startEndPosValue,  Vector4::ZERO, TEST_LOCATION );
 
   DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uStartEndPosition[0]", startEndPosValue ) );
   DALI_TEST_EQUALS( startEndPosValue,  Vector4::ZERO, TEST_LOCATION );
+#else
+  tet_result(TET_PASS);
+#endif
 
   END_TEST;
 }
 
   END_TEST;
 }
index c12f8cc..29faa6d 100644 (file)
@@ -446,6 +446,14 @@ int UtcDaliImageViewPixelArea(void)
   // Test pixel area property
   ToolkitTestApplication application;
 
   // Test pixel area property
   ToolkitTestApplication application;
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("pixelArea", Property::Type::VECTOR4),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   // Gif image, use AnimatedImageVisual internally
   // Atlasing is applied to pack multiple frames, use custom wrap mode
   ImageView gifView = ImageView::New();
   // Gif image, use AnimatedImageVisual internally
   // Atlasing is applied to pack multiple frames, use custom wrap mode
   ImageView gifView = ImageView::New();
index 4ffeeef..e9bd76e 100644 (file)
@@ -575,6 +575,15 @@ int UtcDaliImageVisualCustomWrapModePixelArea(void)
   ToolkitTestApplication application;
   tet_infoline( "Request image visual with a Property::Map, test custom wrap mode and pixel area with atlasing" );
 
   ToolkitTestApplication application;
   tet_infoline( "Request image visual with a Property::Map, test custom wrap mode and pixel area with atlasing" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("pixelArea", Property::Type::VECTOR4),
+    UniformData("wrapMode", Property::Type::VECTOR2),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   VisualFactory factory = VisualFactory::Get();
   DALI_TEST_CHECK( factory );
 
   VisualFactory factory = VisualFactory::Get();
   DALI_TEST_CHECK( factory );
 
@@ -654,6 +663,14 @@ int UtcDaliImageVisualCustomWrapModeNoAtlas(void)
   ToolkitTestApplication application;
   tet_infoline( "Request image visual with a Property::Map, test custom wrap mode and pixel area without atlasing" );
 
   ToolkitTestApplication application;
   tet_infoline( "Request image visual with a Property::Map, test custom wrap mode and pixel area without atlasing" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("pixelArea", Property::Type::VECTOR4),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   VisualFactory factory = VisualFactory::Get();
   DALI_TEST_CHECK( factory );
 
   VisualFactory factory = VisualFactory::Get();
   DALI_TEST_CHECK( factory );
 
@@ -731,6 +748,14 @@ int UtcDaliImageVisualAnimateMixColor(void)
   ToolkitTestApplication application;
   tet_infoline( "Animate mix color" );
 
   ToolkitTestApplication application;
   tet_infoline( "Animate mix color" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("mixColor", Property::Type::VECTOR3),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   application.GetPlatform().SetClosestImageSize( Vector2(100, 100) );
 
   VisualFactory factory = VisualFactory::Get();
   application.GetPlatform().SetClosestImageSize( Vector2(100, 100) );
 
   VisualFactory factory = VisualFactory::Get();
@@ -1040,6 +1065,14 @@ int UtcDaliImageVisualAnimatePixelArea(void)
   ToolkitTestApplication application;
   tet_infoline( "ImageVisual animate pixel area" );
 
   ToolkitTestApplication application;
   tet_infoline( "ImageVisual animate pixel area" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("pixelArea", Property::Type::VECTOR4),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   application.GetPlatform().SetClosestImageSize( Vector2(100, 100) );
 
   VisualFactory factory = VisualFactory::Get();
   application.GetPlatform().SetClosestImageSize( Vector2(100, 100) );
 
   VisualFactory factory = VisualFactory::Get();
index 0f5f410..a9a2ed2 100644 (file)
@@ -1745,6 +1745,15 @@ int UtcDaliVisualAnimateBorderVisual01(void)
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliAnimateBorderVisual Color" );
 
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliAnimateBorderVisual Color" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("borderColor", Property::Type::VECTOR4),
+    UniformData("mixColor", Property::Type::VECTOR3),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   VisualFactory factory = VisualFactory::Get();
   Property::Map propertyMap;
   propertyMap.Insert(Visual::Property::TYPE,  Visual::BORDER);
   VisualFactory factory = VisualFactory::Get();
   Property::Map propertyMap;
   propertyMap.Insert(Visual::Property::TYPE,  Visual::BORDER);
@@ -1826,6 +1835,14 @@ int UtcDaliVisualAnimateBorderVisual02(void)
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliAnimateBorderVisual Size" );
 
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliAnimateBorderVisual Size" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("borderSize", Property::Type::FLOAT),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   VisualFactory factory = VisualFactory::Get();
   Property::Map propertyMap;
   propertyMap.Insert(Visual::Property::TYPE,  Visual::BORDER);
   VisualFactory factory = VisualFactory::Get();
   Property::Map propertyMap;
   propertyMap.Insert(Visual::Property::TYPE,  Visual::BORDER);
@@ -1871,6 +1888,14 @@ int UtcDaliVisualAnimateColorVisual(void)
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliAnimateColorVisual mixColor" );
 
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliAnimateColorVisual mixColor" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("mixColor", Property::Type::VECTOR3),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   VisualFactory factory = VisualFactory::Get();
   Property::Map propertyMap;
   propertyMap.Insert(Visual::Property::TYPE,  Visual::COLOR);
   VisualFactory factory = VisualFactory::Get();
   Property::Map propertyMap;
   propertyMap.Insert(Visual::Property::TYPE,  Visual::COLOR);
@@ -1924,6 +1949,14 @@ int UtcDaliVisualAnimatePrimitiveVisual(void)
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliAnimatePrimitiveVisual color" );
 
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliAnimatePrimitiveVisual color" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("mixColor", Property::Type::VECTOR3),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   {
     VisualFactory factory = VisualFactory::Get();
     Property::Map propertyMap;
   {
     VisualFactory factory = VisualFactory::Get();
     Property::Map propertyMap;
@@ -2007,6 +2040,20 @@ int UtcDaliVisualAnimatedGradientVisual01(void)
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliAnimatedGradientVisual with default" );
 
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliAnimatedGradientVisual with default" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("start_point", Property::Type::VECTOR2),
+    UniformData("end_point", Property::Type::VECTOR2),
+    UniformData("start_color", Property::Type::VECTOR4),
+    UniformData("end_color", Property::Type::VECTOR4),
+    UniformData("rotate_center", Property::Type::VECTOR2),
+    UniformData("rotate_angle", Property::Type::FLOAT),
+    UniformData("gradient_offset", Property::Type::FLOAT),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   {
     VisualFactory factory = VisualFactory::Get();
     Property::Map propertyMap;
   {
     VisualFactory factory = VisualFactory::Get();
     Property::Map propertyMap;
@@ -2064,6 +2111,20 @@ int UtcDaliVisualAnimatedGradientVisual02(void)
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliAnimatedGradientVisual with full-option" );
 
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliAnimatedGradientVisual with full-option" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("start_point", Property::Type::VECTOR2),
+    UniformData("end_point", Property::Type::VECTOR2),
+    UniformData("start_color", Property::Type::VECTOR4),
+    UniformData("end_color", Property::Type::VECTOR4),
+    UniformData("rotate_center", Property::Type::VECTOR2),
+    UniformData("rotate_angle", Property::Type::FLOAT),
+    UniformData("gradient_offset", Property::Type::FLOAT),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   {
     float _delay[4] = {0.0f, -1.35f, 0.15f, -0.4f}; // fract(_delay) must NOT be 1/4, 2/4, 3/4. cause we don't know progress is 1.0f or 0.0f
     int _direction[2] = {0, 1};
   {
     float _delay[4] = {0.0f, -1.35f, 0.15f, -0.4f}; // fract(_delay) must NOT be 1/4, 2/4, 3/4. cause we don't know progress is 1.0f or 0.0f
     int _direction[2] = {0, 1};
@@ -2342,6 +2403,20 @@ int UtcDaliVisualAnimatedGradientVisual03(void)
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliAnimatedGradientVisual with full-option use string key" );
 
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliAnimatedGradientVisual with full-option use string key" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("start_point", Property::Type::VECTOR2),
+    UniformData("end_point", Property::Type::VECTOR2),
+    UniformData("start_color", Property::Type::VECTOR4),
+    UniformData("end_color", Property::Type::VECTOR4),
+    UniformData("rotate_center", Property::Type::VECTOR2),
+    UniformData("rotate_angle", Property::Type::FLOAT),
+    UniformData("gradient_offset", Property::Type::FLOAT),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   {
     float _delay[4] = {0.0f, -1.35f, 0.15f, -0.4f}; // fract(_delay) must NOT be 1/4, 2/4, 3/4. cause we don't know progress is 1.0f or 0.0f
     int _direction[2] = {0, 1};
   {
     float _delay[4] = {0.0f, -1.35f, 0.15f, -0.4f}; // fract(_delay) must NOT be 1/4, 2/4, 3/4. cause we don't know progress is 1.0f or 0.0f
     int _direction[2] = {0, 1};
@@ -3584,9 +3659,19 @@ int UtcDaliSvgVisualCustomShader(void)
 
 int UtcDaliVisualRoundedCorner(void)
 {
 
 int UtcDaliVisualRoundedCorner(void)
 {
+#ifdef OLD_GRAPHICS_TEST
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualRoundedCorner" );
 
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualRoundedCorner" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("cornerRadius", Property::Type::FLOAT),
+    UniformData("cornerRadiusPolicy", Property::Type::FLOAT),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   // image visual
   {
     VisualFactory factory = VisualFactory::Get();
   // image visual
   {
     VisualFactory factory = VisualFactory::Get();
@@ -3867,7 +3952,9 @@ int UtcDaliVisualRoundedCorner(void)
     DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue< float >( "cornerRadius", cornerRadius ), true, TEST_LOCATION );
     DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue< float >( "cornerRadiusPolicy", Toolkit::Visual::Transform::Policy::RELATIVE ), true, TEST_LOCATION );
   }
     DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue< float >( "cornerRadius", cornerRadius ), true, TEST_LOCATION );
     DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue< float >( "cornerRadiusPolicy", Toolkit::Visual::Transform::Policy::RELATIVE ), true, TEST_LOCATION );
   }
-
+#else
+  tet_result(TET_PASS);
+#endif
 
   END_TEST;
 }
 
   END_TEST;
 }
@@ -3877,6 +3964,14 @@ int UtcDaliColorVisualBlurRadius(void)
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliColorVisualBlurRadius" );
 
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliColorVisualBlurRadius" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("blurRadius", Property::Type::FLOAT),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   VisualFactory factory = VisualFactory::Get();
   Property::Map properties;
   float blurRadius = 20.0f;
   VisualFactory factory = VisualFactory::Get();
   Property::Map properties;
   float blurRadius = 20.0f;
@@ -4048,6 +4143,18 @@ int UtcDaliVisualGetVisualProperty01(void)
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualGetVisualProperty01: Test animatable property, Visual::Base, ColorVisual" );
 
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualGetVisualProperty01: Test animatable property, Visual::Base, ColorVisual" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("mixColor", Property::Type::VECTOR3),
+    UniformData("offset", Property::Type::VECTOR2),
+    UniformData("size", Property::Type::VECTOR2),
+    UniformData("cornerRadius", Property::Type::FLOAT),
+    UniformData("blurRadius", Property::Type::FLOAT),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   VisualFactory factory = VisualFactory::Get();
   Property::Map propertyMap;
   propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
   VisualFactory factory = VisualFactory::Get();
   Property::Map propertyMap;
   propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
@@ -4141,9 +4248,22 @@ int UtcDaliVisualGetVisualProperty01(void)
 
 int UtcDaliVisualGetVisualProperty02(void)
 {
 
 int UtcDaliVisualGetVisualProperty02(void)
 {
+#ifdef OLD_GRAPHICS_TEST
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualGetVisualProperty02: Test animatable property" );
 
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualGetVisualProperty02: Test animatable property" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("mixColor", Property::Type::VECTOR3),
+    UniformData("offset", Property::Type::VECTOR2),
+    UniformData("size", Property::Type::VECTOR2),
+    UniformData("cornerRadius", Property::Type::FLOAT),
+    UniformData("blurRadius", Property::Type::FLOAT),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   VisualFactory factory = VisualFactory::Get();
   Property::Map propertyMap;
   propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
   VisualFactory factory = VisualFactory::Get();
   Property::Map propertyMap;
   propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
@@ -4213,15 +4333,27 @@ int UtcDaliVisualGetVisualProperty02(void)
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector2>("size", targetSize), true, TEST_LOCATION);
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<float>("cornerRadius", targetCornerRadius), true, TEST_LOCATION);
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<float>("blurRadius", targetBlurRadius), true, TEST_LOCATION);
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector2>("size", targetSize), true, TEST_LOCATION);
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<float>("cornerRadius", targetCornerRadius), true, TEST_LOCATION);
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<float>("blurRadius", targetBlurRadius), true, TEST_LOCATION);
+#else
+  tet_result(TET_PASS);
+#endif
 
   END_TEST;
 }
 
 int UtcDaliVisualGetVisualProperty03(void)
 {
 
   END_TEST;
 }
 
 int UtcDaliVisualGetVisualProperty03(void)
 {
+#ifdef OLD_GRAPHICS_TEST
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualGetVisualProperty01: Test animatable property, ImageVisual" );
 
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualGetVisualProperty01: Test animatable property, ImageVisual" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("cornerRadius", Property::Type::FLOAT),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   VisualFactory factory = VisualFactory::Get();
   Property::Map propertyMap;
   propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE);
   VisualFactory factory = VisualFactory::Get();
   Property::Map propertyMap;
   propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE);
@@ -4266,15 +4398,27 @@ int UtcDaliVisualGetVisualProperty03(void)
 
   // Test uniform value
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<float>("cornerRadius", targetCornerRadius), true, TEST_LOCATION);
 
   // Test uniform value
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<float>("cornerRadius", targetCornerRadius), true, TEST_LOCATION);
+#else
+  tet_result(TET_PASS);
+#endif
 
   END_TEST;
 }
 
 int UtcDaliVisualGetVisualProperty04(void)
 {
 
   END_TEST;
 }
 
 int UtcDaliVisualGetVisualProperty04(void)
 {
+#ifdef OLD_GRAPHICS_TEST
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualGetVisualProperty01: Test animatable property, GradientVisual" );
 
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualGetVisualProperty01: Test animatable property, GradientVisual" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("cornerRadius", Property::Type::FLOAT),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   Vector2 start(-1.f, -1.f);
   Vector2 end(1.f, 1.f);
   Property::Array stopColors;
   Vector2 start(-1.f, -1.f);
   Vector2 end(1.f, 1.f);
   Property::Array stopColors;
@@ -4326,6 +4470,9 @@ int UtcDaliVisualGetVisualProperty04(void)
 
   // Test uniform value
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<float>("cornerRadius", targetCornerRadius), true, TEST_LOCATION);
 
   // Test uniform value
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<float>("cornerRadius", targetCornerRadius), true, TEST_LOCATION);
+#else
+  tet_result(TET_PASS);
+#endif
 
   END_TEST;
 }
 
   END_TEST;
 }
index 929825c..0b7704c 100644 (file)
@@ -181,6 +181,14 @@ int UtcDaliVisualFactoryGetColorVisual1(void)
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualFactoryGetColorVisual1:  Request color visual with a Property::Map" );
 
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualFactoryGetColorVisual1:  Request color visual with a Property::Map" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("mixColor", Property::Type::VECTOR3),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   VisualFactory factory = VisualFactory::Get();
   DALI_TEST_CHECK( factory );
 
   VisualFactory factory = VisualFactory::Get();
   DALI_TEST_CHECK( factory );
 
@@ -211,6 +219,14 @@ int UtcDaliVisualFactoryGetColorVisual2(void)
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualFactoryGetColorVisual2: Request color visual with a Vector4" );
 
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualFactoryGetColorVisual2: Request color visual with a Vector4" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("mixColor", Property::Type::VECTOR3),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   VisualFactory factory = VisualFactory::Get();
   DALI_TEST_CHECK( factory );
 
   VisualFactory factory = VisualFactory::Get();
   DALI_TEST_CHECK( factory );
 
@@ -243,6 +259,15 @@ int UtcDaliVisualFactoryGetBorderVisual1(void)
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualFactoryGetBorderVisual1:  Request border visual with a Property::Map" );
 
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualFactoryGetBorderVisual1:  Request border visual with a Property::Map" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("borderColor", Property::Type::VECTOR4),
+    UniformData("borderSize", Property::Type::FLOAT),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   VisualFactory factory = VisualFactory::Get();
   DALI_TEST_CHECK( factory );
 
   VisualFactory factory = VisualFactory::Get();
   DALI_TEST_CHECK( factory );
 
@@ -291,6 +316,15 @@ int UtcDaliVisualFactoryGetBorderVisual2(void)
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualFactoryGetBorderVisual2:  Request border visual with a borderSize and a borderColor" );
 
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualFactoryGetBorderVisual2:  Request border visual with a borderSize and a borderColor" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("borderColor", Property::Type::VECTOR4),
+    UniformData("borderSize", Property::Type::FLOAT),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   VisualFactory factory = VisualFactory::Get();
   DALI_TEST_CHECK( factory );
 
   VisualFactory factory = VisualFactory::Get();
   DALI_TEST_CHECK( factory );
 
@@ -353,6 +387,14 @@ int UtcDaliVisualFactoryGetLinearGradientVisual(void)
   ToolkitTestApplication application;
   tet_infoline("UtcDaliVisualFactoryGetRadialGradientVisual");
 
   ToolkitTestApplication application;
   tet_infoline("UtcDaliVisualFactoryGetRadialGradientVisual");
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uAlignmentMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   VisualFactory factory = VisualFactory::Get();
   DALI_TEST_CHECK( factory );
 
   VisualFactory factory = VisualFactory::Get();
   DALI_TEST_CHECK( factory );
 
@@ -390,6 +432,14 @@ int UtcDaliVisualFactoryGetRadialGradientVisual(void)
   ToolkitTestApplication application;
   tet_infoline("UtcDaliVisualFactoryGetRadialGradientVisual");
 
   ToolkitTestApplication application;
   tet_infoline("UtcDaliVisualFactoryGetRadialGradientVisual");
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uAlignmentMatrix", Property::Type::MATRIX3),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   VisualFactory factory = VisualFactory::Get();
   DALI_TEST_CHECK( factory );
 
   VisualFactory factory = VisualFactory::Get();
   DALI_TEST_CHECK( factory );
 
@@ -1420,6 +1470,13 @@ int UtcDaliVisualFactoryGetMeshVisual1(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetMeshVisual1:  Request mesh visual with a valid object file only" );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetMeshVisual1:  Request mesh visual with a valid object file only" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
 
   //Set up visual properties.
   Property::Map propertyMap;
 
   //Set up visual properties.
   Property::Map propertyMap;
@@ -1441,6 +1498,14 @@ int UtcDaliVisualFactoryGetMeshVisual2(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetMeshVisual2:  Request mesh visual with blank material file and images directory" );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetMeshVisual2:  Request mesh visual with blank material file and images directory" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::MESH );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::MESH );
@@ -1462,6 +1527,14 @@ int UtcDaliVisualFactoryGetMeshVisual3b(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetMeshVisual3:  Request mesh visual with all parameters correct" );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetMeshVisual3:  Request mesh visual with all parameters correct" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::MESH );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::MESH );
@@ -1486,6 +1559,14 @@ int UtcDaliVisualFactoryGetMeshVisual3(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetMeshVisual3:  Request mesh visual with all parameters correct" );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetMeshVisual3:  Request mesh visual with all parameters correct" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::MESH );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::MESH );
@@ -1510,6 +1591,13 @@ int UtcDaliVisualFactoryGetMeshVisual4(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetMeshVisual4:  Request mesh visual with diffuse texture but not normal or gloss." );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetMeshVisual4:  Request mesh visual with diffuse texture but not normal or gloss." );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
 
   //Set up visual properties.
   Property::Map propertyMap;
 
   //Set up visual properties.
   Property::Map propertyMap;
@@ -1532,6 +1620,14 @@ int UtcDaliVisualFactoryGetMeshVisual5(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetMeshVisual5:  Request mesh visual and make it only use diffuse textures." );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetMeshVisual5:  Request mesh visual and make it only use diffuse textures." );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::MESH );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::MESH );
@@ -1558,6 +1654,14 @@ int UtcDaliVisualFactoryGetMeshVisual6(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetMeshVisual6:  Request mesh visual and make it not use any textures." );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetMeshVisual6:  Request mesh visual and make it not use any textures." );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::MESH );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::MESH );
@@ -1577,9 +1681,16 @@ int UtcDaliVisualFactoryGetMeshVisual7(void)
   //Set up test application first, so everything else can be handled.
   ToolkitTestApplication application;
 
   //Set up test application first, so everything else can be handled.
   ToolkitTestApplication application;
 
-
   tet_infoline( "UtcDaliVisualFactoryGetMeshVisual7:  Request mesh visual with custom light position." );
 
   tet_infoline( "UtcDaliVisualFactoryGetMeshVisual7:  Request mesh visual with custom light position." );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::MESH );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::MESH );
@@ -1603,6 +1714,14 @@ int UtcDaliVisualFactoryGetMeshVisual8(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetMeshVisual5:  Request mesh visual with normal-less object file." );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetMeshVisual5:  Request mesh visual with normal-less object file." );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::MESH );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::MESH );
@@ -1727,6 +1846,14 @@ int UtcDaliVisualFactoryGetPrimitiveVisual1(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual1:  Request primitive visual with a shape only" );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual1:  Request primitive visual with a shape only" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
@@ -1746,6 +1873,14 @@ int UtcDaliVisualFactoryGetPrimitiveVisual2(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual2:  Request primitive visual with everything" );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual2:  Request primitive visual with everything" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
@@ -1775,6 +1910,14 @@ int UtcDaliVisualFactoryGetPrimitiveVisual3(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual3:  Request primitive visual to display a sphere" );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual3:  Request primitive visual to display a sphere" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
@@ -1797,6 +1940,14 @@ int UtcDaliVisualFactoryGetPrimitiveVisual4(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual4:  Request primitive visual to display a conic section" );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual4:  Request primitive visual to display a conic section" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
@@ -1821,6 +1972,14 @@ int UtcDaliVisualFactoryGetPrimitiveVisual5(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual5:  Request primitive visual to display a bevelled cube" );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual5:  Request primitive visual to display a bevelled cube" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
@@ -1842,6 +2001,14 @@ int UtcDaliVisualFactoryGetPrimitiveVisual6(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual6:  Request primitive visual to display an octahedron" );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual6:  Request primitive visual to display an octahedron" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
@@ -1862,6 +2029,14 @@ int UtcDaliVisualFactoryGetPrimitiveVisual7(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual7:  Request primitive visual to display a cone" );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual7:  Request primitive visual to display a cone" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
@@ -1885,6 +2060,14 @@ int UtcDaliVisualFactoryGetPrimitiveVisual8(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual8:  Request primitive visual with set light position" );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual8:  Request primitive visual with set light position" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
@@ -1906,6 +2089,14 @@ int UtcDaliVisualFactoryGetPrimitiveVisual9(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual9:  Request primitive visual with above-cap slices." );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual9:  Request primitive visual with above-cap slices." );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
@@ -1926,6 +2117,14 @@ int UtcDaliVisualFactoryGetPrimitiveVisual10(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual10:  Request primitive visual with too few slices." );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual10:  Request primitive visual with too few slices." );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
@@ -1946,6 +2145,14 @@ int UtcDaliVisualFactoryGetPrimitiveVisual11(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual11:  Request primitive visual with too many stacks." );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual11:  Request primitive visual with too many stacks." );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
@@ -1966,6 +2173,14 @@ int UtcDaliVisualFactoryGetPrimitiveVisual12(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual12:  Request primitive visual with too few stacks." );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual12:  Request primitive visual with too few stacks." );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
@@ -1986,6 +2201,14 @@ int UtcDaliVisualFactoryGetPrimitiveVisual13(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual13:  Request primitive visual with invalid scale dimensions." );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual13:  Request primitive visual with invalid scale dimensions." );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
@@ -2006,6 +2229,14 @@ int UtcDaliVisualFactoryGetPrimitiveVisual14(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual14:  Request primitive visual with too low a bevel percentage." );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual14:  Request primitive visual with too low a bevel percentage." );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
@@ -2026,6 +2257,14 @@ int UtcDaliVisualFactoryGetPrimitiveVisual15(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual15:  Request primitive visual with too high a bevel percentage." );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual15:  Request primitive visual with too high a bevel percentage." );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
@@ -2046,6 +2285,14 @@ int UtcDaliVisualFactoryGetPrimitiveVisual16(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual16:  Request primitive visual with too low a bevel smoothness." );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual16:  Request primitive visual with too low a bevel smoothness." );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
@@ -2066,6 +2313,14 @@ int UtcDaliVisualFactoryGetPrimitiveVisual17(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual17:  Request primitive visual with too high a bevel smoothness." );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual17:  Request primitive visual with too high a bevel smoothness." );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
@@ -2086,6 +2341,14 @@ int UtcDaliVisualFactoryGetPrimitiveVisual18(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual18:  Request primitive visual to display a conic section" );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual18:  Request primitive visual to display a conic section" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
   //Set up visual properties.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
@@ -2110,6 +2373,14 @@ int UtcDaliVisualFactoryGetPrimitiveVisualN1(void)
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisualN1:  Request primitive visual without shape" );
 
 
   tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisualN1:  Request primitive visual without shape" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("uObjectMatrix", Property::Type::MATRIX),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   //Set up visual properties, without supplying shape.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
   //Set up visual properties, without supplying shape.
   Property::Map propertyMap;
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::PRIMITIVE );
@@ -2204,6 +2475,15 @@ int UtcDaliVisualFactoryGetAnimatedImageVisual2(void)
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualFactoryGetAnimatedImageVisual2: Request animated image visual with a Property::Map, test custom wrap mode and pixel area" );
 
   ToolkitTestApplication application;
   tet_infoline( "UtcDaliVisualFactoryGetAnimatedImageVisual2: Request animated image visual with a Property::Map, test custom wrap mode and pixel area" );
 
+  static std::vector<UniformData> customUniforms =
+  {
+    UniformData("pixelArea", Property::Type::VECTOR4),
+    UniformData("wrapMode", Property::Type::VECTOR2),
+  };
+
+  TestGraphicsController& graphics = application.GetGraphicsController();
+  graphics.AddCustomUniforms(customUniforms);
+
   const Vector4 pixelArea(-0.5f, -0.5f, 2.f, 2.f);
   Property::Map propertyMap;
   propertyMap.Add( Toolkit::Visual::Property::TYPE,  Visual::IMAGE  )
   const Vector4 pixelArea(-0.5f, -0.5f, 2.f, 2.f);
   Property::Map propertyMap;
   propertyMap.Add( Toolkit::Visual::Property::TYPE,  Visual::IMAGE  )