Skip to content

Commit 26e06db

Browse files
committed
Remove unnecessary ANativeWindow_SetBuffersGeometry() call.
- We don't have to call the API unless want to have different buffer size than the native resolution. - This was causing broken rendering on some devices.
1 parent 8f5216d commit 26e06db

File tree

2 files changed

+1
-17
lines changed

2 files changed

+1
-17
lines changed

samples-android/Common/ndk_helper/GLContext.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,6 @@ bool GLContext::InitEGLSurface() {
136136
eglQuerySurface(display_, surface_, EGL_WIDTH, &screen_width_);
137137
eglQuerySurface(display_, surface_, EGL_HEIGHT, &screen_height_);
138138

139-
/* EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is
140-
* guaranteed to be accepted by ANativeWindow_setBuffersGeometry().
141-
* As soon as we picked a EGLConfig, we can safely reconfigure the
142-
* ANativeWindow buffers to match, using EGL_NATIVE_VISUAL_ID. */
143-
EGLint format;
144-
eglGetConfigAttrib(display_, config_, EGL_NATIVE_VISUAL_ID, &format);
145-
ANativeWindow_setBuffersGeometry(window_, 0, 0, format);
146-
147139
return true;
148140
}
149141

samples-android/Minimalist/src/main/jni/main.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static int engine_init_display(struct engine* engine) {
9494
const EGLint attribs[] = {EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_BLUE_SIZE,
9595
8, EGL_GREEN_SIZE, 8,
9696
EGL_RED_SIZE, 8, EGL_NONE};
97-
EGLint w, h, dummy, format;
97+
EGLint w, h, dummy;
9898
EGLint numConfigs;
9999
EGLConfig config;
100100
EGLSurface surface;
@@ -109,14 +109,6 @@ static int engine_init_display(struct engine* engine) {
109109
* the first EGLConfig that matches our criteria */
110110
eglChooseConfig(display, attribs, &config, 1, &numConfigs);
111111

112-
/* EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is
113-
* guaranteed to be accepted by ANativeWindow_setBuffersGeometry().
114-
* As soon as we picked a EGLConfig, we can safely reconfigure the
115-
* ANativeWindow buffers to match, using EGL_NATIVE_VISUAL_ID. */
116-
eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &format);
117-
118-
ANativeWindow_setBuffersGeometry(engine->app->window, 0, 0, format);
119-
120112
surface = eglCreateWindowSurface(display, config, engine->app->window, NULL);
121113
context = eglCreateContext(display, config, NULL, NULL);
122114

0 commit comments

Comments
 (0)