1
0
Fork 0

renderer/native-gles3: Remember to set the glViewport

This is a critical part of any OpenGL program. Mesa allowed us to get
away without it and provided a sane default of the full buffer, but
Nvidia seems to default to an empty/zero viewport so would refuse to
paint any pixels.

In the OpenGL ES 2.0 spec this is ambiguous:

> In the initial state, w and h are set to the width and height,
> respectively, of the window into which the GL is to do its rendering.

because the first "window" used is EGL_NO_SURFACE in
init_secondary_gpu_data_gpu. It has no width or height.

In the OpenGL ES 3.0 spec the ambiguity is somewhat resolved:

> If the default framebuffer is bound but no default framebuffer is
> associated with the GL context (see chapter 4), then w and h are
> initially set to zero.

but not entirely resolved because neither spec says whether
EGL_NO_SURFACE should be treated as zero dimensions (Nvidia) or ignored
and not counted as the first "window" (Mesa).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3304>
This commit is contained in:
Daniel van Vugt 2023-09-29 17:19:16 +08:00 committed by Marge Bot
parent af98776224
commit b065dce194

View file

@ -55,6 +55,8 @@ paint_egl_image (MetaGles3 *gles3,
meta_gles3_clear_error (gles3);
GLBAS (gles3, glViewport, (0, 0, width, height));
GLBAS (gles3, glGenFramebuffers, (1, &framebuffer));
GLBAS (gles3, glBindFramebuffer, (GL_READ_FRAMEBUFFER, framebuffer));