From a346c4bbefbb7b4994bc0d6effacb8bb88cf03d5 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Tue, 9 Aug 2022 15:41:02 -0400
Subject: [PATCH] egl: Add support for SDL_GL_FLOATBUFFERS.
Fixes #6001.
---
src/video/SDL_egl.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c
index bd1578a7dce..c768b991482 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;