浏览代码

macOS, iOS: Removed OpenGL/OpenGLES support.

Бранимир Караџић 2 年之前
父节点
当前提交
928800feab
共有 8 个文件被更改,包括 19 次插入964 次删除
  1. 0 2
      src/config.h
  2. 0 62
      src/glcontext_eagl.h
  3. 0 375
      src/glcontext_eagl.mm
  4. 0 51
      src/glcontext_nsgl.h
  5. 0 394
      src/glcontext_nsgl.mm
  6. 2 6
      src/glimports.h
  7. 13 41
      src/renderer_gl.cpp
  8. 4 33
      src/renderer_gl.h

+ 0 - 2
src/config.h

@@ -90,7 +90,6 @@
 #		define BGFX_CONFIG_RENDERER_OPENGL (0 \
 #		define BGFX_CONFIG_RENDERER_OPENGL (0 \
 					|| BX_PLATFORM_BSD        \
 					|| BX_PLATFORM_BSD        \
 					|| BX_PLATFORM_LINUX      \
 					|| BX_PLATFORM_LINUX      \
-					|| BX_PLATFORM_OSX        \
 					|| BX_PLATFORM_WINDOWS    \
 					|| BX_PLATFORM_WINDOWS    \
 					? BGFX_CONFIG_RENDERER_OPENGL_MIN_VERSION : 0)
 					? BGFX_CONFIG_RENDERER_OPENGL_MIN_VERSION : 0)
 #	endif // BGFX_CONFIG_RENDERER_OPENGL
 #	endif // BGFX_CONFIG_RENDERER_OPENGL
@@ -105,7 +104,6 @@
 #		define BGFX_CONFIG_RENDERER_OPENGLES (0 \
 #		define BGFX_CONFIG_RENDERER_OPENGLES (0 \
 					|| BX_PLATFORM_ANDROID      \
 					|| BX_PLATFORM_ANDROID      \
 					|| BX_PLATFORM_EMSCRIPTEN   \
 					|| BX_PLATFORM_EMSCRIPTEN   \
-					|| BX_PLATFORM_IOS          \
 					|| BX_PLATFORM_RPI          \
 					|| BX_PLATFORM_RPI          \
 					|| BX_PLATFORM_NX           \
 					|| BX_PLATFORM_NX           \
 					? BGFX_CONFIG_RENDERER_OPENGLES_MIN_VERSION : 0)
 					? BGFX_CONFIG_RENDERER_OPENGLES_MIN_VERSION : 0)

+ 0 - 62
src/glcontext_eagl.h

@@ -1,62 +0,0 @@
-/*
- * Copyright 2011-2023 Branimir Karadzic. All rights reserved.
- * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
- */
-
-#ifndef BGFX_GLCONTEXT_EAGL_H_HEADER_GUARD
-#define BGFX_GLCONTEXT_EAGL_H_HEADER_GUARD
-
-#if BX_PLATFORM_IOS
-
-namespace bgfx { namespace gl
-{
-	struct SwapChainGL;
-
-	struct GlContext
-	{
-		GlContext()
-			: m_current(0)
-			, m_context(0)
-			, m_fbo(0)
-			, m_colorRbo(0)
-			, m_depthStencilRbo(0)
-			, m_msaaContext(false)
-		{
-		}
-
-		void create(uint32_t _width, uint32_t _height, uint32_t _flags);
-		void destroy();
-		void resize(uint32_t _width, uint32_t _height, uint32_t _flags);
-
-		uint64_t getCaps() const;
-		SwapChainGL* createSwapChain(void* _nwh);
-		void destroySwapChain(SwapChainGL*  _swapChain);
-		void swap(SwapChainGL* _swapChain = NULL);
-		void makeCurrent(SwapChainGL* _swapChain = NULL);
-
-		void import();
-
-		GLuint getFbo()
-		{
-			return m_fbo;
-		}
-
-		bool isValid() const
-		{
-			return 0 != m_context;
-		}
-
-		SwapChainGL* m_current;
-		void* m_context;
-
-		GLuint m_fbo;
-		GLuint m_colorRbo;
-		GLuint m_depthStencilRbo;
-		// true when MSAA is handled by the context instead of using MSAA FBO
-		bool m_msaaContext;
-	};
-} /* namespace gl */ } // namespace bgfx
-
-#endif // BX_PLATFORM_IOS
-
-#endif // BGFX_GLCONTEXT_EAGL_H_HEADER_GUARD

+ 0 - 375
src/glcontext_eagl.mm

@@ -1,375 +0,0 @@
-/*
- * Copyright 2011-2023 Branimir Karadzic. All rights reserved.
- * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
- */
-
-#include "bgfx_p.h"
-
-#if BX_PLATFORM_IOS && (BGFX_CONFIG_RENDERER_OPENGLES|BGFX_CONFIG_RENDERER_OPENGL)
-#	include <UIKit/UIKit.h>
-#	include <QuartzCore/CAEAGLLayer.h>
-#	include "renderer_gl.h"
-
-namespace bgfx { namespace gl
-{
-#	define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
-#	include "glimports.h"
-
-	static void* s_opengles = NULL;
-
-	struct SwapChainGL
-	{
-		SwapChainGL(EAGLContext *_context, CAEAGLLayer *_layer)
-			: m_context(_context)
-			, m_fbo(0)
-			, m_colorRbo(0)
-			, m_depthStencilRbo(0)
-		{
-			_layer.contentsScale = [UIScreen mainScreen].scale;
-
-			_layer.opaque = [_layer.style valueForKey:@"opaque"] == nil
-				? true
-				: [[_layer.style valueForKey:@"opaque"] boolValue]
-				;
-
-			_layer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys
-				: [NSNumber numberWithBool:false]
-				, kEAGLDrawablePropertyRetainedBacking
-				, kEAGLColorFormatRGBA8
-				, kEAGLDrawablePropertyColorFormat
-				, nil
-				];
-
-			[EAGLContext setCurrentContext:_context];
-
-			GL_CHECK(glGenFramebuffers(1, &m_fbo) );
-			GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_fbo) );
-
-			GL_CHECK(glGenRenderbuffers(1, &m_colorRbo) );
-			GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, m_colorRbo) );
-
-			[_context renderbufferStorage:GL_RENDERBUFFER fromDrawable:_layer];
-			GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_colorRbo) );
-
-			GLint width;
-			GLint height;
-			GL_CHECK(glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &width) );
-			GL_CHECK(glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &height) );
-			BX_TRACE("Screen size: %d x %d", width, height);
-
-			m_width = width;
-			m_height = height;
-			m_layer = _layer;
-
-			createFrameBuffers(m_width, m_height);
-		}
-
-		~SwapChainGL()
-		{
-			destroyFrameBuffers();
-		}
-
-		void destroyFrameBuffers()
-		{
-			GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, 0) );
-			GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, 0) );
-			GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, 0) );
-			if (0 != m_fbo)
-			{
-				GL_CHECK(glDeleteFramebuffers(1, &m_fbo) );
-				m_fbo = 0;
-			}
-
-			if (0 != m_colorRbo)
-			{
-				GL_CHECK(glDeleteRenderbuffers(1, &m_colorRbo) );
-				m_colorRbo = 0;
-			}
-
-			if (0 != m_depthStencilRbo)
-			{
-				GL_CHECK(glDeleteRenderbuffers(1, &m_depthStencilRbo) );
-				m_depthStencilRbo = 0;
-			}
-		}
-
-		void createFrameBuffers(GLint _width, GLint _height)
-		{
-			GL_CHECK(glGenRenderbuffers(1, &m_depthStencilRbo) );
-			GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, m_depthStencilRbo) );
-			GL_CHECK(glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, _width, _height) );
-			GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilRbo) );
-			GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilRbo) );
-
-			GLenum err = glCheckFramebufferStatus(GL_FRAMEBUFFER);
-			BX_ASSERT(GL_FRAMEBUFFER_COMPLETE == err, "glCheckFramebufferStatus failed 0x%08x", err);
-			BX_UNUSED(err);
-
-			makeCurrent();
-
-			GL_CHECK(glClearColor(0.0f, 0.0f, 0.0f, 0.0f) );
-			GL_CHECK(glClear(GL_COLOR_BUFFER_BIT) );
-
-			swapBuffers();
-
-			GL_CHECK(glClear(GL_COLOR_BUFFER_BIT) );
-
-			swapBuffers();
-		}
-
-		void makeCurrent()
-		{
-			[EAGLContext setCurrentContext:m_context];
-			GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_fbo) );
-
-			GLint newWidth = m_layer.bounds.size.width*[UIScreen mainScreen].scale;
-			GLint newHeight = m_layer.bounds.size.height*[UIScreen mainScreen].scale;
-			resize(newWidth, newHeight);
-		}
-
-		void resize(GLint _width, GLint _height)
-		{
-			if (m_width  == _width
-			&&  m_height == _height)
-			{
-				return;
-			}
-
-			destroyFrameBuffers();
-
-			m_width = _width;
-			m_height = _height;
-
-			createFrameBuffers(m_width, m_height);
-		}
-
-		void swapBuffers()
-		{
-			GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, m_colorRbo) );
-			[m_context presentRenderbuffer:GL_RENDERBUFFER];
-		}
-
-		EAGLContext* m_context;
-
-		CAEAGLLayer *m_layer;
-		GLuint m_fbo;
-		GLuint m_colorRbo;
-		GLuint m_depthStencilRbo;
-		GLint m_width;
-		GLint m_height;
-	};
-
-	void GlContext::create(uint32_t _width, uint32_t _height, uint32_t /*_flags*/)
-	{
-		s_opengles = bx::dlopen("/System/Library/Frameworks/OpenGLES.framework/OpenGLES");
-		BX_ASSERT(NULL != s_opengles, "OpenGLES dynamic library is not found!");
-
-		BX_UNUSED(_width, _height);
-		CAEAGLLayer* layer = (__bridge CAEAGLLayer*)g_platformData.nwh;
-		layer.opaque = [layer.style valueForKey:@"opaque"] == nil ? true : [[layer.style valueForKey:@"opaque"] boolValue];
-
-		layer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys
-			: [NSNumber numberWithBool:false]
-			, kEAGLDrawablePropertyRetainedBacking
-			, kEAGLColorFormatRGBA8
-			, kEAGLDrawablePropertyColorFormat
-			, nil
-			];
-
-		EAGLContext* context = (__bridge EAGLContext*)g_platformData.context;
-		if (NULL == context)
-		{
-			context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];
-			if (NULL == context)
-			{
-				context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
-			}
-		}
-		BX_ASSERT(NULL != context, "No valid OpenGLES context.");
-
-		m_context = (__bridge void*)context;
-		[EAGLContext setCurrentContext:context];
-		[CATransaction flush];
-
-		GL_CHECK(glGenFramebuffers(1, &m_fbo) );
-		GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_fbo) );
-
-		GL_CHECK(glGenRenderbuffers(1, &m_colorRbo) );
-		GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, m_colorRbo) );
-
-		[context renderbufferStorage:GL_RENDERBUFFER fromDrawable:layer];
-		GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_colorRbo) );
-
-		GLint width;
-		GLint height;
-		GL_CHECK(glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &width) );
-		GL_CHECK(glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &height) );
-		BX_TRACE("Screen size: %d x %d", width, height);
-
-		GL_CHECK(glGenRenderbuffers(1, &m_depthStencilRbo) );
-		GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, m_depthStencilRbo) );
-		GL_CHECK(glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, width, height) );
-		GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilRbo) );
-		GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilRbo) );
-
-		BX_ASSERT(GL_FRAMEBUFFER_COMPLETE ==  glCheckFramebufferStatus(GL_FRAMEBUFFER)
-			, "glCheckFramebufferStatus failed 0x%08x"
-			, glCheckFramebufferStatus(GL_FRAMEBUFFER)
-			);
-
-		makeCurrent();
-		GL_CHECK(glClearColor(0.0f, 0.0f, 0.0f, 0.0f) );
-		GL_CHECK(glClear(GL_COLOR_BUFFER_BIT) );
-		swap(NULL);
-		GL_CHECK(glClear(GL_COLOR_BUFFER_BIT) );
-		swap(NULL);
-
-		import();
-
-		g_internalData.context = m_context;
-	}
-
-	void GlContext::destroy()
-	{
-		if (0 != m_fbo)
-		{
-			GL_CHECK(glDeleteFramebuffers(1, &m_fbo) );
-			m_fbo = 0;
-		}
-
-		if (0 != m_colorRbo)
-		{
-			GL_CHECK(glDeleteRenderbuffers(1, &m_colorRbo) );
-			m_colorRbo = 0;
-		}
-
-		if (0 != m_depthStencilRbo)
-		{
-			GL_CHECK(glDeleteRenderbuffers(1, &m_depthStencilRbo) );
-			m_depthStencilRbo = 0;
-		}
-
-		EAGLContext* context = (__bridge EAGLContext*)m_context;
-
-		bx::dlclose(s_opengles);
-	}
-
-	void GlContext::resize(uint32_t _width, uint32_t _height, uint32_t _flags)
-	{
-		BX_UNUSED(_width, _height, _flags);
-		BX_TRACE("resize context");
-
-		if (0 != m_fbo)
-		{
-			GL_CHECK(glDeleteFramebuffers(1, &m_fbo) );
-			m_fbo = 0;
-		}
-
-		if (0 != m_colorRbo)
-		{
-			GL_CHECK(glDeleteRenderbuffers(1, &m_colorRbo) );
-			m_colorRbo = 0;
-		}
-
-		if (0 != m_depthStencilRbo)
-		{
-			GL_CHECK(glDeleteRenderbuffers(1, &m_depthStencilRbo) );
-			m_depthStencilRbo = 0;
-		}
-
-		GL_CHECK(glGenFramebuffers(1, &m_fbo) );
-		GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_fbo) );
-
-		GL_CHECK(glGenRenderbuffers(1, &m_colorRbo) );
-		GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, m_colorRbo) );
-
-		[((__bridge EAGLContext*)m_context) renderbufferStorage:GL_RENDERBUFFER fromDrawable:(__bridge CAEAGLLayer*)g_platformData.nwh];
-		GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_colorRbo) );
-
-		GLint width;
-		GLint height;
-		GL_CHECK(glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &width) );
-		GL_CHECK(glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &height) );
-		BX_TRACE("Screen size: %d x %d", width, height);
-
-		GL_CHECK(glGenRenderbuffers(1, &m_depthStencilRbo) );
-		GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, m_depthStencilRbo) );
-		GL_CHECK(glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, width, height) );
-		GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilRbo) );
-		GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilRbo) );
-
-		BX_ASSERT(GL_FRAMEBUFFER_COMPLETE ==  glCheckFramebufferStatus(GL_FRAMEBUFFER)
-			, "glCheckFramebufferStatus failed 0x%08x"
-			, glCheckFramebufferStatus(GL_FRAMEBUFFER)
-			);
-	}
-
-	uint64_t GlContext::getCaps() const
-	{
-		return BGFX_CAPS_SWAP_CHAIN;
-	}
-
-	SwapChainGL* GlContext::createSwapChain(void* _nwh)
-	{
-		return BX_NEW(g_allocator, SwapChainGL)(/*m_display, m_config,*/ (__bridge EAGLContext*)m_context, (__bridge CAEAGLLayer*)_nwh);
-	}
-
-	void GlContext::destroySwapChain(SwapChainGL* _swapChain)
-	{
-		bx::deleteObject(g_allocator, _swapChain);
-	}
-
-	void GlContext::swap(SwapChainGL* _swapChain)
-	{
-		makeCurrent(_swapChain);
-
-		if (NULL == _swapChain)
-		{
-			GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, m_colorRbo) );
-			EAGLContext* context = (__bridge EAGLContext*)m_context;
-			[context presentRenderbuffer:GL_RENDERBUFFER];
-		}
-		else
-		{
-		    _swapChain->swapBuffers();
-		}
-	}
-
-	void GlContext::makeCurrent(SwapChainGL* _swapChain)
-	{
-		if (m_current != _swapChain)
-		{
-			m_current = _swapChain;
-
-			if (NULL == _swapChain)
-			{
-				[EAGLContext setCurrentContext:(__bridge EAGLContext*)m_context];
-				GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_fbo) );
-			}
-			else
-			{
-				_swapChain->makeCurrent();
-			}
-		}
-	}
-
-	void GlContext::import()
-	{
-		BX_TRACE("Import:");
-#	define GL_EXTENSION(_optional, _proto, _func, _import)                        \
-		{                                                                         \
-			if (_func == NULL)                                                    \
-			{                                                                     \
-				_func = (_proto)bx::dlsym(s_opengles, #_import);                  \
-				BX_TRACE("%p " #_func " (" #_import ")", _func);                  \
-			}                                                                     \
-			BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize      \
-				, "Failed to create OpenGLES context. EAGLGetProcAddress(\"%s\")" \
-				, #_import);                                                      \
-		}
-#	include "glimports.h"
-	}
-
-} /* namespace gl */ } // namespace bgfx
-
-#endif // BX_PLATFORM_IOS && (BGFX_CONFIG_RENDERER_OPENGLES|BGFX_CONFIG_RENDERER_OPENGL)

+ 0 - 51
src/glcontext_nsgl.h

@@ -1,51 +0,0 @@
-/*
- * Copyright 2011-2023 Branimir Karadzic. All rights reserved.
- * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
- */
-
-#ifndef BGFX_GLCONTEXT_NSGL_H_HEADER_GUARD
-#define BGFX_GLCONTEXT_NSGL_H_HEADER_GUARD
-
-#if BX_PLATFORM_OSX
-
-namespace bgfx { namespace gl
-{
-	struct SwapChainGL;
-
-	struct GlContext
-	{
-		GlContext()
-			: m_context(NULL)
-			, m_view(NULL)
-			, m_msaaContext(false)
-		{
-		}
-
-		void create(uint32_t _width, uint32_t _height, uint32_t _flags);
-		void destroy();
-		void resize(uint32_t _width, uint32_t _height, uint32_t _flags);
-
-		uint64_t getCaps() const;
-		SwapChainGL* createSwapChain(void* _nwh);
-		void destroySwapChain(SwapChainGL*  _swapChain);
-		void swap(SwapChainGL* _swapChain = NULL);
-		void makeCurrent(SwapChainGL* _swapChain = NULL);
-
-		void import();
-
-		bool isValid() const
-		{
-			return NULL != m_context;
-		}
-
-		void* m_context;
-		void* m_view;
-		// true when MSAA is handled by the context instead of using MSAA FBO
-		bool m_msaaContext;
-
-	};
-} /* namespace gl */ } // namespace bgfx
-
-#endif // BX_PLATFORM_OSX
-
-#endif // BGFX_GLCONTEXT_NSGL_H_HEADER_GUARD

+ 0 - 394
src/glcontext_nsgl.mm

@@ -1,394 +0,0 @@
-/*
- * Copyright 2011-2023 Branimir Karadzic. All rights reserved.
- * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
- */
-
-#include "bgfx_p.h"
-
-#if BX_PLATFORM_OSX && (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)
-#	include "renderer_gl.h"
-#	include <AvailabilityMacros.h>
-#	include <Cocoa/Cocoa.h>
-#	include <bx/os.h>
-
-BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wdeprecated-declarations")
-
-namespace bgfx { namespace gl
-{
-
-#	define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
-#	include "glimports.h"
-
-	struct SwapChainGL
-	{
-		SwapChainGL(void* _nwh,NSOpenGLContext *_context)
-		{
-			NSObject* nwh=(NSObject*)_nwh;
-
-			NSWindow* nsWindow = nil;
-			NSView* contentView = nil;
-			if ([nwh isKindOfClass:[NSView class]])
-			{
-				contentView = (NSView*)nwh;
-			}
-			else if ([nwh isKindOfClass:[NSWindow class]])
-			{
-				nsWindow = (NSWindow*)nwh;
-				contentView = [nsWindow contentView];
-			}
-
-#if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
-			NSOpenGLPixelFormatAttribute profile =
-#if BGFX_CONFIG_RENDERER_OPENGL >= 31
-				NSOpenGLProfileVersion3_2Core
-#else
-				NSOpenGLProfileVersionLegacy
-#endif // BGFX_CONFIG_RENDERER_OPENGL >= 31
-				;
-#endif // defined(MAC_OS_X_VERSION_MAX_ALLOWED) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
-
-			NSOpenGLPixelFormatAttribute pixelFormatAttributes[] = {
-#if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
-				NSOpenGLPFAOpenGLProfile, profile,
-#endif // defined(MAC_OS_X_VERSION_MAX_ALLOWED) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
-				NSOpenGLPFAColorSize,     24,
-				NSOpenGLPFAAlphaSize,     8,
-				NSOpenGLPFADepthSize,     24,
-				NSOpenGLPFAStencilSize,   8,
-				NSOpenGLPFADoubleBuffer,  true,
-				NSOpenGLPFAAccelerated,   true,
-				NSOpenGLPFANoRecovery,    true,
-				0,                        0,
-			};
-
-			NSOpenGLPixelFormat* pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:pixelFormatAttributes];
-			BGFX_FATAL(NULL != pixelFormat, Fatal::UnableToInitialize, "Failed to initialize pixel format.");
-
-			NSRect glViewRect = [contentView bounds];
-			NSOpenGLView* glView = [[NSOpenGLView alloc] initWithFrame:glViewRect pixelFormat:pixelFormat];
-
-
-			// GLFW creates a helper contentView that handles things like keyboard and drag and
-			// drop events. We don't want to clobber that view if it exists. Instead we just
-			// add ourselves as a subview and make the view resize automatically.
-			if (nil != contentView)
-			{
-				[glView setAutoresizingMask:( NSViewHeightSizable |
-						NSViewWidthSizable |
-						NSViewMinXMargin |
-						NSViewMaxXMargin |
-						NSViewMinYMargin |
-						NSViewMaxYMargin )];
-				[contentView addSubview:glView];
-			}
-			else
-			{
-				if (nil != nsWindow)
-					[nsWindow setContentView:glView];
-			}
-
-			NSOpenGLContext* glContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:_context];
-			BGFX_FATAL(NULL != glContext, Fatal::UnableToInitialize, "Failed to initialize GL context.");
-
-			void (^attachBlock)(void) = ^(void) {
-				[glView setOpenGLContext: glContext];
-				[glContext setView:glView];
-			};
-
-			if([NSThread isMainThread])
-			{
-				attachBlock();
-			}
-			else
-			{
-				dispatch_sync(dispatch_get_main_queue(),attachBlock);
-			}
-
-			[pixelFormat release];
-
-			[glContext makeCurrentContext];
-			GLint interval = 0;
-			[glContext setValues:&interval forParameter:NSOpenGLCPSwapInterval];
-
-
-			m_view    = glView;
-			m_context = glContext;
-		}
-
-		~SwapChainGL()
-		{
-			if(m_context!=nil) [m_context release];
-			if(m_view!=nil) [m_view release];
-		}
-
-		void makeCurrent()
-		{
-			[m_context makeCurrentContext];
-		}
-
-		void swapBuffers()
-		{
-			[m_context makeCurrentContext];
-			[m_context flushBuffer];
-		}
-
-		NSOpenGLView *m_view;
-		NSOpenGLContext *m_context;
-	};
-
-	class AutoreleasePoolHolder
-	{
-	public:
-		AutoreleasePoolHolder() : m_pool([[NSAutoreleasePool alloc] init])
-		{
-		}
-
-		~AutoreleasePoolHolder()
-		{
-			[m_pool release];
-		}
-
-	private:
-		AutoreleasePoolHolder(AutoreleasePoolHolder const&);
-
-		NSAutoreleasePool* const m_pool;
-	};
-
-	static void* s_opengl = NULL;
-
-	void GlContext::create(uint32_t _width, uint32_t _height, uint32_t /*_flags*/)
-	{
-		BX_UNUSED(_width, _height);
-
-		s_opengl = bx::dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL");
-		BX_ASSERT(NULL != s_opengl, "OpenGL dynamic library is not found!");
-
-		const AutoreleasePoolHolder pool;
-		NSObject* nwh = (NSObject*)g_platformData.nwh;
-		m_context = g_platformData.context;
-
-		NSWindow* nsWindow = nil;
-		NSView* contentView = nil;
-		if ([nwh isKindOfClass:[NSView class]])
-		{
-			contentView = (NSView*)nwh;
-		}
-		else if ([nwh isKindOfClass:[NSWindow class]])
-		{
-			nsWindow = (NSWindow*)nwh;
-			contentView = [nsWindow contentView];
-		}
-
-		if (NULL == g_platformData.context)
-		{
-#if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
-			NSOpenGLPixelFormatAttribute profile =
-#if BGFX_CONFIG_RENDERER_OPENGL >= 31
-				NSOpenGLProfileVersion3_2Core
-#else
-				NSOpenGLProfileVersionLegacy
-#endif // BGFX_CONFIG_RENDERER_OPENGL >= 31
-				;
-#endif // defined(MAC_OS_X_VERSION_MAX_ALLOWED) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
-
-			NSOpenGLPixelFormatAttribute pixelFormatAttributes[] = {
-#if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
-				NSOpenGLPFAOpenGLProfile, profile,
-#endif // defined(MAC_OS_X_VERSION_MAX_ALLOWED) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
-				NSOpenGLPFAColorSize,     24,
-				NSOpenGLPFAAlphaSize,     8,
-				NSOpenGLPFADepthSize,     24,
-				NSOpenGLPFAStencilSize,   8,
-				NSOpenGLPFADoubleBuffer,  true,
-				NSOpenGLPFAAccelerated,   true,
-				NSOpenGLPFANoRecovery,    true,
-				0,                        0,
-			};
-
-			NSOpenGLPixelFormat* pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:pixelFormatAttributes];
-			BGFX_FATAL(NULL != pixelFormat, Fatal::UnableToInitialize, "Failed to initialize pixel format.");
-
-			NSRect glViewRect = [contentView bounds];
-			NSOpenGLView* glView = [[NSOpenGLView alloc] initWithFrame:glViewRect pixelFormat:pixelFormat];
-
-			[pixelFormat release];
-			// GLFW creates a helper contentView that handles things like keyboard and drag and
-			// drop events. We don't want to clobber that view if it exists. Instead we just
-			// add ourselves as a subview and make the view resize automatically.
-			if (nil != contentView)
-			{
-				[glView setAutoresizingMask:( NSViewHeightSizable |
-						NSViewWidthSizable |
-						NSViewMinXMargin |
-						NSViewMaxXMargin |
-						NSViewMinYMargin |
-						NSViewMaxYMargin )];
-				[contentView addSubview:glView];
-			}
-			else
-			{
-				if (nil != nsWindow)
-					[nsWindow setContentView:glView];
-			}
-
-			NSOpenGLContext* glContext = [glView openGLContext];
-			BGFX_FATAL(NULL != glContext, Fatal::UnableToInitialize, "Failed to initialize GL context.");
-
-			[glContext makeCurrentContext];
-			GLint interval = 0;
-			[glContext setValues:&interval forParameter:NSOpenGLCPSwapInterval];
-
-			// When initializing NSOpenGLView programmatically (as we are), this sometimes doesn't
-			// get hooked up properly (especially when there are existing window elements). This ensures
-			// we are valid. Otherwise, you'll probably get a GL_INVALID_FRAMEBUFFER_OPERATION when
-			// trying to glClear() for the first time.
-			void (^set_view)(void) = ^(void) {
-				[glContext setView:glView];
-			};
-
-			if([NSThread isMainThread])
-			{
-				set_view();
-			}
-			else
-			{
-				dispatch_sync(dispatch_get_main_queue(),set_view);
-			}
-
-			m_view    = glView;
-			m_context = glContext;
-		}
-		else
-		{
-			[(NSOpenGLContext*)g_platformData.context makeCurrentContext];
-		}
-
-		import();
-
-		g_internalData.context = m_context;
-	}
-
-	void GlContext::destroy()
-	{
-		if (NULL == g_platformData.context)
-		{
-			NSOpenGLView* glView = (NSOpenGLView*)m_view;
-			[glView release];
-		}
-
-		m_view    = NULL;
-		m_context = NULL;
-		bx::dlclose(s_opengl);
-	}
-
-	void GlContext::resize(uint32_t _width, uint32_t _height, uint32_t _flags)
-	{
-		BX_UNUSED(_width, _height);
-
-#if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
-		bool hidpi = !!(_flags&BGFX_RESET_HIDPI);
-        if (m_view)
-        {
-            NSOpenGLView* glView = (NSOpenGLView*)m_view;
-            if ([glView respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)])
-                [glView setWantsBestResolutionOpenGLSurface:hidpi];
-        }
-#endif // defined(MAC_OS_X_VERSION_MAX_ALLOWED) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
-
-		bool vsync = !!(_flags&BGFX_RESET_VSYNC);
-		GLint interval = vsync ? 1 : 0;
-		NSOpenGLContext* glContext = (NSOpenGLContext*)m_context;
-		[glContext setValues:&interval forParameter:NSOpenGLCPSwapInterval];
-		
-		void (^update_view)(void) = ^(void) {
-			[glContext update];
-		};
-
-		if([NSThread isMainThread])
-		{
-			update_view();
-		}
-		else
-		{
-			dispatch_sync(dispatch_get_main_queue(),update_view);
-		}
-	}
-
-	uint64_t GlContext::getCaps() const
-	{
-		uint64_t caps = 0;
-#if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
-		NSObject* nwh = (NSObject*)g_platformData.nwh;
-		if ([nwh respondsToSelector:@selector(backingScaleFactor)] && (1.0f < [(id)nwh backingScaleFactor]))
-			caps |= BGFX_CAPS_HIDPI;
-#endif // defined(MAC_OS_X_VERSION_MAX_ALLOWED) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
-		caps |= BGFX_CAPS_SWAP_CHAIN;
-		return caps;
-	}
-
-	SwapChainGL* GlContext::createSwapChain(void* _nwh)
-	{
-		return BX_NEW(g_allocator, SwapChainGL)(_nwh,(NSOpenGLContext*)m_context);
-	}
-
-	void GlContext::destroySwapChain(SwapChainGL* _swapChain)
-	{
-		bx::deleteObject(g_allocator, _swapChain);
-	}
-
-	void GlContext::swap(SwapChainGL* _swapChain)
-	{
-		if (NULL == _swapChain)
-		{
-			NSOpenGLContext* glContext = (NSOpenGLContext*)m_context;
-			[glContext makeCurrentContext];
-			[glContext flushBuffer];
-		}
-		else
-		{
-			_swapChain->makeCurrent();
-			_swapChain->swapBuffers();
-		}
-	}
-
-	void GlContext::makeCurrent(SwapChainGL* _swapChain)
-	{
-		if (NULL == _swapChain)
-		{
-			NSOpenGLContext* glContext = (NSOpenGLContext*)m_context;
-			[glContext makeCurrentContext];
-		}
-		else
-		{
-			_swapChain->makeCurrent();
-		}
-	}
-
-	void GlContext::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. GetProcAddress(\"%s\")", #_import); \
-				}
-#	include "glimports.h"
-	}
-
-} /* namespace gl */ } // namespace bgfx
-
-void* nsglGetProcAddress(const GLubyte* _name)
-{
-	using namespace bgfx::gl;
-	if (NULL == s_opengl)
-	{
-		s_opengl = bx::dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL");
-	}
-	return bx::dlsym(s_opengl, (const char*)_name);
-}
-
-#endif // BX_PLATFORM_OSX && (BGFX_CONFIG_RENDERER_OPENGLES2|BGFX_CONFIG_RENDERER_OPENGLES3|BGFX_CONFIG_RENDERER_OPENGL)

+ 2 - 6
src/glimports.h

@@ -558,11 +558,7 @@ GL_IMPORT_EXT__(true,  PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC,    glMultiDrawEl
 GL_IMPORT_OES__(true,  PFNGLGETPROGRAMBINARYPROC,                  glGetProgramBinary);
 GL_IMPORT_OES__(true,  PFNGLGETPROGRAMBINARYPROC,                  glGetProgramBinary);
 GL_IMPORT_OES__(true,  PFNGLPROGRAMBINARYPROC,                     glProgramBinary);
 GL_IMPORT_OES__(true,  PFNGLPROGRAMBINARYPROC,                     glProgramBinary);
 
 
-#if BX_PLATFORM_IOS
-GL_IMPORT_EXT__(true,  PFNGLVERTEXATTRIBDIVISORPROC,               glVertexAttribDivisor);
-GL_IMPORT_EXT__(true,  PFNGLDRAWARRAYSINSTANCEDPROC,               glDrawArraysInstanced);
-GL_IMPORT_EXT__(true,  PFNGLDRAWELEMENTSINSTANCEDPROC,             glDrawElementsInstanced);
-#elif BX_PLATFORM_EMSCRIPTEN
+#if BX_PLATFORM_EMSCRIPTEN
 GL_IMPORT_ANGLE(true,  PFNGLVERTEXATTRIBDIVISORPROC,               glVertexAttribDivisor);
 GL_IMPORT_ANGLE(true,  PFNGLVERTEXATTRIBDIVISORPROC,               glVertexAttribDivisor);
 GL_IMPORT_ANGLE(true,  PFNGLDRAWARRAYSINSTANCEDPROC,               glDrawArraysInstanced);
 GL_IMPORT_ANGLE(true,  PFNGLDRAWARRAYSINSTANCEDPROC,               glDrawArraysInstanced);
 GL_IMPORT_ANGLE(true,  PFNGLDRAWELEMENTSINSTANCEDPROC,             glDrawElementsInstanced);
 GL_IMPORT_ANGLE(true,  PFNGLDRAWELEMENTSINSTANCEDPROC,             glDrawElementsInstanced);
@@ -570,7 +566,7 @@ GL_IMPORT_ANGLE(true,  PFNGLDRAWELEMENTSINSTANCEDPROC,             glDrawElement
 GL_IMPORT_OES__(true,  PFNGLVERTEXATTRIBDIVISORPROC,               glVertexAttribDivisor);
 GL_IMPORT_OES__(true,  PFNGLVERTEXATTRIBDIVISORPROC,               glVertexAttribDivisor);
 GL_IMPORT_OES__(true,  PFNGLDRAWARRAYSINSTANCEDPROC,               glDrawArraysInstanced);
 GL_IMPORT_OES__(true,  PFNGLDRAWARRAYSINSTANCEDPROC,               glDrawArraysInstanced);
 GL_IMPORT_OES__(true,  PFNGLDRAWELEMENTSINSTANCEDPROC,             glDrawElementsInstanced);
 GL_IMPORT_OES__(true,  PFNGLDRAWELEMENTSINSTANCEDPROC,             glDrawElementsInstanced);
-#endif // BX_PLATFORM_IOS
+#endif // BX_PLATFORM_EMSCRIPTEN
 
 
 GL_IMPORT_OES__(true,  PFNGLBINDVERTEXARRAYPROC,                   glBindVertexArray);
 GL_IMPORT_OES__(true,  PFNGLBINDVERTEXARRAYPROC,                   glBindVertexArray);
 GL_IMPORT_OES__(true,  PFNGLDELETEVERTEXARRAYSPROC,                glDeleteVertexArrays);
 GL_IMPORT_OES__(true,  PFNGLDELETEVERTEXARRAYSPROC,                glDeleteVertexArrays);

+ 13 - 41
src/renderer_gl.cpp

@@ -921,7 +921,7 @@ namespace bgfx { namespace gl
 		{ "OES_texture_half_float_linear",            false,                             true  },
 		{ "OES_texture_half_float_linear",            false,                             true  },
 		{ "OES_texture_stencil8",                     false,                             true  },
 		{ "OES_texture_stencil8",                     false,                             true  },
 		{ "OES_texture_storage_multisample_2d_array", false,                             true  },
 		{ "OES_texture_storage_multisample_2d_array", false,                             true  },
-		{ "OES_vertex_array_object",                  false,                             !BX_PLATFORM_IOS },
+		{ "OES_vertex_array_object",                  false,                             true  },
 		{ "OES_vertex_half_float",                    false,                             true  },
 		{ "OES_vertex_half_float",                    false,                             true  },
 		{ "OES_vertex_type_10_10_10_2",               false,                             true  },
 		{ "OES_vertex_type_10_10_10_2",               false,                             true  },
 
 
@@ -2693,10 +2693,7 @@ namespace bgfx { namespace gl
 					}
 					}
 				}
 				}
 
 
-				for (uint32_t ii = BX_ENABLED(BX_PLATFORM_IOS) ? TextureFormat::Unknown : 0 // skip test on iOS!
-					; ii < TextureFormat::Count
-					; ++ii
-					)
+				for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii)
 				{
 				{
 					if (TextureFormat::Unknown != ii
 					if (TextureFormat::Unknown != ii
 					&&  TextureFormat::UnknownDepth != ii)
 					&&  TextureFormat::UnknownDepth != ii)
@@ -3692,12 +3689,9 @@ namespace bgfx { namespace gl
 			GL_CHECK(glActiveTexture(GL_TEXTURE0) );
 			GL_CHECK(glActiveTexture(GL_TEXTURE0) );
 			GL_CHECK(glBindTexture(GL_TEXTURE_2D, m_textures[_blitter.m_texture.idx].m_id) );
 			GL_CHECK(glBindTexture(GL_TEXTURE_2D, m_textures[_blitter.m_texture.idx].m_id) );
 
 
-			if (!BX_ENABLED(BX_PLATFORM_OSX) )
+			if (m_samplerObjectSupport)
 			{
 			{
-				if (m_samplerObjectSupport)
-				{
-					GL_CHECK(glBindSampler(0, 0) );
-				}
+				GL_CHECK(glBindSampler(0, 0) );
 			}
 			}
 		}
 		}
 
 
@@ -4141,11 +4135,6 @@ namespace bgfx { namespace gl
 			if (!m_glctx.isValid() )
 			if (!m_glctx.isValid() )
 			{
 			{
 				m_glctx.create(_width, _height, _flags);
 				m_glctx.create(_width, _height, _flags);
-
-#if BX_PLATFORM_IOS
-				// iOS: need to figure out how to deal with FBO created by context.
-				m_backBufferFbo = m_msaaBackBufferFbo = m_glctx.getFbo();
-#endif // BX_PLATFORM_IOS
 			}
 			}
 			else
 			else
 			{
 			{
@@ -6531,16 +6520,16 @@ namespace bgfx { namespace gl
 					const bool usesPacking      = !bx::findIdentifierMatch(code, s_ARB_shading_language_packing).isEmpty();
 					const bool usesPacking      = !bx::findIdentifierMatch(code, s_ARB_shading_language_packing).isEmpty();
 					const bool usesInterpQ      = !bx::findIdentifierMatch(code, s_intepolationQualifier).isEmpty();
 					const bool usesInterpQ      = !bx::findIdentifierMatch(code, s_intepolationQualifier).isEmpty();
 
 
-					uint32_t version = BX_ENABLED(BX_PLATFORM_OSX) ? 120
-						:  usesTextureArray
+					uint32_t version = false
+						|| usesTextureArray
 						|| usesTexture3D
 						|| usesTexture3D
 						|| usesIUsamplers
 						|| usesIUsamplers
 						|| usesVertexID
 						|| usesVertexID
 						|| usesUint
 						|| usesUint
 						|| usesTexelFetch
 						|| usesTexelFetch
 						|| usesGpuShader5
 						|| usesGpuShader5
-						|| usesInterpQ   ? 130
-						: usesTextureLod ? 120
+						|| usesInterpQ
+						? 130
 						: 120
 						: 120
 						;
 						;
 
 
@@ -6595,30 +6584,14 @@ namespace bgfx { namespace gl
 					if (usesTextureArray)
 					if (usesTextureArray)
 					{
 					{
 						bx::write(&writer, "#extension GL_EXT_texture_array : enable\n", &err);
 						bx::write(&writer, "#extension GL_EXT_texture_array : enable\n", &err);
-
-						if (BX_ENABLED(BX_PLATFORM_OSX) )
-						{
-							bx::write(&writer, "#define texture2DArrayLod texture2DArray\n", &err);
-						}
-						else
-						{
-							bx::write(&writer, "#define texture2DArrayLodEXT texture2DArrayLod\n", &err);
-							bx::write(&writer, "#define textureArray texture\n", &err);
-						}
+						bx::write(&writer, "#define texture2DArrayLodEXT texture2DArrayLod\n", &err);
+						bx::write(&writer, "#define textureArray texture\n", &err);
 					}
 					}
 
 
 					if (usesTexture3D)
 					if (usesTexture3D)
 					{
 					{
 						bx::write(&writer, "#define texture3DEXT texture3D\n", &err);
 						bx::write(&writer, "#define texture3DEXT texture3D\n", &err);
-
-						if (BX_ENABLED(BX_PLATFORM_OSX) )
-						{
-							bx::write(&writer, "#define texture3DLodEXT texture3D\n", &err);
-						}
-						else
-						{
-							bx::write(&writer, "#define texture3DLodEXT texture3DLod\n", &err);
-						}
+						bx::write(&writer, "#define texture3DLodEXT texture3DLod\n", &err);
 					}
 					}
 
 
 					if (130 <= version)
 					if (130 <= version)
@@ -7489,8 +7462,7 @@ namespace bgfx { namespace gl
 
 
 		uint32_t frameQueryIdx = UINT32_MAX;
 		uint32_t frameQueryIdx = UINT32_MAX;
 
 
-		if (m_timerQuerySupport
-		&&  !BX_ENABLED(BX_PLATFORM_OSX) )
+		if (m_timerQuerySupport)
 		{
 		{
 			frameQueryIdx = m_gpuTimer.begin(BGFX_CONFIG_MAX_VIEWS, _render->m_frameNum);
 			frameQueryIdx = m_gpuTimer.begin(BGFX_CONFIG_MAX_VIEWS, _render->m_frameNum);
 		}
 		}
@@ -7569,7 +7541,7 @@ namespace bgfx { namespace gl
 			  _render
 			  _render
 			, m_gpuTimer
 			, m_gpuTimer
 			, s_viewName
 			, s_viewName
-			, m_timerQuerySupport && !BX_ENABLED(BX_PLATFORM_OSX)
+			, m_timerQuerySupport
 			);
 			);
 
 
 		if (m_occlusionQuerySupport)
 		if (m_occlusionQuerySupport)

+ 4 - 33
src/renderer_gl.h

@@ -31,7 +31,6 @@
 #define BGFX_USE_GL_DYNAMIC_LIB (0 \
 #define BGFX_USE_GL_DYNAMIC_LIB (0 \
 	|| BX_PLATFORM_BSD             \
 	|| BX_PLATFORM_BSD             \
 	|| BX_PLATFORM_LINUX           \
 	|| BX_PLATFORM_LINUX           \
-	|| BX_PLATFORM_OSX             \
 	|| BX_PLATFORM_WINDOWS         \
 	|| BX_PLATFORM_WINDOWS         \
 	)
 	)
 
 
@@ -68,25 +67,12 @@
 #if BGFX_CONFIG_RENDERER_OPENGL
 #if BGFX_CONFIG_RENDERER_OPENGL
 #	if BGFX_CONFIG_RENDERER_OPENGL >= 31
 #	if BGFX_CONFIG_RENDERER_OPENGL >= 31
 #		include <gl/glcorearb.h>
 #		include <gl/glcorearb.h>
-#		if BX_PLATFORM_OSX
-#			define GL_ARB_shader_objects // OSX collsion with GLhandleARB in gltypes.h
-#		endif // BX_PLATFORM_OSX
 #	else
 #	else
 #		if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
 #		if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
 #			define GL_PROTOTYPES
 #			define GL_PROTOTYPES
 #			define GL_GLEXT_LEGACY
 #			define GL_GLEXT_LEGACY
 #			include <GL/gl.h>
 #			include <GL/gl.h>
 #			undef GL_PROTOTYPES
 #			undef GL_PROTOTYPES
-#		elif BX_PLATFORM_OSX
-#			define GL_GLEXT_LEGACY
-#			define long ptrdiff_t
-#			include <OpenGL/gl.h>
-#			undef long
-#			undef GL_VERSION_1_2
-#			undef GL_VERSION_1_3
-#			undef GL_VERSION_1_4
-#			undef GL_VERSION_1_5
-#			undef GL_VERSION_2_0
 #		elif BX_PLATFORM_WINDOWS
 #		elif BX_PLATFORM_WINDOWS
 #			ifndef WIN32_LEAN_AND_MEAN
 #			ifndef WIN32_LEAN_AND_MEAN
 #				define WIN32_LEAN_AND_MEAN
 #				define WIN32_LEAN_AND_MEAN
@@ -103,20 +89,9 @@
 #elif BGFX_CONFIG_RENDERER_OPENGLES
 #elif BGFX_CONFIG_RENDERER_OPENGLES
 typedef double GLdouble;
 typedef double GLdouble;
 #	if BGFX_CONFIG_RENDERER_OPENGLES < 30
 #	if BGFX_CONFIG_RENDERER_OPENGLES < 30
-#		if BX_PLATFORM_IOS
-#			include <OpenGLES/ES2/gl.h>
-#			include <OpenGLES/ES2/glext.h>
-//#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
-#define GL_SAMPLER_3D_OES                                       0x8B5F
-#define GL_TEXTURE_WRAP_R_OES                                   0x8072
-#define GL_PROGRAM_BINARY_LENGTH_OES                            0x8741
-#		else
-#			include <GLES2/gl2platform.h>
-#			include <GLES2/gl2.h>
-#			include <GLES2/gl2ext.h>
-#		endif // BX_PLATFORM_
+#		include <GLES2/gl2platform.h>
+#		include <GLES2/gl2.h>
+#		include <GLES2/gl2ext.h>
 typedef int64_t  GLint64;
 typedef int64_t  GLint64;
 typedef uint64_t GLuint64;
 typedef uint64_t GLuint64;
 #		define GL_PROGRAM_BINARY_LENGTH GL_PROGRAM_BINARY_LENGTH_OES
 #		define GL_PROGRAM_BINARY_LENGTH GL_PROGRAM_BINARY_LENGTH_OES
@@ -1168,11 +1143,7 @@ typedef uint64_t GLuint64;
 #	include "glcontext_glx.h"
 #	include "glcontext_glx.h"
 #elif BGFX_USE_WGL
 #elif BGFX_USE_WGL
 #	include "glcontext_wgl.h"
 #	include "glcontext_wgl.h"
-#elif BX_PLATFORM_OSX
-#	include "glcontext_nsgl.h"
-#elif BX_PLATFORM_IOS
-#	include "glcontext_eagl.h"
-#endif // BX_PLATFORM_
+#endif // BGFX_USE_*
 
 
 #ifndef GL_APIENTRY
 #ifndef GL_APIENTRY
 #	define GL_APIENTRY APIENTRY
 #	define GL_APIENTRY APIENTRY