+}
+
+int UtcDaliGlViewDirectRenderingTextureBinding(void)
+{
+ ToolkitTestApplication application;
+
+ GlView view = Toolkit::GlView::New(GlView::BackendMode::DIRECT_RENDERING, GlView::ColorFormat::RGB888);
+
+ view.SetRenderingMode(GlView::RenderingMode::CONTINUOUS);
+ view.SetGraphicsConfig(true, true, 0, GlView::GraphicsApiVersion::GLES_VERSION_2_0);
+ view.RegisterGlCallbacks(Dali::MakeCallback(DirectRenderingCode::glInit), Dali::MakeCallback(DirectRenderingCode::glRenderFrameWithTextures), Dali::MakeCallback(DirectRenderingCode::glTerminate));
+ view.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ view.SetProperty(Actor::Property::SIZE, Vector2(360.0f, 360.0f));
+
+ // Set size on the actor (half the window size to show that glClear() and scissor test work together)
+ view.SetProperty(Actor::Property::SIZE, Size(100, 100));
+ view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
+
+ application.GetScene().Add(view);
+
+ // Prepare texture 1
+ Texture texture1 = Texture::New(Dali::TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 512, 512);
+ auto* data1 = reinterpret_cast<uint8_t*>(malloc(512 * 512 * 4));
+ PixelData pixelData1 = PixelData::New(data1, 512 * 512 * 4, 512, 512, Pixel::Format::RGBA8888, PixelData::ReleaseFunction::FREE);
+ texture1.Upload(pixelData1);
+
+ // Prepare texture 2
+ Texture texture2 = Texture::New(Dali::TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 512, 512);
+ auto* data2 = reinterpret_cast<uint8_t*>(malloc(512 * 512 * 4));
+ PixelData pixelData2 = PixelData::New(data2, 512 * 512 * 4, 512, 512, Pixel::Format::RGBA8888, PixelData::ReleaseFunction::FREE);
+ texture2.Upload(pixelData2);
+
+ std::vector<Texture> texturesToBind;
+ texturesToBind.push_back(texture1);
+ texturesToBind.push_back(texture2);
+
+ view.BindTextureResources(texturesToBind);
+
+ DirectRenderingCode::gBoundTextureCount = 0;
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(DirectRenderingCode::gBoundTextureCount, texturesToBind.size(), TEST_LOCATION);
+
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliGlViewDirectRenderingThreadedNew(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliGlViewDirectRenderingThreadedNew");
+ GlView view = GlView::New(GlView::BackendMode::DIRECT_RENDERING_THREADED, GlView::ColorFormat::RGBA8888);
+ DALI_TEST_CHECK(view);
+
+ auto mode1 = view.GetBackendMode();
+
+ DALI_TEST_EQUALS(mode1, GlView::BackendMode::DIRECT_RENDERING_THREADED, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliGlViewDirectRenderingThreadedOnScene(void)
+{
+ ToolkitTestApplication application;
+
+ GlView view = Toolkit::GlView::New(GlView::BackendMode::DIRECT_RENDERING_THREADED, GlView::ColorFormat::RGB888);
+
+ //Onscene
+ application.GetScene().Add(view);
+ view.SetRenderingMode(GlView::RenderingMode::CONTINUOUS);
+ view.SetGraphicsConfig(true, true, 0, GlView::GraphicsApiVersion::GLES_VERSION_3_0);
+ view.RegisterGlCallbacks(Dali::MakeCallback(DirectRenderingCode::glInitMT), Dali::MakeCallback(DirectRenderingCode::glRenderFrameMT), Dali::MakeCallback(DirectRenderingCode::glTerminateMT));
+ view.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ view.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+
+ // Set size on the actor (half the window size to show that glClear() and scissor test work together)
+ view.SetProperty(Actor::Property::SIZE, Size(100, 100));
+ view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
+
+ while(DirectRenderingCode::gDRFramesRendered < 1)
+ {
+ application.SendNotification();
+ application.Render();
+ }
+ DALI_TEST_CHECK(true);
+ END_TEST;
+}
+
+extern "C" bool gDirectRenderingFailCreateShader;
+extern "C" bool gDirectRenderingFailCreateProgram;
+
+int UtcDaliGlViewDirectRenderingThreadedOnScene1(void)
+{
+ ToolkitTestApplication application;
+
+ GlView view = Toolkit::GlView::New(GlView::BackendMode::DIRECT_RENDERING_THREADED, GlView::ColorFormat::RGB888);
+
+ // This test will fail instantiating shaders
+ gDirectRenderingFailCreateShader = true;
+
+ //Onscene
+ application.GetScene().Add(view);
+ view.SetRenderingMode(GlView::RenderingMode::CONTINUOUS);
+ view.SetGraphicsConfig(true, true, 0, GlView::GraphicsApiVersion::GLES_VERSION_3_0);
+ view.RegisterGlCallbacks(Dali::MakeCallback(DirectRenderingCode::glInitMT), Dali::MakeCallback(DirectRenderingCode::glRenderFrameMT), Dali::MakeCallback(DirectRenderingCode::glTerminateMT));
+ view.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ view.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+
+ // Set size on the actor (half the window size to show that glClear() and scissor test work together)
+ view.SetProperty(Actor::Property::SIZE, Size(100, 100));
+ view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
+
+ while(DirectRenderingCode::gDRFramesRendered < 1)
+ {
+ application.SendNotification();
+ application.Render();
+ }
+ DALI_TEST_CHECK(true);
+ END_TEST;
+}
+
+int UtcDaliGlViewDirectRenderingThreadedOnScene2(void)
+{
+ ToolkitTestApplication application;
+
+ GlView view = Toolkit::GlView::New(GlView::BackendMode::DIRECT_RENDERING_THREADED, GlView::ColorFormat::RGB888);
+
+ // This test will fail instantiating shaders
+ gDirectRenderingFailCreateProgram = true;
+
+ //Onscene
+ application.GetScene().Add(view);
+ view.SetRenderingMode(GlView::RenderingMode::CONTINUOUS);
+ view.SetGraphicsConfig(true, true, 0, GlView::GraphicsApiVersion::GLES_VERSION_3_0);
+ view.RegisterGlCallbacks(Dali::MakeCallback(DirectRenderingCode::glInitMT), Dali::MakeCallback(DirectRenderingCode::glRenderFrameMT), Dali::MakeCallback(DirectRenderingCode::glTerminateMT));
+ view.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ view.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+
+ // Set size on the actor (half the window size to show that glClear() and scissor test work together)
+ view.SetProperty(Actor::Property::SIZE, Size(100, 100));
+ view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
+
+ while(DirectRenderingCode::gDRFramesRendered < 1)
+ {
+ application.SendNotification();
+ application.Render();
+ }
+ DALI_TEST_CHECK(true);
+ END_TEST;
+}