diff --git a/Makefile b/Makefile index acf4054dbf..eb3b29f076 100644 --- a/Makefile +++ b/Makefile @@ -221,12 +221,12 @@ ifeq ($(HAVE_OPENGL), 1) endif endif + DEFINES += -DHAVE_GL_SYNC ifeq ($(HAVE_GLES), 1) LIBS += -lGLESv2 DEFINES += -DHAVE_OPENGLES -DHAVE_OPENGLES2 OBJ += gfx/glsym/glsym_es2.o else - DEFINES += -DHAVE_GL_SYNC OBJ += gfx/glsym/glsym_gl.o ifeq ($(OSX), 1) LIBS += -framework OpenGL diff --git a/gfx/gl.c b/gfx/gl.c index 884aeb37bc..72663f42a2 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -142,9 +142,20 @@ static bool check_eglimage_proc(void) #endif #ifdef HAVE_GL_SYNC +#ifdef HAVE_OPENGLES2 +#define glFenceSync glFenceSyncAPPLE +#define glDeleteSync glDeleteSyncAPPLE +#define glClientWaitSync glClientWaitSyncAPPLE +#define GL_SYNC_GPU_COMMANDS_COMPLETE GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE +#define GL_SYNC_FLUSH_COMMANDS_BIT GL_SYNC_FLUSH_COMMANDS_BIT_APPLE +#endif static bool check_sync_proc(gl_t *gl) { +#ifdef HAVE_OPENGLES + if (!gl_query_extension(gl, "APPLE_sync")) +#else if (!gl_query_extension(gl, "ARB_sync")) +#endif return false; return glFenceSync && glDeleteSync && glClientWaitSync; diff --git a/gfx/glsym/glgen.py b/gfx/glsym/glgen.py index 0d07fbbf92..a749fe5851 100755 --- a/gfx/glsym/glgen.py +++ b/gfx/glsym/glgen.py @@ -25,7 +25,7 @@ import sys import os import re -banned_ext = [ 'AMD', 'APPLE', 'EXT', 'NV', 'NVX', 'ATI', '3DLABS', 'SUN', 'SGI', 'SGIX', 'SGIS', 'INTEL', '3DFX', 'IBM', 'MESA', 'GREMEDY', 'OML', 'PGI', 'I3D', 'INGL', 'MTX', 'QCOM', 'IMG', 'ANGLE', 'SUNX', 'INGR' ] +banned_ext = [ 'AMD', 'EXT', 'NV', 'NVX', 'ATI', '3DLABS', 'SUN', 'SGI', 'SGIX', 'SGIS', 'INTEL', '3DFX', 'IBM', 'MESA', 'GREMEDY', 'OML', 'PGI', 'I3D', 'INGL', 'MTX', 'QCOM', 'IMG', 'ANGLE', 'SUNX', 'INGR' ] def noext(sym): for ext in banned_ext: diff --git a/gfx/glsym/glsym_es2.c b/gfx/glsym/glsym_es2.c index 26f2a44e72..19132195af 100644 --- a/gfx/glsym/glsym_es2.c +++ b/gfx/glsym/glsym_es2.c @@ -30,6 +30,16 @@ const struct rglgen_sym_map rglgen_symbol_map[] = { SYM(ObjectPtrLabel), SYM(GetObjectPtrLabel), SYM(GetPointerv), + SYM(CopyTextureLevelsAPPLE), + SYM(RenderbufferStorageMultisampleAPPLE), + SYM(ResolveMultisampleFramebufferAPPLE), + SYM(FenceSyncAPPLE), + SYM(IsSyncAPPLE), + SYM(DeleteSyncAPPLE), + SYM(ClientWaitSyncAPPLE), + SYM(WaitSyncAPPLE), + SYM(GetInteger64vAPPLE), + SYM(GetSyncivAPPLE), { NULL, NULL }, }; @@ -61,4 +71,14 @@ RGLSYMGLGETOBJECTLABELPROC __rglgen_glGetObjectLabel; RGLSYMGLOBJECTPTRLABELPROC __rglgen_glObjectPtrLabel; RGLSYMGLGETOBJECTPTRLABELPROC __rglgen_glGetObjectPtrLabel; RGLSYMGLGETPOINTERVPROC __rglgen_glGetPointerv; +RGLSYMGLCOPYTEXTURELEVELSAPPLEPROC __rglgen_glCopyTextureLevelsAPPLE; +RGLSYMGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC __rglgen_glRenderbufferStorageMultisampleAPPLE; +RGLSYMGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC __rglgen_glResolveMultisampleFramebufferAPPLE; +RGLSYMGLFENCESYNCAPPLEPROC __rglgen_glFenceSyncAPPLE; +RGLSYMGLISSYNCAPPLEPROC __rglgen_glIsSyncAPPLE; +RGLSYMGLDELETESYNCAPPLEPROC __rglgen_glDeleteSyncAPPLE; +RGLSYMGLCLIENTWAITSYNCAPPLEPROC __rglgen_glClientWaitSyncAPPLE; +RGLSYMGLWAITSYNCAPPLEPROC __rglgen_glWaitSyncAPPLE; +RGLSYMGLGETINTEGER64VAPPLEPROC __rglgen_glGetInteger64vAPPLE; +RGLSYMGLGETSYNCIVAPPLEPROC __rglgen_glGetSyncivAPPLE; diff --git a/gfx/glsym/glsym_es2.h b/gfx/glsym/glsym_es2.h index 55efec49f6..45e8c69890 100644 --- a/gfx/glsym/glsym_es2.h +++ b/gfx/glsym/glsym_es2.h @@ -49,6 +49,16 @@ typedef void (GL_APIENTRYP RGLSYMGLGETOBJECTLABELPROC) (GLenum identifier, GLuin typedef void (GL_APIENTRYP RGLSYMGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label); typedef void (GL_APIENTRYP RGLSYMGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); typedef void (GL_APIENTRYP RGLSYMGLGETPOINTERVPROC) (GLenum pname, void **params); +typedef void (GL_APIENTRYP RGLSYMGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); +typedef void (GL_APIENTRYP RGLSYMGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP RGLSYMGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void); +typedef GLsync (GL_APIENTRYP RGLSYMGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags); +typedef GLboolean (GL_APIENTRYP RGLSYMGLISSYNCAPPLEPROC) (GLsync sync); +typedef void (GL_APIENTRYP RGLSYMGLDELETESYNCAPPLEPROC) (GLsync sync); +typedef GLenum (GL_APIENTRYP RGLSYMGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (GL_APIENTRYP RGLSYMGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (GL_APIENTRYP RGLSYMGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params); +typedef void (GL_APIENTRYP RGLSYMGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); #define glEGLImageTargetTexture2DOES __rglgen_glEGLImageTargetTexture2DOES #define glEGLImageTargetRenderbufferStorageOES __rglgen_glEGLImageTargetRenderbufferStorageOES @@ -78,6 +88,16 @@ typedef void (GL_APIENTRYP RGLSYMGLGETPOINTERVPROC) (GLenum pname, void **params #define glObjectPtrLabel __rglgen_glObjectPtrLabel #define glGetObjectPtrLabel __rglgen_glGetObjectPtrLabel #define glGetPointerv __rglgen_glGetPointerv +#define glCopyTextureLevelsAPPLE __rglgen_glCopyTextureLevelsAPPLE +#define glRenderbufferStorageMultisampleAPPLE __rglgen_glRenderbufferStorageMultisampleAPPLE +#define glResolveMultisampleFramebufferAPPLE __rglgen_glResolveMultisampleFramebufferAPPLE +#define glFenceSyncAPPLE __rglgen_glFenceSyncAPPLE +#define glIsSyncAPPLE __rglgen_glIsSyncAPPLE +#define glDeleteSyncAPPLE __rglgen_glDeleteSyncAPPLE +#define glClientWaitSyncAPPLE __rglgen_glClientWaitSyncAPPLE +#define glWaitSyncAPPLE __rglgen_glWaitSyncAPPLE +#define glGetInteger64vAPPLE __rglgen_glGetInteger64vAPPLE +#define glGetSyncivAPPLE __rglgen_glGetSyncivAPPLE extern RGLSYMGLEGLIMAGETARGETTEXTURE2DOESPROC __rglgen_glEGLImageTargetTexture2DOES; extern RGLSYMGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC __rglgen_glEGLImageTargetRenderbufferStorageOES; @@ -107,6 +127,16 @@ extern RGLSYMGLGETOBJECTLABELPROC __rglgen_glGetObjectLabel; extern RGLSYMGLOBJECTPTRLABELPROC __rglgen_glObjectPtrLabel; extern RGLSYMGLGETOBJECTPTRLABELPROC __rglgen_glGetObjectPtrLabel; extern RGLSYMGLGETPOINTERVPROC __rglgen_glGetPointerv; +extern RGLSYMGLCOPYTEXTURELEVELSAPPLEPROC __rglgen_glCopyTextureLevelsAPPLE; +extern RGLSYMGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC __rglgen_glRenderbufferStorageMultisampleAPPLE; +extern RGLSYMGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC __rglgen_glResolveMultisampleFramebufferAPPLE; +extern RGLSYMGLFENCESYNCAPPLEPROC __rglgen_glFenceSyncAPPLE; +extern RGLSYMGLISSYNCAPPLEPROC __rglgen_glIsSyncAPPLE; +extern RGLSYMGLDELETESYNCAPPLEPROC __rglgen_glDeleteSyncAPPLE; +extern RGLSYMGLCLIENTWAITSYNCAPPLEPROC __rglgen_glClientWaitSyncAPPLE; +extern RGLSYMGLWAITSYNCAPPLEPROC __rglgen_glWaitSyncAPPLE; +extern RGLSYMGLGETINTEGER64VAPPLEPROC __rglgen_glGetInteger64vAPPLE; +extern RGLSYMGLGETSYNCIVAPPLEPROC __rglgen_glGetSyncivAPPLE; struct rglgen_sym_map { const char *sym; void *ptr; }; extern const struct rglgen_sym_map rglgen_symbol_map[];