Bug 1753349 (2/9): refactor: inline `size` argument to `GLContextEGL::CreateEGLPBufferOffscreenContext` r=jgilbert

This is basically an implementation detail that the existing callers doesn't really need to know.
Factor it out.

Split out from @jgilbert's D164308.

Differential Revision: https://phabricator.services.mozilla.com/D166707
This commit is contained in:
Erich Gubler 2023-01-19 04:47:51 +00:00
Родитель 2d888dbae4
Коммит 5ae49e0bf7
3 изменённых файлов: 10 добавлений и 11 удалений

Просмотреть файл

@ -102,7 +102,7 @@ class GLContextEGL final : public GLContext {
static RefPtr<GLContextEGL> CreateEGLPBufferOffscreenContext(
std::shared_ptr<EglDisplay>, const GLContextCreateDesc&,
const gfx::IntSize& size, nsACString* const out_FailureId);
nsACString* const out_FailureId);
static RefPtr<GLContextEGL> CreateEGLSurfacelessContext(
const std::shared_ptr<EglDisplay> display,
const GLContextCreateDesc& desc, nsACString* const out_failureId);

Просмотреть файл

@ -1127,7 +1127,7 @@ bool GLContextEGL::FindVisual(int* const out_visualId) {
/*static*/
RefPtr<GLContextEGL> GLContextEGL::CreateEGLPBufferOffscreenContext(
const std::shared_ptr<EglDisplay> egl, const GLContextCreateDesc& desc,
const mozilla::gfx::IntSize& size, nsACString* const out_failureId) {
nsACString* const out_failureId) {
const auto WithUseGles = [&](const bool useGles) -> RefPtr<GLContextEGL> {
const EGLConfig config = ChooseConfig(*egl, desc, useGles);
if (config == EGL_NO_CONFIG) {
@ -1140,16 +1140,17 @@ RefPtr<GLContextEGL> GLContextEGL::CreateEGLPBufferOffscreenContext(
egl->DumpEGLConfig(config);
}
mozilla::gfx::IntSize pbSize(size);
auto dummySize = mozilla::gfx::IntSize{16, 16};
EGLSurface surface = nullptr;
#ifdef MOZ_WAYLAND
if (GdkIsWaylandDisplay()) {
surface = GLContextEGL::CreateWaylandBufferSurface(*egl, config, pbSize);
surface =
GLContextEGL::CreateWaylandBufferSurface(*egl, config, dummySize);
} else
#endif
{
surface = GLContextEGL::CreatePBufferSurfaceTryingPowerOfTwo(
*egl, config, LOCAL_EGL_NONE, pbSize);
*egl, config, LOCAL_EGL_NONE, dummySize);
}
if (!surface) {
*out_failureId = "FEATURE_FAILURE_EGL_POT"_ns;
@ -1195,9 +1196,8 @@ already_AddRefed<GLContext> GLContextProviderEGL::CreateHeadless(
if (!display) {
return nullptr;
}
mozilla::gfx::IntSize dummySize = mozilla::gfx::IntSize(16, 16);
auto ret = GLContextEGL::CreateEGLPBufferOffscreenContext(
display, desc, dummySize, out_failureId);
auto ret = GLContextEGL::CreateEGLPBufferOffscreenContext(display, desc,
out_failureId);
return ret.forget();
}

Просмотреть файл

@ -1267,9 +1267,8 @@ static already_AddRefed<gl::GLContext> CreateGLContextANGLE(
// Create GLContext with dummy EGLSurface, the EGLSurface is not used.
// Instread we override it with EGLSurface of SwapChain's back buffer.
const auto dummySize = mozilla::gfx::IntSize(16, 16);
auto gl = gl::GLContextEGL::CreateEGLPBufferOffscreenContext(
egl, {flags}, dummySize, &failureId);
auto gl = gl::GLContextEGL::CreateEGLPBufferOffscreenContext(egl, {flags},
&failureId);
if (!gl || !gl->IsANGLE()) {
aError.Assign(nsPrintfCString("RcANGLE(create GL context failed: %p, %s)",
gl.get(), failureId.get()));