mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2025-02-17 20:31:57 -05:00
GL import fixed for OSX and iOS.
This commit is contained in:
parent
db735f5ff6
commit
0829795663
5 changed files with 19 additions and 25 deletions
|
@ -12,6 +12,9 @@
|
|||
|
||||
namespace bgfx
|
||||
{
|
||||
# define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
|
||||
# include "glimports.h"
|
||||
|
||||
void GlContext::create(uint32_t _width, uint32_t _height)
|
||||
{
|
||||
BX_UNUSED(_width, _height);
|
||||
|
|
|
@ -15,7 +15,6 @@ namespace bgfx
|
|||
|
||||
# define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
|
||||
# include "glimports.h"
|
||||
# undef GL_IMPORT
|
||||
|
||||
static void* s_opengl = NULL;
|
||||
|
||||
|
@ -89,13 +88,17 @@ namespace bgfx
|
|||
|
||||
void GlContext::import()
|
||||
{
|
||||
# define GL_IMPORT(_optional, _proto, _func, _import) \
|
||||
{ \
|
||||
_func = (_proto)bx::dlsym(s_opengl, #_import); \
|
||||
BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGL context. NSGLGetProcAddress(\"%s\")", #_import); \
|
||||
}
|
||||
BX_TRACE("Import:");
|
||||
# define GL_EXTENSION(_optional, _proto, _func, _import) \
|
||||
{ \
|
||||
if (_func == NULL) \
|
||||
{ \
|
||||
_func = (_proto)bx::dlsym(s_opengl, #_import); \
|
||||
BX_TRACE("%p " #_func " (" #_import ")", _func); \
|
||||
} \
|
||||
BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGL context. NSGLGetProcAddress(\"%s\")", #_import); \
|
||||
}
|
||||
# include "glimports.h"
|
||||
# undef GL_IMPORT
|
||||
}
|
||||
|
||||
} // namespace bgfx
|
||||
|
|
|
@ -49,6 +49,7 @@ typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLi
|
|||
typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARPROC) (GLbitfield mask);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARDEPTHPROC) (GLdouble d);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s);
|
||||
typedef void (GL_APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
|
@ -110,6 +111,7 @@ typedef const GLubyte* (GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
|
|||
typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
|
||||
typedef void (GL_APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
|
||||
typedef void (GL_APIENTRYP PFNGLPOINTSIZEPROC) (GLfloat size);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value);
|
||||
typedef void (GL_APIENTRYP PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target);
|
||||
|
@ -155,7 +157,6 @@ typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC)(GL
|
|||
#endif // GL_IMPORT_TYPEDEFS
|
||||
|
||||
#if BGFX_USE_GL_DYNAMIC_LIB
|
||||
|
||||
GL_IMPORT____(false, PFNGLACTIVETEXTUREPROC, glActiveTexture);
|
||||
GL_IMPORT____(false, PFNGLATTACHSHADERPROC, glAttachShader);
|
||||
GL_IMPORT____(true, PFNGLBEGINQUERYPROC, glBeginQuery);
|
||||
|
|
|
@ -472,20 +472,6 @@ namespace bgfx
|
|||
}
|
||||
#endif // BGFX_CONFIG_DEBUG_GREMEDY
|
||||
|
||||
#if BX_PLATFORM_IOS
|
||||
PFNGLBINDVERTEXARRAYOESPROC glBindVertexArrayOES = NULL;
|
||||
PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArraysOES = NULL;
|
||||
PFNGLGENVERTEXARRAYSOESPROC glGenVertexArraysOES = NULL;
|
||||
PFNGLPROGRAMBINARYOESPROC glProgramBinaryOES = NULL;
|
||||
PFNGLGETPROGRAMBINARYOESPROC glGetProgramBinaryOES = NULL;
|
||||
PFNGLTEXIMAGE3DOESPROC glTexImage3DOES = NULL;
|
||||
PFNGLTEXSUBIMAGE3DOESPROC glTexSubImage3DOES = NULL;
|
||||
PFNGLCOMPRESSEDTEXIMAGE3DOESPROC glCompressedTexImage3DOES = NULL;
|
||||
PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC glCompressedTexSubImage3DOES = NULL;
|
||||
PFLGLDRAWARRAYSINSTANCEDANGLEPROC glDrawArraysInstanced = NULL;
|
||||
PFLGLDRAWELEMENTSINSTANCEDANGLEPROC glDrawElementsInstanced = NULL;
|
||||
#endif // BX_PLATFORM_IOS
|
||||
|
||||
typedef void (*PostSwapBuffersFn)(uint32_t _width, uint32_t _height);
|
||||
|
||||
static const char* getGLString(GLenum _name)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#define BGFX_USE_EGL ( (BGFX_CONFIG_RENDERER_OPENGLES2 || BGFX_CONFIG_RENDERER_OPENGLES3) && (BX_PLATFORM_ANDROID || BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_QNX || BX_PLATFORM_WINDOWS) )
|
||||
#define BGFX_USE_WGL (BGFX_CONFIG_RENDERER_OPENGL && BX_PLATFORM_WINDOWS)
|
||||
#define BGFX_USE_GL_DYNAMIC_LIB BX_PLATFORM_WINDOWS
|
||||
#define BGFX_USE_GL_DYNAMIC_LIB (BX_PLATFORM_LINUX || BX_PLATFORM_OSX || BX_PLATFORM_WINDOWS)
|
||||
|
||||
#if BGFX_CONFIG_RENDERER_OPENGL
|
||||
# if BGFX_CONFIG_RENDERER_OPENGL >= 31
|
||||
|
@ -44,6 +44,7 @@
|
|||
# if BX_PLATFORM_IOS
|
||||
# include <OpenGLES/ES2/gl.h>
|
||||
# include <OpenGLES/ES2/glext.h>
|
||||
typedef double GLdouble;
|
||||
//#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6
|
||||
#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368
|
||||
#define GL_TEXTURE_3D_OES 0x806F
|
||||
|
@ -55,8 +56,8 @@
|
|||
# include <GLES2/gl2.h>
|
||||
# include <GLES2/gl2ext.h>
|
||||
# endif // BX_PLATFORM_
|
||||
typedef khronos_int64_t GLint64;
|
||||
typedef khronos_uint64_t GLuint64;
|
||||
typedef int64_t GLint64;
|
||||
typedef uint64_t GLuint64;
|
||||
# define GL_PROGRAM_BINARY_LENGTH GL_PROGRAM_BINARY_LENGTH_OES
|
||||
# define GL_HALF_FLOAT GL_HALF_FLOAT_OES
|
||||
# define GL_RGBA8 GL_RGBA //GL_RGBA8_OES
|
||||
|
|
Loading…
Reference in a new issue