Skip to content

Commit

Permalink
Merge vk-gl-cts/github-master into vk-gl-cts/master
Browse files Browse the repository at this point in the history
Change-Id: Id08c5fcbaea1f9cee9671fa40e5490d000c38711
  • Loading branch information
alegal-arm committed Sep 25, 2020
2 parents 75330ac + 07d7ccc commit 02da53e
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions framework/platform/surfaceless/tcuSurfacelessPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ EglRenderContext::EglRenderContext(const glu::RenderConfig& config, const tcu::C
eglw::EGLint eglMinorVersion;
eglw::EGLint flags = 0;
eglw::EGLint num_configs;
eglw::EGLConfig egl_config;
eglw::EGLConfig egl_config = NULL;
eglw::EGLSurface egl_surface;

(void) cmdLine;
Expand Down Expand Up @@ -329,14 +329,40 @@ EglRenderContext::EglRenderContext(const glu::RenderConfig& config, const tcu::C
frame_buffer_attribs.push_back(EGL_STENCIL_SIZE);
frame_buffer_attribs.push_back(config.stencilBits);

frame_buffer_attribs.push_back(EGL_SAMPLES);
frame_buffer_attribs.push_back(config.numSamples);

frame_buffer_attribs.push_back(EGL_NONE);

if (!eglChooseConfig(m_eglDisplay, &frame_buffer_attribs[0], NULL, 0, &num_configs))
throw tcu::ResourceError("surfaceless couldn't find any config");

if (!eglChooseConfig(m_eglDisplay, &frame_buffer_attribs[0], &egl_config, 1, &num_configs))
eglw::EGLConfig all_configs[num_configs];

if (!eglChooseConfig(m_eglDisplay, &frame_buffer_attribs[0], all_configs, num_configs, &num_configs))
throw tcu::ResourceError("surfaceless couldn't find any config");

for (int i = 0; i < num_configs; i++) {
EGLint red, green, blue, alpha, depth, stencil, samples;
eglGetConfigAttrib(m_eglDisplay, all_configs[i], EGL_RED_SIZE, &red);
eglGetConfigAttrib(m_eglDisplay, all_configs[i], EGL_GREEN_SIZE, &green);
eglGetConfigAttrib(m_eglDisplay, all_configs[i], EGL_BLUE_SIZE, &blue);
eglGetConfigAttrib(m_eglDisplay, all_configs[i], EGL_ALPHA_SIZE, &alpha);
eglGetConfigAttrib(m_eglDisplay, all_configs[i], EGL_DEPTH_SIZE, &depth);
eglGetConfigAttrib(m_eglDisplay, all_configs[i], EGL_STENCIL_SIZE, &stencil);
eglGetConfigAttrib(m_eglDisplay, all_configs[i], EGL_SAMPLES, &samples);

if ((red == config.redBits) && (green == config.greenBits) && (blue == config.blueBits) &&
(alpha == config.alphaBits) && (depth == config.depthBits) &&
(stencil == config.stencilBits) && (samples == config.numSamples)) {
egl_config = all_configs[i];
break;
}
}

if (!egl_config)
throw tcu::ResourceError("surfaceless couldn't find a matching config");

switch (config.surfaceType)
{
case glu::RenderConfig::SURFACETYPE_DONT_CARE:
Expand Down

0 comments on commit 02da53e

Please sign in to comment.