[client] egl: runtime detect support for glEGLImageTargetTexture2DOES

This commit is contained in:
Geoffrey McRae 2021-01-24 12:05:18 +11:00
parent d610aaf2cf
commit 9941a4bb83
3 changed files with 26 additions and 14 deletions

View File

@ -33,6 +33,7 @@ make_object(
add_library(renderer_EGL STATIC add_library(renderer_EGL STATIC
egl.c egl.c
dynprocs.c
debug.c debug.c
shader.c shader.c
texture.c texture.c

View File

@ -37,6 +37,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include <assert.h> #include <assert.h>
#include "app.h" #include "app.h"
#include "dynprocs.h"
#include "model.h" #include "model.h"
#include "shader.h" #include "shader.h"
#include "desktop.h" #include "desktop.h"
@ -629,6 +630,8 @@ bool egl_render_startup(void * opaque, SDL_Window * window)
const char *client_exts = eglQueryString(this->display, EGL_EXTENSIONS); const char *client_exts = eglQueryString(this->display, EGL_EXTENSIONS);
const char *vendor = (const char *)glGetString(GL_VENDOR); const char *vendor = (const char *)glGetString(GL_VENDOR);
egl_DynProcsInit();
DEBUG_INFO("EGL : %d.%d", maj, min); DEBUG_INFO("EGL : %d.%d", maj, min);
DEBUG_INFO("Vendor : %s", vendor); DEBUG_INFO("Vendor : %s", vendor);
DEBUG_INFO("Renderer : %s", glGetString(GL_RENDERER)); DEBUG_INFO("Renderer : %s", glGetString(GL_RENDERER));
@ -636,6 +639,8 @@ bool egl_render_startup(void * opaque, SDL_Window * window)
DEBUG_INFO("EGL APIs : %s", eglQueryString(this->display, EGL_CLIENT_APIS)); DEBUG_INFO("EGL APIs : %s", eglQueryString(this->display, EGL_CLIENT_APIS));
DEBUG_INFO("Extensions: %s", client_exts); DEBUG_INFO("Extensions: %s", client_exts);
if (g_dynprocs.glEGLImageTargetTexture2DOES)
{
if (strstr(client_exts, "EGL_EXT_image_dma_buf_import") != NULL) if (strstr(client_exts, "EGL_EXT_image_dma_buf_import") != NULL)
{ {
/* /*
@ -651,6 +656,11 @@ bool egl_render_startup(void * opaque, SDL_Window * window)
else else
this->dmaSupport = true; this->dmaSupport = true;
} }
}
else
{
DEBUG_INFO("glEGLImageTargetTexture2DOES unavilable, DMA support disabled");
}
eglSwapInterval(this->display, this->opt.vsync ? 1 : 0); eglSwapInterval(this->display, this->opt.vsync ? 1 : 0);

View File

@ -21,6 +21,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include "common/debug.h" #include "common/debug.h"
#include "common/framebuffer.h" #include "common/framebuffer.h"
#include "debug.h" #include "debug.h"
#include "dynprocs.h"
#include "utils.h" #include "utils.h"
#include <stdlib.h> #include <stdlib.h>
@ -392,7 +393,7 @@ bool egl_texture_update_from_dma(EGL_Texture * texture, const FrameBuffer * fram
/* bind the texture and initiate the transfer */ /* bind the texture and initiate the transfer */
glBindTexture(GL_TEXTURE_2D, texture->tex); glBindTexture(GL_TEXTURE_2D, texture->tex);
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image); g_dynprocs.glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
/* wait for completion */ /* wait for completion */
framebuffer_wait(frame, texture->height * texture->stride); framebuffer_wait(frame, texture->height * texture->stride);