Skip to content

Commit 7d82d29

Browse files
qjia7Commit Bot
authored and
Commit Bot
committed
Refactor DisplayGbm::generateConfigs
Bug: angleproject:4809 Change-Id: I5f352f737bbd53c78d9e01055c17eabd17d5fb8a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2278667 Reviewed-by: Jamie Madill <[email protected]> Reviewed-by: Geoff Lang <[email protected]> Commit-Queue: Jiajia Qin <[email protected]>
1 parent 120e1d6 commit 7d82d29

File tree

1 file changed

+30
-18
lines changed

1 file changed

+30
-18
lines changed

src/libANGLE/renderer/gl/egl/gbm/DisplayGbm.cpp

+30-18
Original file line numberDiff line numberDiff line change
@@ -924,24 +924,36 @@ egl::Error DisplayGbm::makeCurrent(egl::Surface *drawSurface,
924924

925925
egl::ConfigSet DisplayGbm::generateConfigs()
926926
{
927-
egl::ConfigSet configs;
928-
929-
egl::Config config;
930-
config.bufferSize = 32;
931-
config.redSize = 8;
932-
config.greenSize = 8;
933-
config.blueSize = 8;
934-
config.alphaSize = 8;
935-
config.depthSize = 24;
936-
config.stencilSize = 8;
937-
config.bindToTextureRGBA = EGL_TRUE;
938-
config.renderableType = EGL_OPENGL_ES2_BIT;
939-
config.surfaceType = EGL_WINDOW_BIT | EGL_PBUFFER_BIT;
940-
config.renderTargetFormat = GL_RGBA8;
941-
config.depthStencilFormat = GL_DEPTH24_STENCIL8;
942-
943-
configs.add(config);
944-
return configs;
927+
928+
gl::Version eglVersion(mEGL->majorVersion, mEGL->minorVersion);
929+
ASSERT(eglVersion >= gl::Version(1, 4));
930+
931+
bool supportES3 =
932+
(eglVersion >= gl::Version(1, 5) || mEGL->hasExtension("EGL_KHR_create_context")) &&
933+
(mRenderer->getMaxSupportedESVersion() >= gl::Version(3, 0));
934+
EGLint renderType = EGL_OPENGL_ES2_BIT | (supportES3 ? EGL_OPENGL_ES3_BIT : 0);
935+
936+
// clang-format off
937+
std::vector<EGLint> configAttribs8888 =
938+
{
939+
EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER,
940+
// CrOS doesn't support window and pixmaps?
941+
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
942+
EGL_CONFIG_CAVEAT, EGL_NONE,
943+
EGL_CONFORMANT, renderType,
944+
EGL_RENDERABLE_TYPE, renderType,
945+
EGL_RED_SIZE, 8,
946+
EGL_GREEN_SIZE, 8,
947+
EGL_BLUE_SIZE, 8,
948+
EGL_ALPHA_SIZE, 8,
949+
EGL_BUFFER_SIZE, 32,
950+
EGL_DEPTH_SIZE, 24,
951+
EGL_NONE
952+
};
953+
// clang-format on
954+
955+
mConfigAttribList = configAttribs8888;
956+
return DisplayEGL::generateConfigs();
945957
}
946958

947959
bool DisplayGbm::isValidNativeWindow(EGLNativeWindowType window) const

0 commit comments

Comments
 (0)