- const Library& egl = m_eglTestCtx.getLibrary();
- tcu::TestLog& log = m_testCtx.getLog();
-
- EGLint attribList[] =
- {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_RED_SIZE, 10,
- EGL_GREEN_SIZE, 10,
- EGL_BLUE_SIZE, 10,
- EGL_ALPHA_SIZE, 2,
- EGL_COLOR_COMPONENT_TYPE_EXT, EGL_COLOR_COMPONENT_TYPE_FIXED_EXT,
- EGL_NONE, EGL_NONE
- };
- EGLint numConfigs = 0;
- EGLConfig config;
-
- // Query from EGL implementation
- EGLU_CHECK_CALL(egl, chooseConfig(m_eglDisplay, &attribList[0], DE_NULL, 0, &numConfigs));
-
- if (numConfigs <= 0)
- {
- log << tcu::TestLog::Message << "No configs returned." << tcu::TestLog::EndMessage;
- TCU_FAIL("No configs returned");
- }
-
- log << tcu::TestLog::Message << numConfigs << " configs returned" << tcu::TestLog::EndMessage;
-
- EGLBoolean success = egl.chooseConfig(m_eglDisplay, &attribList[0], &config, 1, &numConfigs);
- if (success != EGL_TRUE)
- {
- log << tcu::TestLog::Message << "Fail, eglChooseConfig returned an error." << tcu::TestLog::EndMessage;
- TCU_FAIL("eglChooseConfig failed");
- }
- if (numConfigs > 1)
- {
- log << tcu::TestLog::Message << "Fail, more configs returned than requested." << tcu::TestLog::EndMessage;
- TCU_FAIL("Too many configs returned");
- }
-
- EGLint components[4];
-
- success = egl.getConfigAttrib(m_eglDisplay, config, EGL_RED_SIZE, &components[0]);
- TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
- EGLU_CHECK(egl);
- success = egl.getConfigAttrib(m_eglDisplay, config, EGL_GREEN_SIZE, &components[1]);
- TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
- EGLU_CHECK(egl);
- success = egl.getConfigAttrib(m_eglDisplay, config, EGL_BLUE_SIZE, &components[2]);
- TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
- EGLU_CHECK(egl);
- success = egl.getConfigAttrib(m_eglDisplay, config, EGL_ALPHA_SIZE, &components[3]);
- TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
- EGLU_CHECK(egl);
-
- TCU_CHECK_MSG(components[0] == 10, "Missing 10bit deep red channel");
- TCU_CHECK_MSG(components[1] == 10, "Missing 10bit deep green channel");
- TCU_CHECK_MSG(components[2] == 10, "Missing 10bit deep blue channel");
- TCU_CHECK_MSG(components[3] == 2, "Missing 2bit deep alpha channel");
-
- m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");