Syncing test harness
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / test-graphics-controller.cpp
index 282f7a4..ddcf0f5 100644 (file)
@@ -176,7 +176,6 @@ std::ostream& operator<<(std::ostream& o, const Graphics::FramebufferCreateInfo&
   return o;
 }
 
-
 int GetNumComponents(Graphics::VertexInputFormat vertexFormat)
 {
   switch(vertexFormat)
@@ -385,7 +384,6 @@ GLenum GetBlendOp(Graphics::BlendOp blendOp)
   return op;
 }
 
-
 class TestGraphicsMemory : public Graphics::Memory
 {
 public:
@@ -453,7 +451,6 @@ TestGraphicsController::TestGraphicsController()
   trace.EnableLogging(true);
 }
 
-
 void TestGraphicsController::SubmitCommandBuffers(const Graphics::SubmitInfo& submitInfo)
 {
   TraceCallStack::NamedParams namedParams;
@@ -546,21 +543,6 @@ void TestGraphicsController::ProcessCommandBuffer(TestGraphicsCommandBuffer& com
       case CommandType::BIND_PIPELINE:
       {
         currentPipeline = Uncast<TestGraphicsPipeline>(cmd.data.bindPipeline.pipeline);
-
-        // Bind framebuffer if different. @todo Move to RenderPass
-        auto framebuffer = currentPipeline->framebufferState.framebuffer;
-        if(framebuffer && framebuffer != currentFramebuffer)
-        {
-          auto graphicsFramebuffer = Uncast<TestGraphicsFramebuffer>(framebuffer);
-          graphicsFramebuffer->Bind();
-        }
-        else
-        {
-          if(currentFramebuffer)
-            currentFramebuffer->Bind();
-          else
-            mGl.BindFramebuffer(GL_FRAMEBUFFER, 0);
-        }
         BindPipeline(currentPipeline);
         break;
       }
@@ -625,7 +607,7 @@ void TestGraphicsController::ProcessCommandBuffer(TestGraphicsCommandBuffer& com
         // Process secondary command buffers
         for(auto& buf : cmd.data.executeCommandBuffers.buffers)
         {
-          ProcessCommandBuffer(*static_cast<TestGraphicsCommandBuffer*>(buf));
+          ProcessCommandBuffer(*Uncast<TestGraphicsCommandBuffer>(buf));
         }
         break;
       }
@@ -693,10 +675,10 @@ void TestGraphicsController::ProcessCommandBuffer(TestGraphicsCommandBuffer& com
             {
               // Test scissor area and RT size
               const auto& area = cmd.data.beginRenderPass.renderArea;
-              if( area.x == 0 &&
-              area.y == 0 &&
-              area.width == renderTarget->mCreateInfo.extent.width &&
-              area.height == renderTarget->mCreateInfo.extent.height )
+              if(area.x == 0 &&
+                 area.y == 0 &&
+                 area.width == renderTarget->mCreateInfo.extent.width &&
+                 area.height == renderTarget->mCreateInfo.extent.height)
               {
                 mGl.Disable(GL_SCISSOR_TEST);
                 mGl.Clear(mask);
@@ -704,8 +686,7 @@ void TestGraphicsController::ProcessCommandBuffer(TestGraphicsCommandBuffer& com
               else
               {
                 mGl.Enable(GL_SCISSOR_TEST);
-                mGl.Scissor(cmd.data.beginRenderPass.renderArea.x, cmd.data.beginRenderPass.renderArea.y,
-                            cmd.data.beginRenderPass.renderArea.width, cmd.data.beginRenderPass.renderArea.height);
+                mGl.Scissor(cmd.data.beginRenderPass.renderArea.x, cmd.data.beginRenderPass.renderArea.y, cmd.data.beginRenderPass.renderArea.width, cmd.data.beginRenderPass.renderArea.height);
                 mGl.Clear(mask);
                 mGl.Disable(GL_SCISSOR_TEST);
               }
@@ -784,6 +765,9 @@ void TestGraphicsController::BindPipeline(TestGraphicsPipeline* pipeline)
   {
     mGl.Disable(GL_BLEND);
   }
+
+  auto* program = static_cast<const TestGraphicsProgram*>(pipeline->programState.program);
+  mGl.UseProgram(program->mImpl->mId);
 }
 
 /**