(EGL) Cleanups

(GLSL) Buildfix
This commit is contained in:
libretroadmin 2023-02-21 21:09:47 +01:00
parent d47bbe5cc1
commit cc85d7fd6d
2 changed files with 36 additions and 36 deletions

View File

@ -125,11 +125,9 @@ bool egl_init_dll(void)
{ {
#if defined(HAVE_DYLIB) && defined(HAVE_DYNAMIC_EGL) #if defined(HAVE_DYLIB) && defined(HAVE_DYNAMIC_EGL)
static dylib_t egl_dll; static dylib_t egl_dll;
if (!egl_dll) if (!egl_dll)
{ {
egl_dll = dylib_load("libEGL.dll"); if ((egl_dll = dylib_load("libEGL.dll")))
if (egl_dll)
{ {
/* Setup function callbacks once */ /* Setup function callbacks once */
_egl_query_surface = (PFN_EGL_QUERY_SURFACE)dylib_proc( _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) void egl_swap_buffers(void *data)
{ {
egl_ctx_data_t *egl = (egl_ctx_data_t*)data; egl_ctx_data_t *egl = (egl_ctx_data_t*)data;
if ( egl && if ( (egl)
egl->dpy != EGL_NO_DISPLAY && && (egl->dpy != EGL_NO_DISPLAY)
egl->surf != EGL_NO_SURFACE && (egl->surf != EGL_NO_SURFACE)
) )
_egl_swap_buffers(egl->dpy, egl->surf); _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; egl->interval = interval;
if (egl->dpy == EGL_NO_DISPLAY) if (egl->dpy == EGL_NO_DISPLAY)
return; return;
if (!_egl_get_current_context()) if (!_egl_get_current_context())
return; 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) 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); const char *str = _egl_query_string(EGL_NO_DISPLAY, EGL_VERSION);
if (!str) if (str)
return false; {
int major, minor;
if (sscanf(str, "%d.%d", &major, &minor) != 2) if (sscanf(str, "%d.%d", &major, &minor) == 2)
return false; {
if (major >= min_major_version)
if (major < min_major_version) {
return false; if (major > min_major_version)
return true;
if (major > min_major_version) else if (minor >= min_minor_version)
return true; return true;
}
if (minor >= min_minor_version) }
return true; }
return false; return false;
} }
#endif
#if defined(EGL_EXT_platform_base)
static bool check_egl_client_extension(const char *name, size_t name_len) static bool check_egl_client_extension(const char *name, size_t name_len)
{ {
const char *str = _egl_query_string(EGL_NO_DISPLAY, EGL_EXTENSIONS); const char *str = _egl_query_string(EGL_NO_DISPLAY, EGL_EXTENSIONS);
/* The EGL implementation doesn't support client extensions at all. */ /* The EGL implementation doesn't support client extensions at all. */
if (!str) if (str)
return false;
while (*str != '\0')
{ {
/* Use strspn and strcspn to find the start position and length of each while (*str != '\0')
* token in the extension string. Using strtok could also work, but {
* that would require allocating a copy of the string. */ /* Use strspn and strcspn to find the start position and length of each
size_t len = strcspn(str, " "); * token in the extension string. Using strtok could also work, but
if (len == name_len && strncmp(str, name, name_len) == 0) * that would require allocating a copy of the string. */
return true; size_t len = strcspn(str, " ");
str += len; if (len == name_len && strncmp(str, name, name_len) == 0)
str += strspn(str, " "); return true;
str += len;
str += strspn(str, " ");
}
} }
return false; return false;
} }
#endif
static EGLDisplay get_egl_display(EGLenum platform, void *native) static EGLDisplay get_egl_display(EGLenum platform, void *native)
{ {

View File

@ -37,6 +37,7 @@
#include "../../state_manager.h" #include "../../state_manager.h"
#endif #endif
#include "../../core.h" #include "../../core.h"
#include "../../retroarch.h"
#include "../../verbosity.h" #include "../../verbosity.h"
#if defined(ORBIS) #if defined(ORBIS)
@ -1332,9 +1333,7 @@ static void gl_glsl_set_params(void *dat, void *shader_data)
} }
if (uni->rotation >= 0) if (uni->rotation >= 0)
{
glUniform1i(uni->rotation, retroarch_get_rotation()); glUniform1i(uni->rotation, retroarch_get_rotation());
}
/* Set lookup textures. */ /* Set lookup textures. */
for (i = 0; i < glsl->shader->luts; i++) for (i = 0; i < glsl->shader->luts; i++)