Add missing finish() calls to multithread and multi context tests.
authorMika Isojärvi <misojarvi@google.com>
Tue, 5 May 2015 00:29:39 +0000 (17:29 -0700)
committerMika Isojärvi <misojarvi@google.com>
Tue, 5 May 2015 00:29:39 +0000 (17:29 -0700)
Bug: 20751454
Change-Id: Ic6de190c4784bee483ca2a0e74c5b4c0899f2886

modules/egl/teglColorClearCase.cpp
modules/egl/teglGLES1RenderUtil.cpp
modules/egl/teglGLES1RenderUtil.hpp
modules/egl/teglGLES2RenderUtil.cpp
modules/egl/teglGLES2RenderUtil.hpp
modules/egl/teglRenderTests.cpp
modules/egl/teglVGRenderUtil.cpp
modules/egl/teglVGRenderUtil.hpp

index 6d6e73b..db38ad0 100644 (file)
@@ -120,6 +120,19 @@ static void renderClear (EGLint api, const ApiFunctions& func, const ClearOp& cl
        }
 }
 
+static void finish (EGLint api, const ApiFunctions& func)
+{
+       switch (api)
+       {
+               case EGL_OPENGL_ES_BIT:                 gles1::finish();                break;
+               case EGL_OPENGL_ES2_BIT:                gles2::finish(func.gl); break;
+               case EGL_OPENGL_ES3_BIT_KHR:    gles2::finish(func.gl); break;
+               case EGL_OPENVG_BIT:                    vg::finish();                   break;
+               default:
+                       DE_ASSERT(DE_FALSE);
+       }
+}
+
 static void readPixels (EGLint api, const ApiFunctions& func, tcu::Surface& dst)
 {
        switch (api)
@@ -185,6 +198,7 @@ void SingleThreadColorClearCase::executeForContexts (EGLDisplay display, EGLSurf
                EGLU_CHECK_MSG(egl, "eglMakeCurrent");
 
                renderClear(api, funcs, clear);
+               finish(api, funcs);
                clears.push_back(clear);
        }
 
@@ -206,6 +220,8 @@ void SingleThreadColorClearCase::executeForContexts (EGLDisplay display, EGLSurf
                                renderClear(api, funcs, clear);
                                clears.push_back(clear);
                        }
+
+                       finish(api, funcs);
                }
        }
 
@@ -286,6 +302,7 @@ public:
                        for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(packetIter->clears); ndx++)
                                renderClear(m_api, m_funcs, packetIter->clears[ndx]);
 
+                       finish(m_api, m_funcs);
                        // Release context.
                        m_egl.makeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
 
index 5066da2..7c5d1f6 100644 (file)
@@ -53,6 +53,11 @@ void readPixels (tcu::Surface& dst, int x, int y, int width, int height)
        glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, dst.getAccess().getDataPtr());
 }
 
+void finish (void)
+{
+       glFinish();
+}
+
 #else // DEQP_SUPPORT_GLES1
 
 void clear (int x, int y, int width, int height, const tcu::Vec4& color)
@@ -69,6 +74,11 @@ void readPixels (tcu::Surface& dst, int x, int y, int width, int height)
        TCU_THROW(NotSupportedError, "OpenGL ES 1.x is not supported");
 }
 
+void finish (void)
+{
+       TCU_THROW(NotSupportedError, "OpenGL ES 1.x is not supported");
+}
+
 #endif // DEQP_SUPPORT_GLES1
 
 } // gles1
index 3254331..2cd06ab 100644 (file)
@@ -36,6 +36,7 @@ namespace gles1
 
 void   clear           (int x, int y, int width, int height, const tcu::Vec4& color);
 void   readPixels      (tcu::Surface& dst, int x, int y, int width, int height);
+void   finish          (void);
 
 } // gles1
 } // egl
index 9246cad..627ff09 100644 (file)
@@ -47,6 +47,11 @@ void readPixels (const glw::Functions& gl, tcu::Surface& dst, int x, int y, int
        gl.readPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, dst.getAccess().getDataPtr());
 }
 
+void finish (const glw::Functions& gl)
+{
+       gl.finish();
+}
+
 } // gles2
 } // egl
 } // deqp
index 0ec420c..7c91f3f 100644 (file)
@@ -41,6 +41,7 @@ namespace gles2
 
 void   clear           (const glw::Functions& gl, int x, int y, int width, int height, const tcu::Vec4& color);
 void   readPixels      (const glw::Functions& gl, tcu::Surface& dst, int x, int y, int width, int height);
+void   finish          (const glw::Functions& gl);
 
 } // gles2
 } // egl
index 81a32d7..dfc61b6 100644 (file)
@@ -637,6 +637,20 @@ static void readPixels (const glw::Functions& gl, EGLint api, tcu::Surface& dst)
        }
 }
 
+static void finish (const glw::Functions& gl, EGLint api)
+{
+       switch (api)
+       {
+               case EGL_OPENGL_ES2_BIT:
+               case EGL_OPENGL_ES3_BIT_KHR:
+                       gl.finish();
+                       break;
+
+               default:
+                       throw tcu::NotSupportedError("Unsupported API");
+       }
+}
+
 tcu::PixelFormat getPixelFormat (const Library& egl, EGLDisplay display, EGLConfig config)
 {
        tcu::PixelFormat fmt;
@@ -735,6 +749,7 @@ void SingleThreadRenderCase::executeForContexts (EGLDisplay display, EGLSurface
                EGLU_CHECK_CALL(egl, makeCurrent(display, surface, surface, context));
 
                clear(m_gl, api, CLEAR_COLOR, CLEAR_DEPTH, CLEAR_STENCIL);
+               finish(m_gl, api);
        }
 
        // Render.
@@ -752,6 +767,8 @@ void SingleThreadRenderCase::executeForContexts (EGLDisplay display, EGLSurface
                                const DrawPrimitiveOp& drawOp = drawOps[iterNdx*numContexts*drawsPerCtx + ctxNdx*drawsPerCtx + drawNdx];
                                draw(m_gl, api, *programs[ctxNdx], drawOp);
                        }
+
+                       finish(m_gl, api);
                }
        }
 
@@ -843,6 +860,8 @@ public:
                        for (int ndx = 0; ndx < packetIter->numOps; ndx++)
                                draw(m_gl, m_api, m_program, packetIter->drawOps[ndx]);
 
+                       finish(m_gl, m_api);
+
                        // Release context.
                        EGLU_CHECK_CALL(m_egl, makeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
 
@@ -961,6 +980,7 @@ void MultiThreadRenderCase::executeForContexts (EGLDisplay display, EGLSurface s
                EGLU_CHECK_CALL(egl, makeCurrent(display, surface, surface, context));
 
                clear(m_gl, api, CLEAR_COLOR, CLEAR_DEPTH, CLEAR_STENCIL);
+               finish(m_gl, api);
 
                // Release context
                EGLU_CHECK_CALL(egl, makeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
index a171ca7..cb14fb3 100644 (file)
@@ -51,6 +51,11 @@ void readPixels (tcu::Surface& dst, int x, int y, int width, int height)
        vgReadPixels(dst.getAccess().getDataPtr(), width*4, VG_sRGBA_8888, 0, 0, width, height);
 }
 
+void finish (void)
+{
+       vgFinish();
+}
+
 #else // DEQP_SUPPORT_VG
 
 void clear (int x, int y, int width, int height, const tcu::Vec4& color)
@@ -67,6 +72,11 @@ void readPixels (tcu::Surface& dst, int x, int y, int width, int height)
        TCU_THROW(NotSupportedError, "OpenVG is not supported");
 }
 
+void finish (void)
+{
+       TCU_THROW(NotSupportedError, "OpenVG is not supported");
+}
+
 #endif // DEQP_SUPPORT_VG
 
 } // vg
index b9a9054..acf953c 100644 (file)
@@ -36,6 +36,7 @@ namespace vg
 
 void   clear           (int x, int y, int width, int height, const tcu::Vec4& color);
 void   readPixels      (tcu::Surface& dst, int x, int y, int width, int height);
+void   finish          (void);
 
 } // vg
 } // egl