From cc85d7fd6dc7b7d8308a59056bcc085a5b21e3a0 Mon Sep 17 00:00:00 2001 From: libretroadmin Date: Tue, 21 Feb 2023 21:09:47 +0100 Subject: [PATCH] (EGL) Cleanups (GLSL) Buildfix --- gfx/common/egl_common.c | 69 ++++++++++++++++---------------- gfx/drivers_shader/shader_glsl.c | 3 +- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/gfx/common/egl_common.c b/gfx/common/egl_common.c index ebc71c4e3d..6ee1ac38f9 100644 --- a/gfx/common/egl_common.c +++ b/gfx/common/egl_common.c @@ -125,11 +125,9 @@ bool egl_init_dll(void) { #if defined(HAVE_DYLIB) && defined(HAVE_DYNAMIC_EGL) static dylib_t egl_dll; - if (!egl_dll) { - egl_dll = dylib_load("libEGL.dll"); - if (egl_dll) + if ((egl_dll = dylib_load("libEGL.dll"))) { /* Setup function callbacks once */ _egl_query_surface = (PFN_EGL_QUERY_SURFACE)dylib_proc( @@ -329,9 +327,9 @@ void egl_bind_hw_render(egl_ctx_data_t *egl, bool enable) void egl_swap_buffers(void *data) { egl_ctx_data_t *egl = (egl_ctx_data_t*)data; - if ( egl && - egl->dpy != EGL_NO_DISPLAY && - egl->surf != EGL_NO_SURFACE + if ( (egl) + && (egl->dpy != EGL_NO_DISPLAY) + && (egl->surf != EGL_NO_SURFACE) ) _egl_swap_buffers(egl->dpy, egl->surf); } @@ -344,7 +342,7 @@ void egl_set_swap_interval(egl_ctx_data_t *egl, int interval) */ egl->interval = interval; - if (egl->dpy == EGL_NO_DISPLAY) + if (egl->dpy == EGL_NO_DISPLAY) return; if (!_egl_get_current_context()) return; @@ -372,51 +370,54 @@ void egl_get_video_size(egl_ctx_data_t *egl, unsigned *width, unsigned *height) } } +#if defined(EGL_VERSION_1_5) static bool check_egl_version(int min_major_version, int min_minor_version) { - int major, minor; const char *str = _egl_query_string(EGL_NO_DISPLAY, EGL_VERSION); - if (!str) - return false; - - if (sscanf(str, "%d.%d", &major, &minor) != 2) - return false; - - if (major < min_major_version) - return false; - - if (major > min_major_version) - return true; - - if (minor >= min_minor_version) - return true; + if (str) + { + int major, minor; + if (sscanf(str, "%d.%d", &major, &minor) == 2) + { + if (major >= min_major_version) + { + if (major > min_major_version) + return true; + else if (minor >= min_minor_version) + return true; + } + } + } return false; } +#endif +#if defined(EGL_EXT_platform_base) static bool check_egl_client_extension(const char *name, size_t name_len) { const char *str = _egl_query_string(EGL_NO_DISPLAY, EGL_EXTENSIONS); /* The EGL implementation doesn't support client extensions at all. */ - if (!str) - return false; - - while (*str != '\0') + if (str) { - /* Use strspn and strcspn to find the start position and length of each - * token in the extension string. Using strtok could also work, but - * that would require allocating a copy of the string. */ - size_t len = strcspn(str, " "); - if (len == name_len && strncmp(str, name, name_len) == 0) - return true; - str += len; - str += strspn(str, " "); + while (*str != '\0') + { + /* Use strspn and strcspn to find the start position and length of each + * token in the extension string. Using strtok could also work, but + * that would require allocating a copy of the string. */ + size_t len = strcspn(str, " "); + if (len == name_len && strncmp(str, name, name_len) == 0) + return true; + str += len; + str += strspn(str, " "); + } } return false; } +#endif static EGLDisplay get_egl_display(EGLenum platform, void *native) { diff --git a/gfx/drivers_shader/shader_glsl.c b/gfx/drivers_shader/shader_glsl.c index e1ef0f42a0..81a7b3727d 100644 --- a/gfx/drivers_shader/shader_glsl.c +++ b/gfx/drivers_shader/shader_glsl.c @@ -37,6 +37,7 @@ #include "../../state_manager.h" #endif #include "../../core.h" +#include "../../retroarch.h" #include "../../verbosity.h" #if defined(ORBIS) @@ -1332,9 +1333,7 @@ static void gl_glsl_set_params(void *dat, void *shader_data) } if (uni->rotation >= 0) - { glUniform1i(uni->rotation, retroarch_get_rotation()); - } /* Set lookup textures. */ for (i = 0; i < glsl->shader->luts; i++)