diff options
author | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
commit | 15740faf9fe9fe4be08965098bbf2947e096aeeb (patch) | |
tree | a730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/GfxDevice/opengles |
Diffstat (limited to 'Runtime/GfxDevice/opengles')
-rw-r--r-- | Runtime/GfxDevice/opengles/ExtensionsGLES.cpp | 30 | ||||
-rw-r--r-- | Runtime/GfxDevice/opengles/ExtensionsGLES.h | 9 | ||||
-rw-r--r-- | Runtime/GfxDevice/opengles/IncludesGLES.h | 71 |
3 files changed, 110 insertions, 0 deletions
diff --git a/Runtime/GfxDevice/opengles/ExtensionsGLES.cpp b/Runtime/GfxDevice/opengles/ExtensionsGLES.cpp new file mode 100644 index 0000000..a948883 --- /dev/null +++ b/Runtime/GfxDevice/opengles/ExtensionsGLES.cpp @@ -0,0 +1,30 @@ +#include "UnityPrefix.h" + +#include "ExtensionsGLES.h" +#include "IncludesGLES.h" + +#if GFX_SUPPORTS_OPENGLESXX + +#if UNITY_IPHONE + #include <dlfcn.h> +#endif + +void* GetGLExtProcAddress(const char* name) +{ +#if GFX_SUPPORTS_EGL && !UNITY_WIN + return (void*) eglGetProcAddress(name); +#elif UNITY_IPHONE + + // on ios we link to framework, so symbols are already resolved + static void* selfHandle = 0; + if(!selfHandle) + selfHandle = dlopen(0, RTLD_LOCAL | RTLD_LAZY); + + return selfHandle ? dlsym(selfHandle, name) : 0; +#else + return 0; + +#endif +} + +#endif
\ No newline at end of file diff --git a/Runtime/GfxDevice/opengles/ExtensionsGLES.h b/Runtime/GfxDevice/opengles/ExtensionsGLES.h new file mode 100644 index 0000000..51de6ad --- /dev/null +++ b/Runtime/GfxDevice/opengles/ExtensionsGLES.h @@ -0,0 +1,9 @@ +#pragma once + +#include "IncludesGLES.h" + +#if GFX_SUPPORTS_OPENGLESXX + +void* GetGLExtProcAddress(const char* name); + +#endif
\ No newline at end of file diff --git a/Runtime/GfxDevice/opengles/IncludesGLES.h b/Runtime/GfxDevice/opengles/IncludesGLES.h new file mode 100644 index 0000000..300199d --- /dev/null +++ b/Runtime/GfxDevice/opengles/IncludesGLES.h @@ -0,0 +1,71 @@ +#pragma once + +#ifdef UNITYGL_H +# error "Don't Mix with UnityGL!!!" +#endif + +#define GFX_SUPPORTS_OPENGLESXX (GFX_SUPPORTS_OPENGLES20 || GFX_SUPPORTS_OPENGLES30) + +#if GFX_SUPPORTS_OPENGLESXX + +#define GFX_SUPPORTS_EGL (UNITY_WIN || UNITY_LINUX || UNITY_ANDROID || UNITY_TIZEN || UNITY_BB10) + +#if UNITY_ANDROID || UNITY_WEBGL +# define GL_GLEXT_PROTOTYPES +#endif + +#if GFX_SUPPORTS_OPENGLES30 +# if UNITY_WIN +# include "PlatformDependent/WinPlayer/unityes_egl.h" +# include "PlatformDependent/WinPlayer/unityes_gl2.h" + // \todo [pyry] Remove gl2ext include since most of the extensions are now in core +# include "PlatformDependent/WinPlayer/unityes_gl2ext.h" +# include "PlatformDependent/WinPlayer/unityes_gl3.h" +# define INCLUDE_GLES_2X 1 +# define INCLUDE_GLES_3X 1 +# define DEF(ret,name,args) extern ret (WINAPI *name) args +# include "PlatformDependent/WinPlayer/GLESFunctionDefs.h" +# elif UNITY_ANDROID +# include <EGL/egl.h> +# include "PlatformDependent/AndroidPlayer/unityes_gl3.h" + // \todo [pyry] Remove gl2ext include since most of the extensions are now in core +# include <GLES2/gl2ext.h> +# include "Runtime/GfxDevice/opengles20/UnityGLES20Ext.h" +# else +# error "Unknown platform" +# endif +# +# include "Runtime/GfxDevice/opengles30//UnityGLES30Ext.h" + +#elif GFX_SUPPORTS_OPENGLES20 +# if UNITY_WIN +# include "PlatformDependent/WinPlayer/unityes_egl.h" +# include "PlatformDependent/WinPlayer/unityes_gl2.h" +# include "PlatformDependent/WinPlayer/unityes_gl2ext.h" +# define INCLUDE_GLES_2X 1 +# define DEF(ret,name,args) extern ret (WINAPI *name) args +# include "PlatformDependent/WinPlayer/GLESFunctionDefs.h" +# elif UNITY_IPHONE +# include <OpenGLES/ES2/gl.h> +# include <OpenGLES/ES2/glext.h> +# elif UNITY_LINUX || UNITY_ANDROID || UNITY_BB10 +# include <EGL/egl.h> +# include <GLES2/gl2.h> +# include <GLES2/gl2ext.h> +# elif UNITY_PEPPER || UNITY_WEBGL +# include <GLES2/gl2.h> +# include <GLES2/gl2ext.h> +# elif UNITY_TIZEN +# include <FGraphics.h> +# include <FGraphicsOpengl2.h> +using namespace Tizen::Graphics; +using namespace Tizen::Graphics::Opengl; +# else +# error "Unknown platform" +# endif +# +# include "Runtime/GfxDevice/opengles20/UnityGLES20Ext.h" +# +#endif + +#endif // GFX_SUPPORTS_OPENGLESXX
\ No newline at end of file |