Merge "Free EGLImages at the end of the testcase" into nyc-dev am: 3bd02575e7
authorMika Isojarvi <misojarvi@google.com>
Tue, 17 May 2016 16:13:36 +0000 (16:13 +0000)
committerandroid-build-merger <android-build-merger@google.com>
Tue, 17 May 2016 16:13:36 +0000 (16:13 +0000)
am: 7c32eb3276

* commit '7c32eb3276b494fabb42e38ee1707b1cbf5c1467':
  Free EGLImages at the end of the testcase

Change-Id: I9a553e44d31db0d7c8aa1f4f510da80c280ba5fb

modules/egl/teglGLES2SharingThreadedTests.cpp

index 2a44613..91f32cc 100644 (file)
@@ -2216,6 +2216,21 @@ void GLES2SharingRandomTest::init (void)
        for (int operationNdx = 0; operationNdx < m_config.operationCount; operationNdx++)
                addRandomOperation(resourceManager);
 
+       {
+               int threadNdx  = 0;
+
+               // Destroy images
+               // \note Android reference counts EGLDisplays so we can't trust the eglTerminate() to clean up resources
+               while (resourceManager.getImageCount() > 0)
+               {
+                       const SharedPtr<GLES2ThreadTest::EGLImage> image = resourceManager.popImage(0);
+
+                       m_threads[threadNdx]->addOperation(new GLES2ThreadTest::DestroyImage(image, m_config.useFenceSync, m_config.serverSync));
+
+                       threadNdx = (threadNdx + 1) % m_config.threadCount;
+               }
+       }
+
        // Release contexts
        for (int threadNdx = 0; threadNdx < m_config.threadCount; threadNdx++)
        {