This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch evas-sdl3-rewrite
in repository efl.
View the commit online.
commit 07a5bfcbeca997e96ce648c24ce6177f672b5382
Author: Swagtoy <[email protected]>
AuthorDate: Sat May 23 00:09:02 2026 -0400
gl_sdl: Wire up and start flipping again
It seems to be mostly working now! There's some double buffering
shenanigans going on, but I probably just am not flipping correctly.
Obviously will need some work over time, but this is a good start.
Signed-off-by: Swagtoy <[email protected]>
---
.../ecore_evas/engines/sdl/ecore_evas_sdl.c | 32 ++++++++++++---
.../evas/engines/gl_common/evas_gl_common.h | 4 +-
.../evas/engines/gl_sdl/Evas_Engine_GL_SDL.h | 2 +-
src/modules/evas/engines/gl_sdl/evas_engine.c | 48 +++++++++++++++-------
src/modules/evas/engines/gl_sdl/evas_engine.h | 2 +-
src/modules/evas/engines/gl_sdl/meson.build | 2 +-
6 files changed, 65 insertions(+), 25 deletions(-)
diff --git a/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c b/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c
index 4c08b4069f..fba6c80df6 100644
--- a/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c
+++ b/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c
@@ -14,7 +14,6 @@
#include <Ecore_Sdl.h>
#include <Evas_Engine_Buffer.h>
#include <Evas_Engine_Software_SDL.h>
-// TODO
#ifdef BUILD_ECORE_EVAS_OPENGL_SDL
# include <Evas_Engine_GL_SDL.h>
#endif
@@ -139,7 +138,6 @@ _ecore_evas_sdl_post_render(Ecore_Evas *ee)
ERR("Couldn't blit surface: %s", SDL_GetError());
if (!SDL_UpdateWindowSurface(edata->w))
ERR("Couldn't update window surface: %s", SDL_GetError());
-
}
static Eina_Bool
@@ -381,9 +379,9 @@ static Ecore_Evas_Engine_Func _ecore_sdl_engine_func =
};
static SDL_Window*
-_create_evas_sdl_window(Ecore_Evas *ee, const char *name, int w, int h)
+_create_evas_sdl_window(Ecore_Evas *ee, const char *name, int w, int h, uint64_t props)
{
- SDL_Window *win = SDL_CreateWindow(name, w, h, SDL_WINDOW_RESIZABLE);
+ SDL_Window *win = SDL_CreateWindow(name, w, h, SDL_WINDOW_RESIZABLE | props);
if (!win)
{
ERR("SDL_CreateWindow failed: %s", SDL_GetError());
@@ -398,7 +396,29 @@ _create_evas_sdl_window(Ecore_Evas *ee, const char *name, int w, int h)
static Eina_Bool
_ecore_evas_internal_sdl_new_gl(Ecore_Evas_SDL_Data *edata, Ecore_Evas *ee, const char *name, int rmethod, int w, int h)
{
- ee->can_async_render = EINA_TRUE;
+ evas_output_method_set(ee->evas, rmethod);
+ // TODO: Re-evaulate, was set before, but the window won't show otherwise..
+ ee->can_async_render = EINA_FALSE;
+
+ edata->w = _create_evas_sdl_window(ee, name, w, h, SDL_WINDOW_OPENGL);
+ if (!edata->w)
+ {
+ goto error;
+ }
+
+ Evas_Engine_Info_GL_SDL *einfo = (Evas_Engine_Info_GL_SDL *) evas_engine_info_get(ee->evas);
+ if (!einfo)
+ {
+ ERR("evas_engine_info_get failed.");
+ goto error;
+ }
+
+ einfo->window = edata->w;
+ if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *) einfo))
+ {
+ ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
+ goto error;
+ }
return EINA_TRUE;
@@ -413,7 +433,7 @@ _ecore_evas_internal_sdl_new_soft(Ecore_Evas_SDL_Data *edata, Ecore_Evas *ee, co
ee->func.fn_post_render = _ecore_evas_sdl_post_render;
ee->can_async_render = EINA_FALSE;
- edata->w = _create_evas_sdl_window(ee, name, w, h);
+ edata->w = _create_evas_sdl_window(ee, name, w, h, 0);
if (!edata->w)
{
goto error;
diff --git a/src/modules/evas/engines/gl_common/evas_gl_common.h b/src/modules/evas/engines/gl_common/evas_gl_common.h
index 02bf2dc162..52db3280b6 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -26,9 +26,9 @@
#else
# ifdef _EVAS_ENGINE_SDL_H
# ifdef GL_GLES
-# include <SDL2/SDL_opengles.h>
+# include <SDL3/SDL_opengles.h>
# else
-# include <SDL2/SDL_opengl.h>
+# include <SDL3/SDL_opengl.h>
# endif
# else
# ifdef GL_GLES
diff --git a/src/modules/evas/engines/gl_sdl/Evas_Engine_GL_SDL.h b/src/modules/evas/engines/gl_sdl/Evas_Engine_GL_SDL.h
index 58f333e8e2..77f157a5f5 100644
--- a/src/modules/evas/engines/gl_sdl/Evas_Engine_GL_SDL.h
+++ b/src/modules/evas/engines/gl_sdl/Evas_Engine_GL_SDL.h
@@ -1,7 +1,7 @@
#ifndef _EVAS_ENGINE_GL_SDL_H
#define _EVAS_ENGINE_GL_SDL_H
-#include <SDL2/SDL.h>
+#include <SDL3/SDL.h>
typedef struct _Evas_Engine_Info_GL_SDL Evas_Engine_Info_GL_SDL;
diff --git a/src/modules/evas/engines/gl_sdl/evas_engine.c b/src/modules/evas/engines/gl_sdl/evas_engine.c
index 9f02f3bba0..0bc7321d94 100644
--- a/src/modules/evas/engines/gl_sdl/evas_engine.c
+++ b/src/modules/evas/engines/gl_sdl/evas_engine.c
@@ -12,10 +12,12 @@ Evas_GL_Common_Context_New glsym_evas_gl_common_context_new = NULL;
Evas_GL_Common_Context_Call glsym_evas_gl_common_context_free = NULL;
Evas_GL_Common_Context_Call glsym_evas_gl_common_context_use = NULL;
Evas_GL_Common_Context_Call glsym_evas_gl_common_context_flush = NULL;
+Evas_GL_Common_Context_Call glsym_evas_gl_common_context_newframe = NULL;
Evas_GL_Common_Context_Call glsym_evas_gl_common_image_all_unload = NULL;
Evas_GL_Common_Context_Resize_Call glsym_evas_gl_common_context_resize = NULL;
Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_lock = NULL;
Evas_Gl_Symbols glsym_evas_gl_symbols = NULL;
+typedef const char * (*glGetString_fn)(GLenum);
static Outbuf *_sdl_output_setup(int w, int h, int fullscreen, int noframe, Evas_Engine_Info_GL_SDL *info);
@@ -26,19 +28,34 @@ static Evas_Func func, pfunc;
static void
_outbuf_reconfigure(Outbuf *ob EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED, int rot EINA_UNUSED, Outbuf_Depth depth EINA_UNUSED)
{
+ glsym_evas_gl_common_context_resize(ob->gl_context, w, h, ob->info->flags.rotation);
}
static Eina_Bool
_outbuf_region_first_rect(Outbuf *ob EINA_UNUSED)
{
+ ob->gl_context->preserve_bit = GL_COLOR_BUFFER_BIT0_QCOM;
+
return EINA_FALSE;
}
static void *
_outbuf_new_region_for_update(Outbuf *ob,
- int x EINA_UNUSED, int y EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED,
+ int x , int y , int w , int h ,
int *cx EINA_UNUSED, int *cy EINA_UNUSED, int *cw EINA_UNUSED, int *ch EINA_UNUSED)
{
+ if (w == (int) ob->w && h == (int) ob->h)
+ {
+ ob->gl_context->master_clip.enabled = EINA_FALSE;
+ }
+ else
+ {
+ ob->gl_context->master_clip.enabled = EINA_TRUE;
+ ob->gl_context->master_clip.x = x;
+ ob->gl_context->master_clip.y = y;
+ ob->gl_context->master_clip.w = w;
+ ob->gl_context->master_clip.h = h;
+ }
return ob->gl_context->def_surface;
}
@@ -195,6 +212,7 @@ evgl_eng_window_surface_destroy(void *data EINA_UNUSED,
return 1;
}
+// TODO: Re-evaluate
static void *
evgl_eng_context_create(void *data, void *share_ctx EINA_UNUSED, Evas_GL_Context_Version version)
{
@@ -213,16 +231,16 @@ evgl_eng_context_create(void *data, void *share_ctx EINA_UNUSED, Evas_GL_Context
static int
evgl_eng_context_destroy(void *data EINA_UNUSED, void *context)
{
- SDL_GL_DeleteContext(context);
+ SDL_GL_DestroyContext((SDL_GLContext)context);
return 1;
}
static const char *
evgl_eng_string_get(void *data EINA_UNUSED)
{
- const char *(*glGetString)(GLenum n);
+ glGetString_fn glGetString;
- glGetString = SDL_GL_GetProcAddress("glGetString");
+ glGetString = (glGetString_fn)SDL_GL_GetProcAddress("glGetString");
if (glGetString) return glGetString(GL_EXTENSIONS);
return NULL;
}
@@ -291,7 +309,7 @@ eng_output_setup(void *engine, void *in, unsigned int w, unsigned int h)
_outbuf_free,
_window_use,
_window_gl_context_get,
- _window_egl_display_get,
+ NULL, //_window_egl_display_get,
_window_gl_context_new,
_window_gl_context_use,
&evgl_funcs,
@@ -347,8 +365,9 @@ gl_symbols(void)
LINK2GENERIC(evas_gl_common_context_free);
LINK2GENERIC(evas_gl_common_context_use);
LINK2GENERIC(evas_gl_common_context_flush);
- LINK2GENERIC(evas_gl_common_image_all_unload);
LINK2GENERIC(evas_gl_common_context_resize);
+ LINK2GENERIC(evas_gl_common_context_newframe);
+ LINK2GENERIC(evas_gl_common_image_all_unload);
LINK2GENERIC(evas_gl_preload_render_lock);
// Find EGL extensions
@@ -420,13 +439,12 @@ static Outbuf *
_sdl_output_setup(int w, int h, int fullscreen EINA_UNUSED, int noframe EINA_UNUSED, Evas_Engine_Info_GL_SDL *info)
{
Outbuf *ob = NULL;
- const char *(*glGetString)(GLenum n);
+ glGetString_fn glGetString;
if (!info->window) return NULL;
- if (w <= 0) w = 640;
- if (h <= 0) h = 480;
+ if (w <= 0) w = 1;
+ if (h <= 0) h = 1;
- /* GL Initialization */
#ifdef HAVE_SDL_GL_CONTEXT_VERSION
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
@@ -447,11 +465,11 @@ _sdl_output_setup(int w, int h, int fullscreen EINA_UNUSED, int noframe EINA_UNU
ob->context = SDL_GL_CreateContext(ob->window);
if (!ob->context)
{
- ERR("Impossible to create a context for : %p", info->window);
+ ERR("Cannot create a context for window %p: %s", info->window, SDL_GetError());
goto on_error;
}
- glGetString = SDL_GL_GetProcAddress("glGetString");
+ glGetString = (glGetString_fn)SDL_GL_GetProcAddress("glGetString");
INF("Vendor: '%s', Renderer: '%s', Version: '%s'",
glGetString(GL_VENDOR), glGetString(GL_RENDERER), glGetString(GL_VERSION));
@@ -462,11 +480,13 @@ _sdl_output_setup(int w, int h, int fullscreen EINA_UNUSED, int noframe EINA_UNU
glsym_evas_gl_common_context_use(ob->gl_context);
glsym_evas_gl_common_context_resize(ob->gl_context, w, h, ob->gl_context->rot);
- /* End GL Initialization */
return ob;
on_error:
- if (ob && ob->window) SDL_DestroyWindow(ob->window);
+ if (ob && ob->window)
+ {
+ SDL_DestroyWindow(ob->window);
+ }
free(ob);
return NULL;
}
diff --git a/src/modules/evas/engines/gl_sdl/evas_engine.h b/src/modules/evas/engines/gl_sdl/evas_engine.h
index 968c1e7e08..e0f5422145 100644
--- a/src/modules/evas/engines/gl_sdl/evas_engine.h
+++ b/src/modules/evas/engines/gl_sdl/evas_engine.h
@@ -55,7 +55,7 @@ struct _Outbuf
{
Evas_Engine_Info_GL_SDL *info;
SDL_Window *window;
- SDL_GLContext *context;
+ SDL_GLContext context;
Evas_Engine_GL_Context *gl_context;
struct {
diff --git a/src/modules/evas/engines/gl_sdl/meson.build b/src/modules/evas/engines/gl_sdl/meson.build
index 7b8f464d00..82f17b314c 100644
--- a/src/modules/evas/engines/gl_sdl/meson.build
+++ b/src/modules/evas/engines/gl_sdl/meson.build
@@ -4,7 +4,7 @@ engine_src = files([
'Evas_Engine_GL_SDL.h',
])
-engine_deps += [dependency('sdl3')]
+engine_deps += [dependency('sdl3'), gl_deps]
shared_module(mod_full_name, engine_src,
include_directories : config_dir + [engine_include_dir],
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.