Commit a346c4bbefbb7b4994bc0d6effacb8bb88cf03d5

Ryan C. Gordon 2022-08-09T15:41:02

egl: Add support for SDL_GL_FLOATBUFFERS. Fixes #6001.

diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c
index bd1578a..c768b99 100644
--- a/src/video/SDL_egl.c
+++ b/src/video/SDL_egl.c
@@ -45,6 +45,13 @@
 #endif
 #endif /* EGL_KHR_create_context */
 
+#ifndef EGL_EXT_pixel_format_float
+#define EGL_EXT_pixel_format_float
+#define EGL_COLOR_COMPONENT_TYPE_EXT 0x3339
+#define EGL_COLOR_COMPONENT_TYPE_FIXED_EXT 0x333A
+#define EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT 0x333B
+#endif
+
 #ifndef EGL_EXT_present_opaque
 #define EGL_EXT_present_opaque 1
 #define EGL_PRESENT_OPAQUE_EXT            0x31DF
@@ -762,6 +769,11 @@ SDL_EGL_PrivateChooseConfig(_THIS, SDL_bool set_config_caveat_none)
         attribs[i++] = _this->gl_config.multisamplesamples;
     }
 
+    if (_this->gl_config.floatbuffers) {
+        attribs[i++] = EGL_COLOR_COMPONENT_TYPE_EXT;
+        attribs[i++] = EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT;
+    }
+
     if (_this->egl_data->is_offscreen) {
         attribs[i++] = EGL_SURFACE_TYPE;
         attribs[i++] = EGL_PBUFFER_BIT;