Fixed memory leaks
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / test-graphics-controller.cpp
index f5f065e..51f0721 100644 (file)
@@ -180,7 +180,9 @@ public:
   : mCallStack(callStack),
     mBuffer(buffer),
     mMappedOffset(mappedOffset),
-    mMappedSize(mappedSize)
+    mMappedSize(mappedSize),
+    mLockedOffset(0u),
+    mLockedSize(0u)
   {
   }
 
@@ -463,7 +465,7 @@ void TestGraphicsController::SubmitCommandBuffers(const Graphics::SubmitInfo& su
     if(!value.empty())
     {
       // must be fixed
-      for(auto& binding : value[0]->bindTextures.textureBindings)
+      for(auto& binding : value[0]->data.bindTextures.textureBindings)
       {
         if(binding.texture)
         {
@@ -489,7 +491,7 @@ void TestGraphicsController::SubmitCommandBuffers(const Graphics::SubmitInfo& su
     auto bindIndexBufferCmds = commandBuffer->GetCommandsByType(0 | CommandType::BIND_INDEX_BUFFER);
     if(!bindIndexBufferCmds.empty())
     {
-      auto& indexBufferBinding = bindIndexBufferCmds[0]->bindIndexBuffer;
+      auto& indexBufferBinding = bindIndexBufferCmds[0]->data.bindIndexBuffer;
       if(indexBufferBinding.buffer)
       {
         auto buffer = Uncast<TestGraphicsBuffer>(indexBufferBinding.buffer);
@@ -501,7 +503,7 @@ void TestGraphicsController::SubmitCommandBuffers(const Graphics::SubmitInfo& su
     auto bindVertexBufferCmds = commandBuffer->GetCommandsByType(0 | CommandType::BIND_VERTEX_BUFFERS);
     if(!bindVertexBufferCmds.empty())
     {
-      for(auto& binding : bindVertexBufferCmds[0]->bindVertexBuffers.vertexBufferBindings)
+      for(auto& binding : bindVertexBufferCmds[0]->data.bindVertexBuffers.vertexBufferBindings)
       {
         auto graphicsBuffer = binding.buffer;
         auto vertexBuffer   = Uncast<TestGraphicsBuffer>(graphicsBuffer);
@@ -514,7 +516,7 @@ void TestGraphicsController::SubmitCommandBuffers(const Graphics::SubmitInfo& su
     auto scissorTestList = commandBuffer->GetCommandsByType(0 | CommandType::SET_SCISSOR_TEST);
     if(!scissorTestList.empty())
     {
-      if(scissorTestList[0]->scissorTest.enable)
+      if(scissorTestList[0]->data.scissorTest.enable)
       {
         mGl.Enable(GL_SCISSOR_TEST);
         scissorEnabled = true;
@@ -528,14 +530,14 @@ void TestGraphicsController::SubmitCommandBuffers(const Graphics::SubmitInfo& su
     auto scissorList = commandBuffer->GetCommandsByType(0 | CommandType::SET_SCISSOR);
     if(!scissorList.empty() && scissorEnabled)
     {
-      auto& rect = scissorList[0]->scissor.region;
+      auto& rect = scissorList[0]->data.scissor.region;
       mGl.Scissor(rect.x, rect.y, rect.width, rect.height);
     }
 
     auto viewportList = commandBuffer->GetCommandsByType(0 | CommandType::SET_VIEWPORT);
     if(!viewportList.empty())
     {
-      mGl.Viewport(viewportList[0]->viewport.region.x, viewportList[0]->viewport.region.y, viewportList[0]->viewport.region.width, viewportList[0]->viewport.region.height);
+      mGl.Viewport(viewportList[0]->data.viewport.region.x, viewportList[0]->data.viewport.region.y, viewportList[0]->data.viewport.region.width, viewportList[0]->data.viewport.region.height);
     }
 
     // ignore viewport enable
@@ -544,7 +546,7 @@ void TestGraphicsController::SubmitCommandBuffers(const Graphics::SubmitInfo& su
     auto bindPipelineCmds = commandBuffer->GetCommandsByType(0 | CommandType::BIND_PIPELINE);
     if(!bindPipelineCmds.empty())
     {
-      auto  pipeline = bindPipelineCmds[0]->bindPipeline.pipeline;
+      auto  pipeline = bindPipelineCmds[0]->data.bindPipeline.pipeline;
       auto& vi       = pipeline->vertexInputState;
       for(auto& attribute : vi.attributes)
       {
@@ -611,7 +613,7 @@ void TestGraphicsController::SubmitCommandBuffers(const Graphics::SubmitInfo& su
       auto bindUniformBuffersCmds = commandBuffer->GetCommandsByType(0 | CommandType::BIND_UNIFORM_BUFFER);
       if(!bindUniformBuffersCmds.empty())
       {
-        auto buffer = bindUniformBuffersCmds[0]->bindUniformBuffers.standaloneUniformsBufferBinding;
+        auto buffer = bindUniformBuffersCmds[0]->data.bindUniformBuffers.standaloneUniformsBufferBinding;
 
         // based on reflection, issue gl calls
         buffer.buffer->BindAsUniformBuffer(static_cast<const TestGraphicsProgram*>(pipeline->programState.program));
@@ -624,16 +626,16 @@ void TestGraphicsController::SubmitCommandBuffers(const Graphics::SubmitInfo& su
 
       if(!drawCmds.empty())
       {
-        if(drawCmds[0]->draw.type == DrawCallDescriptor::Type::DRAW_INDEXED)
+        if(drawCmds[0]->data.draw.type == DrawCallDescriptor::Type::DRAW_INDEXED)
         {
           mGl.DrawElements(GetTopology(topology),
-                           static_cast<GLsizei>(drawCmds[0]->draw.drawIndexed.indexCount),
+                           static_cast<GLsizei>(drawCmds[0]->data.draw.drawIndexed.indexCount),
                            GL_UNSIGNED_SHORT,
-                           reinterpret_cast<void*>(drawCmds[0]->draw.drawIndexed.firstIndex));
+                           reinterpret_cast<void*>(drawCmds[0]->data.draw.drawIndexed.firstIndex));
         }
         else
         {
-          mGl.DrawArrays(GetTopology(topology), 0, drawCmds[0]->draw.draw.vertexCount);
+          mGl.DrawArrays(GetTopology(topology), 0, drawCmds[0]->data.draw.draw.vertexCount);
         }
       }
       // attribute clear
@@ -680,6 +682,16 @@ void TestGraphicsController::Resume()
   mCallStack.PushCall("Resume", "");
 }
 
+void TestGraphicsController::Shutdown()
+{
+  mCallStack.PushCall("Shutdown", "");
+}
+
+void TestGraphicsController::Destroy()
+{
+  mCallStack.PushCall("Destroy", "");
+}
+
 void TestGraphicsController::UpdateTextures(const std::vector<Graphics::TextureUpdateInfo>&       updateInfoList,
                                             const std::vector<Graphics::TextureUpdateSourceInfo>& sourceList)
 {