(CocoaGL) Cleanups

This commit is contained in:
twinaphex 2019-02-10 01:16:35 +01:00
parent d0e26c10aa
commit 20a94a5f37
3 changed files with 59 additions and 92 deletions

View File

@ -14,38 +14,6 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#if TARGET_OS_IPHONE
#include <CoreGraphics/CoreGraphics.h>
#else
#include <ApplicationServices/ApplicationServices.h>
#endif
#if defined(HAVE_COCOA)
#include <OpenGL/CGLTypes.h>
#include <OpenGL/OpenGL.h>
#include <AppKit/NSScreen.h>
#include <AppKit/NSOpenGL.h>
#elif defined(HAVE_COCOATOUCH)
#include <GLKit/GLKit.h>
#endif
#include <retro_assert.h>
#include <compat/apple_compat.h>
#include "../../ui/drivers/ui_cocoa.h"
#include "../../ui/drivers/cocoa/cocoa_common.h"
#include "../video_driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"
typedef struct cocoa_ctx_data
{
bool core_hw_context_enable;
} cocoa_ctx_data_t;
#include "cocoa_gl_shared.h"
static void *cocoagl_gfx_ctx_init(video_frame_info_t *video_info, void *video_driver)

View File

@ -13,47 +13,6 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#if TARGET_OS_IPHONE
#include <CoreGraphics/CoreGraphics.h>
#else
#include <ApplicationServices/ApplicationServices.h>
#endif
#if defined(HAVE_COCOA_METAL)
#include <OpenGL/CGLTypes.h>
#include <OpenGL/OpenGL.h>
#include <AppKit/NSScreen.h>
#include <AppKit/NSOpenGL.h>
#elif defined(HAVE_COCOATOUCH)
#include <GLKit/GLKit.h>
#endif
#include <retro_assert.h>
#include <compat/apple_compat.h>
#include "../../ui/drivers/ui_cocoa.h"
#include "../../ui/drivers/cocoa/cocoa_common.h"
#include "../video_driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"
#ifdef HAVE_VULKAN
#include "../common/vulkan_common.h"
#endif
typedef struct cocoa_ctx_data
{
bool core_hw_context_enable;
#ifdef HAVE_VULKAN
gfx_ctx_vulkan_data_t vk;
int swap_interval;
#endif
unsigned width;
unsigned height;
} cocoa_ctx_data_t;
#include "cocoa_gl_shared.h"
static void *cocoagl_gfx_ctx_init(video_frame_info_t *video_info, void *video_driver)

View File

@ -1,3 +1,62 @@
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#if TARGET_OS_IPHONE
#include <CoreGraphics/CoreGraphics.h>
#else
#include <ApplicationServices/ApplicationServices.h>
#endif
#if defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL)
#include <OpenGL/CGLTypes.h>
#include <OpenGL/OpenGL.h>
#include <AppKit/NSScreen.h>
#include <AppKit/NSOpenGL.h>
#elif defined(HAVE_COCOATOUCH)
#include <GLKit/GLKit.h>
#endif
#include <retro_assert.h>
#include <compat/apple_compat.h>
#include "../../ui/drivers/ui_cocoa.h"
#include "../../ui/drivers/cocoa/cocoa_common.h"
#include "../video_driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"
#ifdef HAVE_VULKAN
#include "../common/vulkan_common.h"
#endif
typedef struct cocoa_ctx_data
{
bool core_hw_context_enable;
#ifdef HAVE_VULKAN
gfx_ctx_vulkan_data_t vk;
int swap_interval;
#endif
unsigned width;
unsigned height;
} cocoa_ctx_data_t;
#if defined(HAVE_COCOATOUCH)
#define GLContextClass EAGLContext
#define GLFrameworkID CFSTR("com.apple.opengles")
#define RAScreen UIScreen
#ifndef UIUserInterfaceIdiomTV
#define UIUserInterfaceIdiomTV 2
#endif
#ifndef UIUserInterfaceIdiomCarPlay
#define UIUserInterfaceIdiomCarPlay 3
#endif
#else
#define GLContextClass NSOpenGLContext
#define GLFrameworkID CFSTR("com.apple.opengl")
#define RAScreen NSScreen
#endif
static enum gfx_ctx_api cocoagl_api = GFX_CTX_NONE;
#if defined(HAVE_COCOATOUCH)
@ -16,27 +75,12 @@ static unsigned g_minor = 0;
static unsigned g_major = 0;
#if defined(HAVE_COCOATOUCH)
#define GLContextClass EAGLContext
#define GLFrameworkID CFSTR("com.apple.opengles")
#define RAScreen UIScreen
#ifndef UIUserInterfaceIdiomTV
#define UIUserInterfaceIdiomTV 2
#endif
#ifndef UIUserInterfaceIdiomCarPlay
#define UIUserInterfaceIdiomCarPlay 3
#endif
@interface EAGLContext (OSXCompat) @end
@implementation EAGLContext (OSXCompat)
+ (void)clearCurrentContext { [EAGLContext setCurrentContext:nil]; }
- (void)makeCurrentContext { [EAGLContext setCurrentContext:self]; }
@end
#else
@interface NSScreen (IOSCompat) @end
@implementation NSScreen (IOSCompat)
- (CGRect)bounds
@ -46,10 +90,6 @@ static unsigned g_major = 0;
}
- (float) scale { return 1.0f; }
@end
#define GLContextClass NSOpenGLContext
#define GLFrameworkID CFSTR("com.apple.opengl")
#define RAScreen NSScreen
#endif
/* forward declaration */