From b065dce194625983c7e2afbc02d79932fef86dc7 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Fri, 29 Sep 2023 17:19:16 +0800 Subject: [PATCH] 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: --- src/backends/native/meta-renderer-native-gles3.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backends/native/meta-renderer-native-gles3.c b/src/backends/native/meta-renderer-native-gles3.c index fbdcb87b8..e936042e0 100644 --- a/src/backends/native/meta-renderer-native-gles3.c +++ b/src/backends/native/meta-renderer-native-gles3.c @@ -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));