mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-23 05:53:40 +00:00
[client] egl: properly use OpenGL ES
Instead of using the desktop <GL/gl.h>, we properly use the OpenGL ES 3.x headers. Also, we now use GL_EXT_buffer_storage for MAP_PERSISTENT_BIT_EXT and MAP_COHERENT_BIT_EXT as the core versions are only available in desktop OpenGL 4.4. Similarly, we need GL_EXT_texture_format_BGRA8888 for GL_BGRA_EXT as GL_BGRA is desktop-only.
This commit is contained in:
parent
ab31040d5f
commit
7c872d2d9e
@ -23,7 +23,8 @@
|
||||
#ifdef ENABLE_EGL
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GLES3/gl3.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
|
||||
typedef EGLDisplay (*eglGetPlatformDisplayEXT_t)(EGLenum platform,
|
||||
void *native_display, const EGLint *attrib_list);
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "dynamic/fonts.h"
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <GLES3/gl32.h>
|
||||
|
||||
#include "cimgui.h"
|
||||
#include "generator/output/cimgui_impl.h"
|
||||
@ -827,6 +828,18 @@ bool egl_render_startup(void * opaque)
|
||||
glGetIntegerv(GL_MAJOR_VERSION, &esMaj);
|
||||
glGetIntegerv(GL_MINOR_VERSION, &esMin);
|
||||
|
||||
if (!util_hasGLExt(gl_exts, "GL_EXT_buffer_storage"))
|
||||
{
|
||||
DEBUG_ERROR("GL_EXT_buffer_storage is needed to use EGL backend");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!util_hasGLExt(gl_exts, "GL_EXT_texture_format_BGRA8888"))
|
||||
{
|
||||
DEBUG_ERROR("GL_EXT_texture_format_BGRA8888 is needed to use EGL backend");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (g_egl_dynProcs.glEGLImageTargetTexture2DOES)
|
||||
{
|
||||
if (util_hasGLExt(client_exts, "EGL_EXT_image_dma_buf_import"))
|
||||
|
@ -19,7 +19,6 @@
|
||||
*/
|
||||
|
||||
#include "egldebug.h"
|
||||
#include <GL/gl.h>
|
||||
#include <EGL/egl.h>
|
||||
|
||||
const char * egl_getErrorStr(void)
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "shader.h"
|
||||
#include "texture.h"
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GLES3/gl3.h>
|
||||
|
||||
typedef struct EGL_Model EGL_Model;
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GLES3/gl3.h>
|
||||
|
||||
typedef struct EGL_Shader EGL_Shader;
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "shader.h"
|
||||
#include "model.h"
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GLES3/gl3.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
@ -150,8 +150,8 @@ static bool egl_texture_map(EGL_Texture * texture, uint8_t i)
|
||||
GL_MAP_WRITE_BIT |
|
||||
GL_MAP_UNSYNCHRONIZED_BIT |
|
||||
GL_MAP_INVALIDATE_BUFFER_BIT |
|
||||
GL_MAP_PERSISTENT_BIT |
|
||||
GL_MAP_COHERENT_BIT
|
||||
GL_MAP_PERSISTENT_BIT_EXT |
|
||||
GL_MAP_COHERENT_BIT_EXT
|
||||
);
|
||||
|
||||
if (!texture->buf[i].map)
|
||||
@ -209,8 +209,8 @@ bool egl_texture_setup(EGL_Texture * texture, enum EGL_PixelFormat pixFmt, size_
|
||||
{
|
||||
case EGL_PF_BGRA:
|
||||
texture->bpp = 4;
|
||||
texture->format = GL_BGRA;
|
||||
texture->intFormat = GL_BGRA;
|
||||
texture->format = GL_BGRA_EXT;
|
||||
texture->intFormat = GL_BGRA_EXT;
|
||||
texture->dataType = GL_UNSIGNED_BYTE;
|
||||
texture->fourcc = DRM_FORMAT_ARGB8888;
|
||||
texture->pboBufferSize = height * stride;
|
||||
@ -219,7 +219,7 @@ bool egl_texture_setup(EGL_Texture * texture, enum EGL_PixelFormat pixFmt, size_
|
||||
case EGL_PF_RGBA:
|
||||
texture->bpp = 4;
|
||||
texture->format = GL_RGBA;
|
||||
texture->intFormat = GL_BGRA;
|
||||
texture->intFormat = GL_RGBA;
|
||||
texture->dataType = GL_UNSIGNED_BYTE;
|
||||
texture->fourcc = DRM_FORMAT_ABGR8888;
|
||||
texture->pboBufferSize = height * stride;
|
||||
@ -300,13 +300,13 @@ bool egl_texture_setup(EGL_Texture * texture, enum EGL_PixelFormat pixFmt, size_
|
||||
texture->buf[i].hasPBO = true;
|
||||
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, texture->buf[i].pbo);
|
||||
glBufferStorage(
|
||||
glBufferStorageEXT(
|
||||
GL_PIXEL_UNPACK_BUFFER,
|
||||
texture->pboBufferSize,
|
||||
NULL,
|
||||
GL_MAP_WRITE_BIT |
|
||||
GL_MAP_PERSISTENT_BIT |
|
||||
GL_MAP_COHERENT_BIT
|
||||
GL_MAP_WRITE_BIT |
|
||||
GL_MAP_PERSISTENT_BIT_EXT |
|
||||
GL_MAP_COHERENT_BIT_EXT
|
||||
);
|
||||
|
||||
if (!egl_texture_map(texture, i))
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "shader.h"
|
||||
#include "common/framebuffer.h"
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user