1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program EGL Module
3 * ---------------------------------------
5 * Copyright 2014 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief EGL gles2 sharing tests
22 *//*--------------------------------------------------------------------*/
24 #include "teglGLES2SharingTests.hpp"
26 #include "teglGLES2SharingThreadedTests.hpp"
28 #include "egluNativeWindow.hpp"
29 #include "egluUtil.hpp"
30 #include "egluUnique.hpp"
32 #include "eglwLibrary.hpp"
33 #include "eglwEnums.hpp"
35 #include "tcuCommandLine.hpp"
36 #include "tcuImageCompare.hpp"
37 #include "tcuSurface.hpp"
38 #include "tcuTestLog.hpp"
39 #include "tcuTexture.hpp"
40 #include "tcuTextureUtil.hpp"
42 #include "deUniquePtr.hpp"
43 #include "deRandom.hpp"
49 #include "gluDefs.hpp"
50 #include "gluShaderProgram.hpp"
52 #include "glwFunctions.hpp"
53 #include "glwEnums.hpp"
69 class GLES2SharingTest : public TestCase
83 bool destroyContextBFirst;
85 bool destroyOnContexB;
93 GLES2SharingTest (EglTestContext& eglTestCtx, const char* name , const char* desc, const TestSpec& spec);
97 IterateResult iterate (void);
102 EGLContext createContext (EGLDisplay display, EGLContext share, EGLConfig config);
103 void makeCurrent (EGLDisplay display, EGLContext context, EGLSurface surface);
110 virtual void createResource (void) { DE_ASSERT(false); }
111 virtual void destroyResource (void) { DE_ASSERT(false); }
112 virtual void renderResource (tcu::Surface* screen, tcu::Surface* reference) { DE_UNREF(screen); DE_UNREF(reference); DE_ASSERT(false); }
115 GLES2SharingTest::GLES2SharingTest (EglTestContext& eglTestCtx, const char* name , const char* desc, const TestSpec& spec)
116 : TestCase (eglTestCtx, name, desc)
118 , m_random (deStringHash(name))
119 , m_log (eglTestCtx.getTestContext().getLog())
123 void GLES2SharingTest::init (void)
125 m_eglTestCtx.initGLFunctions(&m_gl, glu::ApiType::es(2,0));
128 EGLContext GLES2SharingTest::createContext (EGLDisplay display, EGLContext share, EGLConfig config)
130 const Library& egl = m_eglTestCtx.getLibrary();
131 EGLContext context = EGL_NO_CONTEXT;
132 const EGLint attriblist[] =
134 EGL_CONTEXT_CLIENT_VERSION, 2,
138 EGLU_CHECK_CALL(egl, bindAPI(EGL_OPENGL_ES_API));
140 context = egl.createContext(display, config, share, attriblist);
141 EGLU_CHECK_MSG(egl, "Failed to create GLES2 context");
142 TCU_CHECK(context != EGL_NO_CONTEXT);
147 void GLES2SharingTest::makeCurrent (EGLDisplay display, EGLContext context, EGLSurface surface)
149 const Library& egl = m_eglTestCtx.getLibrary();
150 EGLU_CHECK_CALL(egl, makeCurrent(display, surface, surface, context));
153 TestCase::IterateResult GLES2SharingTest::iterate (void)
155 const Library& egl = m_eglTestCtx.getLibrary();
156 tcu::TestLog& log = m_testCtx.getLog();
157 eglu::UniqueDisplay display (egl, eglu::getAndInitDisplay(m_eglTestCtx.getNativeDisplay()));
158 const eglu::NativeWindowFactory& windowFactory = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
161 EGLContext contextA = EGL_NO_CONTEXT;
162 EGLContext contextB = EGL_NO_CONTEXT;
165 const EGLint attribList[] =
167 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
168 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
173 config = eglu::chooseSingleConfig(egl, *display, attribList);
178 de::UniquePtr<eglu::NativeWindow> window (windowFactory.createWindow(&m_eglTestCtx.getNativeDisplay(), *display, config, DE_NULL, eglu::WindowParams(480, 480, eglu::parseWindowVisibility(m_testCtx.getCommandLine()))));
179 eglu::UniqueSurface surface (egl, *display, eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *window, *display, config, DE_NULL));
181 m_log << tcu::TestLog::Message << "Create context A (share_context = EGL_NO_CONTEXT)" << tcu::TestLog::EndMessage;
182 contextA = createContext(*display, EGL_NO_CONTEXT, config);
184 m_log << tcu::TestLog::Message << "Create context B (share_context = context A)" << tcu::TestLog::EndMessage;
185 contextB = createContext(*display, contextA, config);
187 if (m_spec.useResource)
189 m_log << tcu::TestLog::Message << "Make current context A" << tcu::TestLog::EndMessage;
190 makeCurrent(*display, contextA, *surface);
191 m_log << tcu::TestLog::Message << "Creating resource" << tcu::TestLog::EndMessage;
197 if (m_spec.renderOnContexA)
199 m_log << tcu::TestLog::Message << "Render resource" << tcu::TestLog::EndMessage;
200 if (m_spec.verifyOnContexA)
202 tcu::Surface screen (width, height);
203 tcu::Surface ref (width, height);
204 renderResource(&screen, &ref);
206 if (!fuzzyCompare(log, "Rendered image", "Rendering result comparision", ref, screen, 0.05f, tcu::COMPARE_LOG_RESULT))
211 renderResource(DE_NULL, DE_NULL);
215 if (m_spec.renderOnContexB)
217 m_log << tcu::TestLog::Message << "Make current context B" << tcu::TestLog::EndMessage;
218 makeCurrent(*display, contextB, *surface);
219 m_log << tcu::TestLog::Message << "Render resource" << tcu::TestLog::EndMessage;
220 if (m_spec.verifyOnContexB)
222 tcu::Surface screen (width, height);
223 tcu::Surface ref (width, height);
224 renderResource(&screen, &ref);
226 if (!fuzzyCompare(log, "Rendered image", "Rendering result comparision", ref, screen, 0.05f, tcu::COMPARE_LOG_RESULT))
231 renderResource(DE_NULL, DE_NULL);
235 if (m_spec.destroyOnContexB)
237 m_log << tcu::TestLog::Message << "Make current context B" << tcu::TestLog::EndMessage;
238 makeCurrent(*display, contextB, *surface);
239 m_log << tcu::TestLog::Message << "Destroy resource" << tcu::TestLog::EndMessage;
244 m_log << tcu::TestLog::Message << "Make current context A" << tcu::TestLog::EndMessage;
245 makeCurrent(*display, contextA, *surface);
246 m_log << tcu::TestLog::Message << "Destroy resource" << tcu::TestLog::EndMessage;
251 makeCurrent(*display, EGL_NO_CONTEXT, EGL_NO_SURFACE);
253 if (m_spec.destroyContextBFirst)
255 m_log << tcu::TestLog::Message << "Destroy context B" << tcu::TestLog::EndMessage;
256 egl.destroyContext(*display, contextB);
257 contextB = EGL_NO_CONTEXT;
259 m_log << tcu::TestLog::Message << "Destroy context A" << tcu::TestLog::EndMessage;
260 egl.destroyContext(*display, contextA);
261 contextA = EGL_NO_CONTEXT;
265 m_log << tcu::TestLog::Message << "Destroy context A" << tcu::TestLog::EndMessage;
266 egl.destroyContext(*display, contextA);
267 contextA = EGL_NO_CONTEXT;
269 m_log << tcu::TestLog::Message << "Destroy context B" << tcu::TestLog::EndMessage;
270 egl.destroyContext(*display, contextB);
271 contextB = EGL_NO_CONTEXT;
278 egl.makeCurrent(*display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
279 if (contextA != EGL_NO_CONTEXT)
280 egl.destroyContext(*display, contextA);
281 if (contextB != EGL_NO_CONTEXT)
282 egl.destroyContext(*display, contextB);
287 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
289 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Image comparison failed");
294 class GLES2BufferSharingTest : public GLES2SharingTest
297 GLES2BufferSharingTest (EglTestContext& eglTestCtx, const char* name, const char* desc, const GLES2SharingTest::TestSpec& spec);
301 std::vector<GLubyte> m_buffer;
303 virtual void createResource (void);
304 virtual void destroyResource (void);
305 virtual void renderResource (tcu::Surface* screen, tcu::Surface* reference);
309 GLES2BufferSharingTest::GLES2BufferSharingTest (EglTestContext& eglTestCtx, const char* name, const char* desc, const GLES2SharingTest::TestSpec& spec)
310 : GLES2SharingTest (eglTestCtx, name, desc, spec)
315 void GLES2BufferSharingTest::createResource (void)
319 m_buffer.reserve(size);
321 for (int i = 0; i < size; i++)
322 m_buffer.push_back((GLubyte)m_random.getInt(0, 255));
324 GLU_CHECK_GLW_CALL(m_gl, genBuffers(1, &m_glBuffer));
325 GLU_CHECK_GLW_CALL(m_gl, bindBuffer(GL_ARRAY_BUFFER, m_glBuffer));
326 GLU_CHECK_GLW_CALL(m_gl, bufferData(GL_ARRAY_BUFFER, (GLsizei)(m_buffer.size() * sizeof(GLubyte)), &(m_buffer[0]), GL_DYNAMIC_DRAW));
327 GLU_CHECK_GLW_CALL(m_gl, bindBuffer(GL_ARRAY_BUFFER, 0));
330 void GLES2BufferSharingTest::destroyResource (void)
332 GLU_CHECK_GLW_CALL(m_gl, deleteBuffers(1, &m_glBuffer));
336 void GLES2BufferSharingTest::renderResource (tcu::Surface* screen, tcu::Surface* reference)
338 DE_ASSERT((screen && reference) || (!screen && !reference));
340 const char* vertexShader = ""
341 "attribute mediump vec2 a_pos;\n"
342 "attribute mediump float a_color;\n"
343 "varying mediump float v_color;\n"
346 "\tv_color = a_color;\n"
347 "\tgl_Position = vec4(a_pos, 0.0, 1.0);\n"
350 const char* fragmentShader = ""
351 "varying mediump float v_color;\n"
354 "\tgl_FragColor = vec4(v_color, v_color, v_color, 1.0);\n"
357 glu::ShaderProgram program(m_gl, glu::makeVtxFragSources(vertexShader, fragmentShader));
360 TCU_FAIL("Failed to compile shader program");
362 std::vector<deUint16> indices;
363 std::vector<float> coords;
365 DE_ASSERT(m_buffer.size() % 4 == 0);
367 for (int i = 0; i < (int)m_buffer.size() / 4; i++)
369 indices.push_back((deUint16)(i*4));
370 indices.push_back((deUint16)(i*4 + 1));
371 indices.push_back((deUint16)(i*4 + 2));
372 indices.push_back((deUint16)(i*4 + 2));
373 indices.push_back((deUint16)(i*4 + 3));
374 indices.push_back((deUint16)(i*4));
376 coords.push_back(0.125f * (float)(i % 16) - 1.0f);
377 coords.push_back(0.125f * (float)((int)((float)i / 16.0f)) - 1.0f);
379 coords.push_back(0.125f * (float)(i % 16) - 1.0f);
380 coords.push_back(0.125f * (float)((int)((float)i / 16.0f) + 1) - 1.0f);
382 coords.push_back(0.125f * (float)((i % 16) + 1) - 1.0f);
383 coords.push_back(0.125f * (float)((int)((float)i / 16.0f) + 1) - 1.0f);
385 coords.push_back(0.125f * (float)((i % 16) + 1) - 1.0f);
386 coords.push_back(0.125f * (float)((int)((float)i / 16.0f)) - 1.0f);
394 width = screen->getWidth();
395 height = screen->getHeight();
398 GLU_CHECK_GLW_CALL(m_gl, viewport(0, 0, width, height));
400 GLU_CHECK_GLW_CALL(m_gl, clearColor(1.0f, 0.0f, 0.0f, 1.0f));
401 GLU_CHECK_GLW_CALL(m_gl, clear(GL_COLOR_BUFFER_BIT));
403 GLU_CHECK_GLW_CALL(m_gl, useProgram(program.getProgram()));
405 GLuint gridLocation = m_gl.getAttribLocation(program.getProgram(), "a_pos");
406 GLU_CHECK_GLW_MSG(m_gl, "glGetAttribLocation()");
407 TCU_CHECK(gridLocation != (GLuint)-1);
409 GLuint colorLocation = m_gl.getAttribLocation(program.getProgram(), "a_color");
410 GLU_CHECK_GLW_MSG(m_gl, "glGetAttribLocation()");
411 TCU_CHECK(colorLocation != (GLuint)-1);
413 GLU_CHECK_GLW_CALL(m_gl, enableVertexAttribArray(colorLocation));
414 GLU_CHECK_GLW_CALL(m_gl, enableVertexAttribArray(gridLocation));
416 GLU_CHECK_GLW_CALL(m_gl, bindBuffer(GL_ARRAY_BUFFER, m_glBuffer));
417 GLU_CHECK_GLW_CALL(m_gl, vertexAttribPointer(colorLocation, 1, GL_UNSIGNED_BYTE, GL_TRUE, 0, DE_NULL));
418 GLU_CHECK_GLW_CALL(m_gl, bindBuffer(GL_ARRAY_BUFFER, 0));
420 GLU_CHECK_GLW_CALL(m_gl, vertexAttribPointer(gridLocation, 2, GL_FLOAT, GL_FALSE, 0, &(coords[0])));
422 GLU_CHECK_GLW_CALL(m_gl, drawElements(GL_TRIANGLES, (GLsizei)indices.size(), GL_UNSIGNED_SHORT, &(indices[0])));
423 GLU_CHECK_GLW_CALL(m_gl, disableVertexAttribArray(colorLocation));
424 GLU_CHECK_GLW_CALL(m_gl, disableVertexAttribArray(gridLocation));
426 GLU_CHECK_GLW_CALL(m_gl, useProgram(0));
430 tcu::clear(reference->getAccess(), tcu::IVec4(0xff, 0, 0, 0xff));
431 m_gl.readPixels(0, 0, screen->getWidth(), screen->getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, screen->getAccess().getDataPtr());
432 for (int i = 0; i < (int)m_buffer.size() / 4; i++)
434 float fx1 = 0.125f * (float)(i % 16) - 1.0f;
435 float fy1 = 0.125f * (float)((int)((float)i / 16.0f)) - 1.0f;
436 float fx2 = 0.125f * (float)((i % 16) + 1) - 1.0f;
437 float fy2 = 0.125f * (float)((int)((float)i / 16.0f) + 1) - 1.0f;
439 int ox = deRoundFloatToInt32((float)width / 2.0f);
440 int oy = deRoundFloatToInt32((float)height / 2.0f);
441 int x1 = deRoundFloatToInt32(((float)width * fx1 / 2.0f) + (float)ox);
442 int y1 = deRoundFloatToInt32(((float)height * fy1 / 2.0f) + (float)oy);
443 int x2 = deRoundFloatToInt32(((float)width * fx2 / 2.0f) + (float)ox);
444 int y2 = deRoundFloatToInt32(((float)height * fy2 / 2.0f) + (float)oy);
446 for (int x = x1; x < x2; x++)
448 for (int y = y1; y < y2; y++)
450 float xf = ((float)(x-x1) + 0.5f) / (float)(x2 - x1);
451 float yf = ((float)(y-y1) + 0.5f) / (float)(y2 - y1);
453 deUint8 a = m_buffer[i*4 + (tri ? 1 : 3)];
454 deUint8 b = m_buffer[i*4 + (tri ? 2 : 0)];
455 deUint8 c = m_buffer[i*4 + (tri ? 0 : 2)];
456 float s = tri ? xf : 1.0f-xf;
457 float t = tri ? 1.0f-yf : yf;
458 float val = (float)a + (float)(b-a)*s + (float)(c-a)*t;
460 reference->setPixel(x, y, tcu::RGBA((deUint8)val, (deUint8)val, (deUint8)val, 255));
467 class GLES2TextureSharingTest : public GLES2SharingTest
470 GLES2TextureSharingTest (EglTestContext& eglTestCtx, const char* name, const char* desc, const GLES2SharingTest::TestSpec& spec);
474 tcu::Texture2D m_texture;
476 virtual void createResource (void);
477 virtual void destroyResource (void);
478 virtual void renderResource (tcu::Surface* screen, tcu::Surface* reference);
482 GLES2TextureSharingTest::GLES2TextureSharingTest (EglTestContext& eglTestCtx, const char* name, const char* desc, const GLES2SharingTest::TestSpec& spec)
483 : GLES2SharingTest (eglTestCtx, name, desc, spec)
485 , m_texture (tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), 1, 1)
489 void GLES2TextureSharingTest::createResource (void)
493 m_texture = tcu::Texture2D(tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), width, height);
494 m_texture.allocLevel(0);
496 tcu::fillWithComponentGradients(m_texture.getLevel(0), tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f), tcu::Vec4(1.0f, 1.0f, 1.0f, 1.0f));
497 GLU_CHECK_GLW_CALL(m_gl, genTextures(1, &m_glTexture));
498 GLU_CHECK_GLW_CALL(m_gl, bindTexture(GL_TEXTURE_2D, m_glTexture));
499 GLU_CHECK_GLW_CALL(m_gl, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT));
500 GLU_CHECK_GLW_CALL(m_gl, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT));
501 GLU_CHECK_GLW_CALL(m_gl, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
502 GLU_CHECK_GLW_CALL(m_gl, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
503 GLU_CHECK_GLW_CALL(m_gl, texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_texture.getLevel(0).getDataPtr()));
504 GLU_CHECK_GLW_CALL(m_gl, bindTexture(GL_TEXTURE_2D, 0));
507 void GLES2TextureSharingTest::destroyResource (void)
509 GLU_CHECK_GLW_CALL(m_gl, deleteTextures(1, &m_glTexture));
512 void GLES2TextureSharingTest::renderResource (tcu::Surface* screen, tcu::Surface* reference)
514 DE_ASSERT((screen && reference) || (!screen && !reference));
516 const char* vertexShader = ""
517 "attribute mediump vec2 a_pos;\n"
518 "attribute mediump vec2 a_texCorod;\n"
519 "varying mediump vec2 v_texCoord;\n"
522 "\tv_texCoord = a_texCorod;\n"
523 "\tgl_Position = vec4(a_pos, 0.0, 1.0);\n"
526 const char* fragmentShader = ""
527 "varying mediump vec2 v_texCoord;\n"
528 "uniform sampler2D u_sampler;\n"
531 "\tgl_FragColor = texture2D(u_sampler, v_texCoord);\n"
534 glu::ShaderProgram program(m_gl, glu::makeVtxFragSources(vertexShader, fragmentShader));
537 TCU_FAIL("Failed to compile shader program");
544 width = screen->getWidth();
545 height = screen->getHeight();
548 static const GLfloat coords[] = {
555 static const GLfloat texCoords[] = {
562 static const GLushort indices[] = {
567 GLU_CHECK_GLW_CALL(m_gl, viewport(0, 0, width, height));
569 GLU_CHECK_GLW_CALL(m_gl, clearColor(1.0f, 0.0f, 0.0f, 1.0f));
570 GLU_CHECK_GLW_CALL(m_gl, clear(GL_COLOR_BUFFER_BIT));
572 GLU_CHECK_GLW_CALL(m_gl, useProgram(program.getProgram()));
574 GLuint coordLocation = m_gl.getAttribLocation(program.getProgram(), "a_pos");
575 GLU_CHECK_GLW_MSG(m_gl, "glGetAttribLocation()");
576 TCU_CHECK(coordLocation != (GLuint)-1);
578 GLuint texCoordLocation = m_gl.getAttribLocation(program.getProgram(), "a_texCorod");
579 GLU_CHECK_GLW_MSG(m_gl, "glGetAttribLocation()");
580 TCU_CHECK(texCoordLocation != (GLuint)-1);
583 GLuint samplerLocation = m_gl.getUniformLocation(program.getProgram(), "u_sampler");
584 GLU_CHECK_GLW_MSG(m_gl, "glGetUniformLocation()");
585 TCU_CHECK(samplerLocation != (GLuint)-1);
587 GLU_CHECK_GLW_CALL(m_gl, activeTexture(GL_TEXTURE0));
588 GLU_CHECK_GLW_CALL(m_gl, bindTexture(GL_TEXTURE_2D, m_glTexture));
590 GLU_CHECK_GLW_CALL(m_gl, uniform1i(samplerLocation, 0));
592 GLU_CHECK_GLW_CALL(m_gl, enableVertexAttribArray(texCoordLocation));
593 GLU_CHECK_GLW_CALL(m_gl, enableVertexAttribArray(coordLocation));
595 GLU_CHECK_GLW_CALL(m_gl, vertexAttribPointer(texCoordLocation, 2, GL_FLOAT, GL_FALSE, 0, texCoords));
596 GLU_CHECK_GLW_CALL(m_gl, vertexAttribPointer(coordLocation, 2, GL_FLOAT, GL_FALSE, 0, coords));
598 GLU_CHECK_GLW_CALL(m_gl, drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices));
599 GLU_CHECK_GLW_CALL(m_gl, disableVertexAttribArray(coordLocation));
600 GLU_CHECK_GLW_CALL(m_gl, disableVertexAttribArray(texCoordLocation));
602 GLU_CHECK_GLW_CALL(m_gl, bindTexture(GL_TEXTURE_2D, 0));
603 GLU_CHECK_GLW_CALL(m_gl, useProgram(0));
607 m_gl.readPixels(0, 0, screen->getWidth(), screen->getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, screen->getAccess().getDataPtr());
609 for (int x = 0; x < width; x++)
611 for (int y = 0; y < height; y++)
613 float t = ((float)x / ((float)width - 1.0f));
614 float s = ((float)y / ((float)height - 1.0f));
617 tcu::Vec4 color = m_texture.sample(tcu::Sampler(tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, tcu::Sampler::LINEAR, tcu::Sampler::LINEAR), t, s, lod);
619 int r = deClamp32((int)(255.0f * color.x()), 0, 255);
620 int g = deClamp32((int)(255.0f * color.y()), 0, 255);
621 int b = deClamp32((int)(255.0f * color.z()), 0, 255);
622 int a = deClamp32((int)(255.0f * color.w()), 0, 255);
624 reference->setPixel(x, y, tcu::RGBA(r, g, b, a));
630 class GLES2ProgramSharingTest : public GLES2SharingTest
633 GLES2ProgramSharingTest (EglTestContext& eglTestCtx, const char* name, const char* desc, const GLES2SharingTest::TestSpec& spec);
636 glu::ShaderProgram* m_program;
638 virtual void createResource (void);
639 virtual void destroyResource (void);
640 virtual void renderResource (tcu::Surface* screen, tcu::Surface* reference);
644 GLES2ProgramSharingTest::GLES2ProgramSharingTest (EglTestContext& eglTestCtx, const char* name, const char* desc, const GLES2SharingTest::TestSpec& spec)
645 : GLES2SharingTest (eglTestCtx, name, desc, spec)
646 , m_program (DE_NULL)
650 void GLES2ProgramSharingTest::createResource (void)
652 const char* vertexShader = ""
653 "attribute mediump vec2 a_pos;\n"
654 "attribute mediump vec4 a_color;\n"
655 "varying mediump vec4 v_color;\n"
658 "\tv_color = a_color;\n"
659 "\tgl_Position = vec4(a_pos, 0.0, 1.0);\n"
662 const char* fragmentShader = ""
663 "varying mediump vec4 v_color;\n"
666 "\tgl_FragColor = v_color;\n"
669 m_program = new glu::ShaderProgram(m_gl, glu::makeVtxFragSources(vertexShader, fragmentShader));
671 if (!m_program->isOk())
672 TCU_FAIL("Failed to compile shader program");
675 void GLES2ProgramSharingTest::destroyResource (void)
680 void GLES2ProgramSharingTest::renderResource (tcu::Surface* screen, tcu::Surface* reference)
682 DE_ASSERT((screen && reference) || (!screen && !reference));
689 width = screen->getWidth();
690 height = screen->getHeight();
693 static const GLfloat coords[] = {
700 static const GLfloat colors [] = {
701 0.0f, 0.0f, 0.0f, 1.0f,
702 1.0f, 0.0f, 0.0f, 1.0f,
703 0.0f, 1.0f, 0.0f, 1.0f,
704 0.0f, 0.0f, 1.0f, 1.0f
707 static const GLushort indices[] = {
712 GLU_CHECK_GLW_CALL(m_gl, viewport(0, 0, width, height));
714 GLU_CHECK_GLW_CALL(m_gl, clearColor(1.0f, 0.0f, 0.0f, 1.0f));
715 GLU_CHECK_GLW_CALL(m_gl, clear(GL_COLOR_BUFFER_BIT));
717 GLU_CHECK_GLW_CALL(m_gl, useProgram(m_program->getProgram()));
719 GLuint coordLocation = m_gl.getAttribLocation(m_program->getProgram(), "a_pos");
720 GLU_CHECK_GLW_MSG(m_gl, "glGetAttribLocation()");
721 TCU_CHECK(coordLocation != (GLuint)-1);
723 GLuint colorLocation = m_gl.getAttribLocation(m_program->getProgram(), "a_color");
724 GLU_CHECK_GLW_MSG(m_gl, "glGetAttribLocation()");
725 TCU_CHECK(colorLocation != (GLuint)-1);
727 GLU_CHECK_GLW_CALL(m_gl, enableVertexAttribArray(colorLocation));
728 GLU_CHECK_GLW_CALL(m_gl, enableVertexAttribArray(coordLocation));
730 GLU_CHECK_GLW_CALL(m_gl, vertexAttribPointer(colorLocation, 4, GL_FLOAT, GL_FALSE, 0, colors));
731 GLU_CHECK_GLW_CALL(m_gl, vertexAttribPointer(coordLocation, 2, GL_FLOAT, GL_FALSE, 0, coords));
733 GLU_CHECK_GLW_CALL(m_gl, drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices));
734 GLU_CHECK_GLW_CALL(m_gl, disableVertexAttribArray(coordLocation));
735 GLU_CHECK_GLW_CALL(m_gl, disableVertexAttribArray(colorLocation));
736 GLU_CHECK_GLW_CALL(m_gl, useProgram(0));
740 m_gl.readPixels(0, 0, screen->getWidth(), screen->getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, screen->getAccess().getDataPtr());
742 tcu::clear(reference->getAccess(), tcu::IVec4(0xff, 0, 0, 0xff));
744 int x1 = (int)(((float)width/2.0f) * (-0.9f) + ((float)width/2.0f));
745 int x2 = (int)(((float)width/2.0f) * 0.9f + ((float)width/2.0f));
746 int y1 = (int)(((float)height/2.0f) * (-0.9f) + ((float)height/2.0f));
747 int y2 = (int)(((float)height/2.0f) * 0.9f + ((float)height/2.0f));
749 for (int x = x1; x <= x2; x++)
751 for (int y = y1; y <= y2; y++)
753 float t = ((float)(x-x1) / (float)(x2-x1));
754 float s = ((float)(y-y1) / (float)(y2-y1));
755 bool isUpper = t > s;
757 tcu::Vec4 a(colors[0], colors[1], colors[2], colors[3]);
758 tcu::Vec4 b(colors[4 + 0], colors[4 + 1], colors[4 + 2], colors[4 + 3]);
759 tcu::Vec4 c(colors[8 + 0], colors[8 + 1], colors[8 + 2], colors[8 + 3]);
760 tcu::Vec4 d(colors[12 + 0], colors[12 + 1], colors[12 + 2], colors[12 + 3]);
766 color = a * (1.0f - t) + b * (t - s) + s * c;
768 color = a * (1.0f - s) + d * (s - t) + t * c;
770 int red = deClamp32((int)(255.0f * color.x()), 0, 255);
771 int green = deClamp32((int)(255.0f * color.y()), 0, 255);
772 int blue = deClamp32((int)(255.0f * color.z()), 0, 255);
773 int alpha = deClamp32((int)(255.0f * color.w()), 0, 255);
775 reference->setPixel(x, y, tcu::RGBA(red, green, blue, alpha));
781 class GLES2ShaderSharingTest : public GLES2SharingTest
784 GLES2ShaderSharingTest (EglTestContext& eglTestCtx, const char* name, const char* desc, GLenum shaderType, const GLES2SharingTest::TestSpec& spec);
790 virtual void createResource (void);
791 virtual void destroyResource (void);
792 virtual void renderResource (tcu::Surface* screen, tcu::Surface* reference);
796 GLES2ShaderSharingTest::GLES2ShaderSharingTest (EglTestContext& eglTestCtx, const char* name, const char* desc, GLenum shaderType, const GLES2SharingTest::TestSpec& spec)
797 : GLES2SharingTest (eglTestCtx, name, desc, spec)
799 , m_shaderType (shaderType)
803 void GLES2ShaderSharingTest::createResource (void)
805 const char* vertexShader = ""
806 "attribute mediump vec2 a_pos;\n"
807 "attribute mediump vec4 a_color;\n"
808 "varying mediump vec4 v_color;\n"
811 "\tv_color = a_color;\n"
812 "\tgl_Position = vec4(a_pos, 0.0, 1.0);\n"
815 const char* fragmentShader = ""
816 "varying mediump vec4 v_color;\n"
819 "\tgl_FragColor = v_color;\n"
823 m_shader = m_gl.createShader(m_shaderType);
824 GLU_CHECK_GLW_MSG(m_gl, "glCreateShader()");
826 switch (m_shaderType)
828 case GL_VERTEX_SHADER:
829 GLU_CHECK_GLW_CALL(m_gl, shaderSource(m_shader, 1, &vertexShader, DE_NULL));
832 case GL_FRAGMENT_SHADER:
833 GLU_CHECK_GLW_CALL(m_gl, shaderSource(m_shader, 1, &fragmentShader, DE_NULL));
840 GLU_CHECK_GLW_CALL(m_gl, compileShader(m_shader));
843 GLU_CHECK_GLW_CALL(m_gl, getShaderiv(m_shader, GL_COMPILE_STATUS, &status));
848 GLU_CHECK_GLW_CALL(m_gl, getShaderInfoLog(m_shader, 256, DE_NULL, buffer));
850 m_log << tcu::TestLog::Message << "Failed to compile shader" << tcu::TestLog::EndMessage;
852 switch (m_shaderType)
854 case GL_VERTEX_SHADER:
855 m_log << tcu::TestLog::Message << vertexShader << tcu::TestLog::EndMessage;
858 case GL_FRAGMENT_SHADER:
859 m_log << tcu::TestLog::Message << fragmentShader << tcu::TestLog::EndMessage;
866 m_log << tcu::TestLog::Message << buffer << tcu::TestLog::EndMessage;
867 TCU_FAIL("Failed to compile shader");
871 void GLES2ShaderSharingTest::destroyResource (void)
873 GLU_CHECK_GLW_CALL(m_gl, deleteShader(m_shader));
876 void GLES2ShaderSharingTest::renderResource (tcu::Surface* screen, tcu::Surface* reference)
878 DE_ASSERT((screen && reference) || (!screen && !reference));
883 const char* vertexShader = ""
884 "attribute mediump vec2 a_pos;\n"
885 "attribute mediump vec4 a_color;\n"
886 "varying mediump vec4 v_color;\n"
889 "\tv_color = a_color;\n"
890 "\tgl_Position = vec4(a_pos, 0.0, 1.0);\n"
893 const char* fragmentShader = ""
894 "varying mediump vec4 v_color;\n"
897 "\tgl_FragColor = v_color;\n"
901 GLuint otherShader = (GLuint)-1;
903 switch (m_shaderType)
905 case GL_VERTEX_SHADER:
906 otherShader = m_gl.createShader(GL_FRAGMENT_SHADER);
907 GLU_CHECK_GLW_MSG(m_gl, "glCreateShader()");
908 GLU_CHECK_GLW_CALL(m_gl, shaderSource(otherShader, 1, &fragmentShader, DE_NULL));
911 case GL_FRAGMENT_SHADER:
912 otherShader = m_gl.createShader(GL_VERTEX_SHADER);
913 GLU_CHECK_GLW_MSG(m_gl, "glCreateShader()");
914 GLU_CHECK_GLW_CALL(m_gl, shaderSource(otherShader, 1, &vertexShader, DE_NULL));
921 GLU_CHECK_GLW_CALL(m_gl, compileShader(otherShader));
924 GLU_CHECK_GLW_CALL(m_gl, getShaderiv(otherShader, GL_COMPILE_STATUS, &status));
929 GLU_CHECK_GLW_CALL(m_gl, getShaderInfoLog(otherShader, 256, DE_NULL, buffer));
931 m_log << tcu::TestLog::Message << "Failed to compile shader" << tcu::TestLog::EndMessage;
933 switch (m_shaderType)
935 case GL_FRAGMENT_SHADER:
936 m_log << tcu::TestLog::Message << vertexShader << tcu::TestLog::EndMessage;
939 case GL_VERTEX_SHADER:
940 m_log << tcu::TestLog::Message << fragmentShader << tcu::TestLog::EndMessage;
947 m_log << tcu::TestLog::Message << buffer << tcu::TestLog::EndMessage;
948 TCU_FAIL("Failed to compile shader");
951 GLuint program = m_gl.createProgram();
952 GLU_CHECK_GLW_MSG(m_gl, "glCreateProgram()");
954 GLU_CHECK_GLW_CALL(m_gl, attachShader(program, m_shader));
955 GLU_CHECK_GLW_CALL(m_gl, attachShader(program, otherShader));
957 GLU_CHECK_GLW_CALL(m_gl, linkProgram(program));
958 GLU_CHECK_GLW_CALL(m_gl, deleteShader(otherShader));
961 GLU_CHECK_GLW_CALL(m_gl, getProgramiv(program, GL_LINK_STATUS, &status));
966 GLU_CHECK_GLW_CALL(m_gl, getProgramInfoLog(program, 256, DE_NULL, buffer));
968 m_log << tcu::TestLog::Message << "Failed to link program" << tcu::TestLog::EndMessage;
970 m_log << tcu::TestLog::Message << vertexShader << tcu::TestLog::EndMessage;
971 m_log << tcu::TestLog::Message << fragmentShader << tcu::TestLog::EndMessage;
972 m_log << tcu::TestLog::Message << buffer << tcu::TestLog::EndMessage;
973 TCU_FAIL("Failed to link program");
978 width = screen->getWidth();
979 height = screen->getHeight();
982 static const GLfloat coords[] = {
989 static const GLfloat colors [] = {
990 0.0f, 0.0f, 0.0f, 1.0f,
991 1.0f, 0.0f, 0.0f, 1.0f,
992 0.0f, 1.0f, 0.0f, 1.0f,
993 0.0f, 0.0f, 1.0f, 1.0f
996 static const GLushort indices[] = {
1001 GLU_CHECK_GLW_CALL(m_gl, viewport(0, 0, width, height));
1003 GLU_CHECK_GLW_CALL(m_gl, clearColor(1.0f, 0.0f, 0.0f, 1.0f));
1004 GLU_CHECK_GLW_CALL(m_gl, clear(GL_COLOR_BUFFER_BIT));
1006 GLU_CHECK_GLW_CALL(m_gl, useProgram(program));
1008 GLuint coordLocation = m_gl.getAttribLocation(program, "a_pos");
1009 GLU_CHECK_GLW_MSG(m_gl, "glGetAttribLocation()");
1010 TCU_CHECK(coordLocation != (GLuint)-1);
1012 GLuint colorLocation = m_gl.getAttribLocation(program, "a_color");
1013 GLU_CHECK_GLW_MSG(m_gl, "glGetAttribLocation()");
1014 TCU_CHECK(colorLocation != (GLuint)-1);
1016 GLU_CHECK_GLW_CALL(m_gl, enableVertexAttribArray(colorLocation));
1017 GLU_CHECK_GLW_CALL(m_gl, enableVertexAttribArray(coordLocation));
1019 GLU_CHECK_GLW_CALL(m_gl, vertexAttribPointer(colorLocation, 4, GL_FLOAT, GL_FALSE, 0, colors));
1020 GLU_CHECK_GLW_CALL(m_gl, vertexAttribPointer(coordLocation, 2, GL_FLOAT, GL_FALSE, 0, coords));
1022 GLU_CHECK_GLW_CALL(m_gl, drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices));
1023 GLU_CHECK_GLW_CALL(m_gl, disableVertexAttribArray(coordLocation));
1024 GLU_CHECK_GLW_CALL(m_gl, disableVertexAttribArray(colorLocation));
1025 GLU_CHECK_GLW_CALL(m_gl, useProgram(0));
1029 m_gl.readPixels(0, 0, screen->getWidth(), screen->getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, screen->getAccess().getDataPtr());
1031 tcu::clear(reference->getAccess(), tcu::IVec4(0xff, 0, 0, 0xff));
1033 int x1 = (int)(((float)width/2.0f) * (-0.9f) + ((float)width/2.0f));
1034 int x2 = (int)(((float)width/2.0f) * 0.9f + ((float)width/2.0f));
1035 int y1 = (int)(((float)height/2.0f) * (-0.9f) + ((float)height/2.0f));
1036 int y2 = (int)(((float)height/2.0f) * 0.9f + ((float)height/2.0f));
1038 for (int x = x1; x <= x2; x++)
1040 for (int y = y1; y <= y2; y++)
1042 float t = ((float)(x-x1) / (float)(x2-x1));
1043 float s = ((float)(y-y1) / (float)(y2-y1));
1044 bool isUpper = t > s;
1046 tcu::Vec4 a(colors[0], colors[1], colors[2], colors[3]);
1047 tcu::Vec4 b(colors[4 + 0], colors[4 + 1], colors[4 + 2], colors[4 + 3]);
1048 tcu::Vec4 c(colors[8 + 0], colors[8 + 1], colors[8 + 2], colors[8 + 3]);
1049 tcu::Vec4 d(colors[12 + 0], colors[12 + 1], colors[12 + 2], colors[12 + 3]);
1055 color = a * (1.0f - t) + b * (t - s) + s * c;
1057 color = a * (1.0f - s) + d * (s - t) + t * c;
1059 int red = deClamp32((int)(255.0f * color.x()), 0, 255);
1060 int green = deClamp32((int)(255.0f * color.y()), 0, 255);
1061 int blue = deClamp32((int)(255.0f * color.z()), 0, 255);
1062 int alpha = deClamp32((int)(255.0f * color.w()), 0, 255);
1064 reference->setPixel(x, y, tcu::RGBA(red, green, blue, alpha));
1070 SharingTests::SharingTests (EglTestContext& eglTestCtx)
1071 : TestCaseGroup (eglTestCtx, "sharing", "Sharing test cases")
1075 void SharingTests::init (void)
1077 TestCaseGroup* gles2 = new TestCaseGroup(m_eglTestCtx, "gles2", "OpenGL ES 2 sharing test");
1079 TestCaseGroup* context = new TestCaseGroup(m_eglTestCtx, "context", "Context creation and destruction tests");
1082 GLES2SharingTest::TestSpec spec;
1083 spec.destroyContextBFirst = false;
1084 spec.useResource = false;
1085 spec.destroyOnContexB = false;
1086 spec.initializeData = true;
1087 spec.renderOnContexA = true;
1088 spec.renderOnContexB = true;
1089 spec.verifyOnContexA = true;
1090 spec.verifyOnContexB = true;
1092 context->addChild(new GLES2SharingTest(m_eglTestCtx, "create_destroy", "Simple context creation and destruction", spec));
1095 GLES2SharingTest::TestSpec spec;
1096 spec.destroyContextBFirst = true;
1097 spec.useResource = false;
1098 spec.destroyOnContexB = false;
1099 spec.initializeData = false;
1100 spec.renderOnContexA = false;
1101 spec.renderOnContexB = false;
1102 spec.verifyOnContexA = false;
1103 spec.verifyOnContexB = false;
1105 context->addChild(new GLES2SharingTest(m_eglTestCtx, "create_destroy_mixed", "Simple context creation and destruction test with different destruction order", spec));
1108 gles2->addChild(context);
1110 TestCaseGroup* buffer = new TestCaseGroup(m_eglTestCtx, "buffer", "Buffer creation, destruction and rendering test");
1113 GLES2SharingTest::TestSpec spec;
1114 spec.destroyContextBFirst = false;
1115 spec.useResource = true;
1116 spec.destroyOnContexB = false;
1117 spec.initializeData = true;
1118 spec.renderOnContexA = false;
1119 spec.renderOnContexB = false;
1120 spec.verifyOnContexA = false;
1121 spec.verifyOnContexB = false;
1123 buffer->addChild(new GLES2BufferSharingTest(m_eglTestCtx, "create_delete", "Create and delete on shared context", spec));
1126 GLES2SharingTest::TestSpec spec;
1127 spec.destroyContextBFirst = false;
1128 spec.useResource = true;
1129 spec.destroyOnContexB = true;
1130 spec.initializeData = true;
1131 spec.renderOnContexA = false;
1132 spec.renderOnContexB = false;
1133 spec.verifyOnContexA = false;
1134 spec.verifyOnContexB = false;
1136 buffer->addChild(new GLES2BufferSharingTest(m_eglTestCtx, "create_delete_mixed", "Create and delet on different contexts", spec));
1139 GLES2SharingTest::TestSpec spec;
1140 spec.destroyContextBFirst = false;
1141 spec.useResource = true;
1142 spec.destroyOnContexB = false;
1143 spec.initializeData = true;
1144 spec.renderOnContexA = true;
1145 spec.renderOnContexB = true;
1146 spec.verifyOnContexA = true;
1147 spec.verifyOnContexB = true;
1149 buffer->addChild(new GLES2BufferSharingTest(m_eglTestCtx, "render", "Create, rendering on two different contexts and delete", spec));
1152 gles2->addChild(buffer);
1154 TestCaseGroup* texture = new TestCaseGroup(m_eglTestCtx, "texture", "Texture creation, destruction and rendering tests");
1157 GLES2SharingTest::TestSpec spec;
1158 spec.destroyContextBFirst = false;
1159 spec.useResource = true;
1160 spec.destroyOnContexB = false;
1161 spec.initializeData = true;
1162 spec.renderOnContexA = false;
1163 spec.renderOnContexB = false;
1164 spec.verifyOnContexA = false;
1165 spec.verifyOnContexB = false;
1167 texture->addChild(new GLES2TextureSharingTest(m_eglTestCtx, "create_delete", "Create and delete on shared context", spec));
1170 GLES2SharingTest::TestSpec spec;
1171 spec.destroyContextBFirst = false;
1172 spec.useResource = true;
1173 spec.destroyOnContexB = true;
1174 spec.initializeData = true;
1175 spec.renderOnContexA = false;
1176 spec.renderOnContexB = false;
1177 spec.verifyOnContexA = false;
1178 spec.verifyOnContexB = false;
1180 texture->addChild(new GLES2TextureSharingTest(m_eglTestCtx, "create_delete_mixed", "Create and delete on different contexts", spec));
1183 GLES2SharingTest::TestSpec spec;
1184 spec.destroyContextBFirst = false;
1185 spec.useResource = true;
1186 spec.destroyOnContexB = false;
1187 spec.initializeData = true;
1188 spec.renderOnContexA = true;
1189 spec.renderOnContexB = true;
1190 spec.verifyOnContexA = true;
1191 spec.verifyOnContexB = true;
1193 texture->addChild(new GLES2TextureSharingTest(m_eglTestCtx, "render", "Create, render in two contexts and delete", spec));
1196 gles2->addChild(texture);
1198 TestCaseGroup* program = new TestCaseGroup(m_eglTestCtx, "program", "Program creation, destruction and rendering test");
1201 GLES2SharingTest::TestSpec spec;
1202 spec.destroyContextBFirst = false;
1203 spec.useResource = true;
1204 spec.destroyOnContexB = false;
1205 spec.initializeData = true;
1206 spec.renderOnContexA = false;
1207 spec.renderOnContexB = false;
1208 spec.verifyOnContexA = false;
1209 spec.verifyOnContexB = false;
1211 program->addChild(new GLES2ProgramSharingTest(m_eglTestCtx, "create_delete", "Create and delete on shared context", spec));
1214 GLES2SharingTest::TestSpec spec;
1215 spec.destroyContextBFirst = false;
1216 spec.useResource = true;
1217 spec.destroyOnContexB = true;
1218 spec.initializeData = true;
1219 spec.renderOnContexA = false;
1220 spec.renderOnContexB = false;
1221 spec.verifyOnContexA = false;
1222 spec.verifyOnContexB = false;
1224 program->addChild(new GLES2ProgramSharingTest(m_eglTestCtx, "create_delete_mixed", "Create and delete on different contexts", spec));
1227 GLES2SharingTest::TestSpec spec;
1228 spec.destroyContextBFirst = false;
1229 spec.useResource = true;
1230 spec.destroyOnContexB = false;
1231 spec.initializeData = true;
1232 spec.renderOnContexA = true;
1233 spec.renderOnContexB = true;
1234 spec.verifyOnContexA = true;
1235 spec.verifyOnContexB = true;
1237 program->addChild(new GLES2ProgramSharingTest(m_eglTestCtx, "render", "Create, render in two contexts and delete", spec));
1240 gles2->addChild(program);
1242 TestCaseGroup* shader = new TestCaseGroup(m_eglTestCtx, "shader", "Shader creation, destruction and rendering test");
1245 GLES2SharingTest::TestSpec spec;
1246 spec.destroyContextBFirst = false;
1247 spec.useResource = true;
1248 spec.destroyOnContexB = false;
1249 spec.initializeData = true;
1250 spec.renderOnContexA = false;
1251 spec.renderOnContexB = false;
1252 spec.verifyOnContexA = false;
1253 spec.verifyOnContexB = false;
1255 shader->addChild(new GLES2ShaderSharingTest(m_eglTestCtx, "create_delete_vert", "Create and delete on shared context", GL_VERTEX_SHADER, spec));
1258 GLES2SharingTest::TestSpec spec;
1259 spec.destroyContextBFirst = false;
1260 spec.useResource = true;
1261 spec.destroyOnContexB = true;
1262 spec.initializeData = true;
1263 spec.renderOnContexA = false;
1264 spec.renderOnContexB = false;
1265 spec.verifyOnContexA = false;
1266 spec.verifyOnContexB = false;
1268 shader->addChild(new GLES2ShaderSharingTest(m_eglTestCtx, "create_delete_mixed_vert", "Create and delete on different contexts", GL_VERTEX_SHADER, spec));
1271 GLES2SharingTest::TestSpec spec;
1272 spec.destroyContextBFirst = false;
1273 spec.useResource = true;
1274 spec.destroyOnContexB = false;
1275 spec.initializeData = true;
1276 spec.renderOnContexA = true;
1277 spec.renderOnContexB = true;
1278 spec.verifyOnContexA = true;
1279 spec.verifyOnContexB = true;
1281 shader->addChild(new GLES2ShaderSharingTest(m_eglTestCtx, "render_vert", "Create, render on two contexts and delete", GL_VERTEX_SHADER, spec));
1284 GLES2SharingTest::TestSpec spec;
1285 spec.destroyContextBFirst = false;
1286 spec.useResource = true;
1287 spec.destroyOnContexB = false;
1288 spec.initializeData = true;
1289 spec.renderOnContexA = false;
1290 spec.renderOnContexB = false;
1291 spec.verifyOnContexA = false;
1292 spec.verifyOnContexB = false;
1294 shader->addChild(new GLES2ShaderSharingTest(m_eglTestCtx, "create_delete_frag", "Create and delete on shared context", GL_FRAGMENT_SHADER, spec));
1297 GLES2SharingTest::TestSpec spec;
1298 spec.destroyContextBFirst = false;
1299 spec.useResource = true;
1300 spec.destroyOnContexB = true;
1301 spec.initializeData = true;
1302 spec.renderOnContexA = false;
1303 spec.renderOnContexB = false;
1304 spec.verifyOnContexA = false;
1305 spec.verifyOnContexB = false;
1307 shader->addChild(new GLES2ShaderSharingTest(m_eglTestCtx, "create_delete_mixed_frag", "Create and delete on different contexts", GL_FRAGMENT_SHADER, spec));
1310 GLES2SharingTest::TestSpec spec;
1311 spec.destroyContextBFirst = false;
1312 spec.useResource = true;
1313 spec.destroyOnContexB = false;
1314 spec.initializeData = true;
1315 spec.renderOnContexA = true;
1316 spec.renderOnContexB = true;
1317 spec.verifyOnContexA = true;
1318 spec.verifyOnContexB = true;
1320 shader->addChild(new GLES2ShaderSharingTest(m_eglTestCtx, "render_frag", "Create, render on two contexts and delete", GL_FRAGMENT_SHADER, spec));
1324 gles2->addChild(shader);
1327 gles2->addChild(new GLES2SharingThreadedTests(m_eglTestCtx));