Skip to content

Commit 4c9670b

Browse files
dos1SiegeLord
authored andcommitted
Add missing GLES flag setup on display creation on various platforms
1 parent e8222b1 commit 4c9670b

File tree

8 files changed

+56
-10
lines changed

8 files changed

+56
-10
lines changed

android/gradle_project/allegro/src/main/java/org/liballeg/android/AllegroEGL.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ void egl_getConfigAttribs(int index, int ret[])
187187
/* Return values:
188188
* 0 - failure
189189
* 1 - success
190-
* 2 - fell back to older ES version XXX never happens
191190
*/
192191
int egl_createContext(int configIndex, boolean programmable_pipeline)
193192
{

src/android/android_display.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,6 @@ static bool _al_android_init_display(JNIEnv *env,
279279
return false;
280280
}
281281

282-
// XXX ret is never 2
283-
if (ret == 2 && programmable_pipeline) {
284-
d->flags &= ~ALLEGRO_PROGRAMMABLE_PIPELINE;
285-
}
286-
287282
ALLEGRO_DEBUG("calling egl_createSurface");
288283
if (!_jni_callBooleanMethodV(env, display->surface_object,
289284
"egl_createSurface", "()Z"))
@@ -557,6 +552,12 @@ static ALLEGRO_DISPLAY *android_create_display(int w, int h)
557552
}
558553

559554
display->flags |= ALLEGRO_OPENGL;
555+
#ifdef ALLEGRO_CFG_OPENGLES2
556+
display->flags |= ALLEGRO_PROGRAMMABLE_PIPELINE;
557+
#endif
558+
#ifdef ALLEGRO_CFG_OPENGLES
559+
display->flags |= ALLEGRO_OPENGL_ES_PROFILE;
560+
#endif
560561

561562
ALLEGRO_DEBUG("display: %p %ix%i", display, display->w, display->h);
562563

src/gp2xwiz/wiz_display_opengl.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ static ALLEGRO_DISPLAY *gp2xwiz_create_display_ogl(int w, int h)
7070

7171
// FIXME: default? Is this the right place to set this?
7272
display->flags |= ALLEGRO_OPENGL;
73+
#ifdef ALLEGRO_CFG_OPENGLES2
74+
display->flags |= ALLEGRO_PROGRAMMABLE_PIPELINE;
75+
#endif
76+
#ifdef ALLEGRO_CFG_OPENGLES
77+
display->flags |= ALLEGRO_OPENGL_ES_PROFILE;
78+
#endif
7379
display->flags |= ALLEGRO_FULLSCREEN;
7480

7581
/* Add ourself to the list of displays. */

src/iphone/iphone_display.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,14 @@ void _al_iphone_update_visuals(void)
192192

193193
memcpy(&display->extra_settings, eds[0], sizeof(ALLEGRO_EXTRA_DISPLAY_SETTINGS));
194194

195+
display->flags |= ALLEGRO_OPENGL;
196+
#ifdef ALLEGRO_CFG_OPENGLES2
197+
display->flags |= ALLEGRO_PROGRAMMABLE_PIPELINE;
198+
#endif
199+
#ifdef ALLEGRO_CFG_OPENGLES
200+
display->flags |= ALLEGRO_OPENGL_ES_PROFILE;
201+
#endif
202+
195203
/* This will add an OpenGL view with an OpenGL context, then return. */
196204
if (!_al_iphone_add_view(display)) {
197205
/* FIXME: cleanup */
@@ -207,8 +215,6 @@ void _al_iphone_update_visuals(void)
207215
_al_ogl_set_extensions(ogl->extension_api);
208216
_al_iphone_setup_opengl_view(display, true);
209217

210-
display->flags |= ALLEGRO_OPENGL;
211-
212218
int ndisplays = system->system.displays._size;
213219
[[UIApplication sharedApplication] setIdleTimerDisabled:(ndisplays > 1)];
214220

src/macosx/osxgl.m

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,12 @@ +(void) runFullScreenDisplay: (NSValue*) display_object
12611261
dpy->parent.vt = _al_osx_get_display_driver_fs();
12621262
dpy->parent.refresh_rate = al_get_new_display_refresh_rate();
12631263
dpy->parent.flags = al_get_new_display_flags() | ALLEGRO_OPENGL | ALLEGRO_FULLSCREEN;
1264+
#ifdef ALLEGRO_CFG_OPENGLES2
1265+
dpy->parent.flags |= ALLEGRO_PROGRAMMABLE_PIPELINE;
1266+
#endif
1267+
#ifdef ALLEGRO_CFG_OPENGLES
1268+
dpy->parent.flags |= ALLEGRO_OPENGL_ES_PROFILE;
1269+
#endif
12641270
dpy->parent.w = w;
12651271
dpy->parent.h = h;
12661272
_al_event_source_init(&dpy->parent.es);
@@ -1441,6 +1447,12 @@ +(void) runFullScreenDisplay: (NSValue*) display_object
14411447
dpy->parent.vt = _al_osx_get_display_driver_win();
14421448
dpy->parent.refresh_rate = al_get_new_display_refresh_rate();
14431449
dpy->parent.flags = al_get_new_display_flags() | ALLEGRO_OPENGL | ALLEGRO_FULLSCREEN;
1450+
#ifdef ALLEGRO_CFG_OPENGLES2
1451+
dpy->parent.flags |= ALLEGRO_PROGRAMMABLE_PIPELINE;
1452+
#endif
1453+
#ifdef ALLEGRO_CFG_OPENGLES
1454+
dpy->parent.flags |= ALLEGRO_OPENGL_ES_PROFILE;
1455+
#endif
14441456
dpy->parent.w = w;
14451457
dpy->parent.h = h;
14461458
_al_event_source_init(&dpy->parent.es);
@@ -1602,6 +1614,12 @@ +(void) runFullScreenDisplay: (NSValue*) display_object
16021614
dpy->parent.vt = _al_osx_get_display_driver_win();
16031615
dpy->parent.refresh_rate = al_get_new_display_refresh_rate();
16041616
dpy->parent.flags = al_get_new_display_flags() | ALLEGRO_OPENGL | ALLEGRO_WINDOWED;
1617+
#ifdef ALLEGRO_CFG_OPENGLES2
1618+
dpy->parent.flags |= ALLEGRO_PROGRAMMABLE_PIPELINE;
1619+
#endif
1620+
#ifdef ALLEGRO_CFG_OPENGLES
1621+
dpy->parent.flags |= ALLEGRO_OPENGL_ES_PROFILE;
1622+
#endif
16051623
dpy->parent.w = w;
16061624
dpy->parent.h = h;
16071625
_al_event_source_init(&dpy->parent.es);

src/raspberrypi/pidisplay.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,14 @@ static ALLEGRO_DISPLAY *raspberrypi_create_display(int w, int h)
420420
display->w = w;
421421
display->h = h;
422422

423+
display->flags |= ALLEGRO_OPENGL;
424+
#ifdef ALLEGRO_CFG_OPENGLES2
425+
display->flags |= ALLEGRO_PROGRAMMABLE_PIPELINE;
426+
#endif
427+
#ifdef ALLEGRO_CFG_OPENGLES
428+
display->flags |= ALLEGRO_OPENGL_ES_PROFILE;
429+
#endif
430+
423431
if (!pi_create_display(display)) {
424432
// FIXME: cleanup
425433
return NULL;
@@ -469,8 +477,6 @@ static ALLEGRO_DISPLAY *raspberrypi_create_display(int w, int h)
469477

470478
al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA);
471479

472-
display->flags |= ALLEGRO_OPENGL;
473-
474480
if (al_is_mouse_installed() && !getenv("DISPLAY")) {
475481
_al_evdev_set_mouse_range(0, 0, display->w-1, display->h-1);
476482
}

src/sdl/sdl_display.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ static ALLEGRO_DISPLAY *sdl_create_display_locked(int w, int h)
9191
d->flags |= ALLEGRO_OPENGL;
9292
#ifdef ALLEGRO_CFG_OPENGLES2
9393
d->flags |= ALLEGRO_PROGRAMMABLE_PIPELINE;
94+
#endif
95+
#ifdef ALLEGRO_CFG_OPENGLES
96+
d->flags |= ALLEGRO_OPENGL_ES_PROFILE;
9497
#endif
9598
int flags = SDL_WINDOW_OPENGL;
9699
if (d->flags & ALLEGRO_FULLSCREEN)

src/win/wgl_disp.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,7 @@ static bool create_display_internals(ALLEGRO_DISPLAY_WGL *wgl_disp)
964964
minor = _al_get_suggested_display_option(disp,
965965
ALLEGRO_OPENGL_MINOR_VERSION, 0);
966966

967+
// TODO: request GLES context in GLES builds
967968
if ((disp->flags & ALLEGRO_OPENGL_3_0) || major != 0) {
968969
if (major == 0)
969970
major = 3;
@@ -1045,6 +1046,12 @@ static ALLEGRO_DISPLAY* wgl_create_display(int w, int h)
10451046
display->h = h;
10461047
display->refresh_rate = al_get_new_display_refresh_rate();
10471048
display->flags = al_get_new_display_flags();
1049+
#ifdef ALLEGRO_CFG_OPENGLES2
1050+
display->flags |= ALLEGRO_PROGRAMMABLE_PIPELINE;
1051+
#endif
1052+
#ifdef ALLEGRO_CFG_OPENGLES
1053+
display->flags |= ALLEGRO_OPENGL_ES_PROFILE;
1054+
#endif
10481055
display->vt = &vt;
10491056

10501057
display->ogl_extras = al_calloc(1, sizeof(ALLEGRO_OGL_EXTRAS));

0 commit comments

Comments
 (0)