From 15740faf9fe9fe4be08965098bbf2947e096aeeb Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 14 Aug 2019 22:50:43 +0800 Subject: +Unity Runtime code --- Runtime/GfxDevice/opengles/ExtensionsGLES.cpp | 30 +++++++++++ Runtime/GfxDevice/opengles/ExtensionsGLES.h | 9 ++++ Runtime/GfxDevice/opengles/IncludesGLES.h | 71 +++++++++++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 Runtime/GfxDevice/opengles/ExtensionsGLES.cpp create mode 100644 Runtime/GfxDevice/opengles/ExtensionsGLES.h create mode 100644 Runtime/GfxDevice/opengles/IncludesGLES.h (limited to 'Runtime/GfxDevice/opengles') 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 +#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 +# include "PlatformDependent/AndroidPlayer/unityes_gl3.h" + // \todo [pyry] Remove gl2ext include since most of the extensions are now in core +# include +# 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 +# include +# elif UNITY_LINUX || UNITY_ANDROID || UNITY_BB10 +# include +# include +# include +# elif UNITY_PEPPER || UNITY_WEBGL +# include +# include +# elif UNITY_TIZEN +# include +# include +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 -- cgit v1.1-26-g67d0