summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules
diff options
context:
space:
mode:
author arbee <rb6502@users.noreply.github.com>2019-09-15 20:00:59 -0400
committer arbee <rb6502@users.noreply.github.com>2019-09-15 20:00:59 -0400
commit2292cf332c989bf374377b61719beead0706b989 (patch)
tree8ba3c9f5af0b9e6f487a7b3fe8fccf6c3c99154a /src/osd/modules
parentfd505eb0d643a8a8a50ba32f7f0704fec400138d (diff)
Preliminary Mac native OSD. Not working yet. [R. Belmont]
This will compile, link, and run a driver all the way to the first info screen, provided you use -video bgfx. However, although there's a valid NSWindow created, it never actually appears on screen for unknown (but likely silly) reasons. Inputs are not implemented and fullscreen exists but is untried.
Diffstat (limited to 'src/osd/modules')
-rw-r--r--src/osd/modules/opengl/osd_opengl.h3
-rw-r--r--src/osd/modules/render/drawbgfx.cpp21
-rw-r--r--src/osd/modules/render/drawogl.cpp15
-rw-r--r--src/osd/modules/render/drawogl.h5
4 files changed, 40 insertions, 4 deletions
diff --git a/src/osd/modules/opengl/osd_opengl.h b/src/osd/modules/opengl/osd_opengl.h
index 26f577f343e..47d0b3c429c 100644
--- a/src/osd/modules/opengl/osd_opengl.h
+++ b/src/osd/modules/opengl/osd_opengl.h
@@ -32,6 +32,9 @@
#include "GL/wglext.h"
#endif
#endif
+ #elif defined(OSD_MAC)
+ #include <OpenGL/gl.h>
+ #include <OpenGL/glext.h>
#else
#include <SDL2/SDL_version.h>
diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp
index 0c483d9eb59..3c15bc3cf96 100644
--- a/src/osd/modules/render/drawbgfx.cpp
+++ b/src/osd/modules/render/drawbgfx.cpp
@@ -15,8 +15,12 @@
#include <SDL2/SDL_syswm.h>
#endif
#else
+#if defined(OSD_MAC)
+extern void *GetOSWindow(void *wincontroller);
+#else
#include <SDL2/SDL_syswm.h>
#endif
+#endif
// MAMEOS headers
#include "emu.h"
@@ -143,6 +147,17 @@ inline void winSetHwnd(::HWND _window)
pd.backBufferDS = NULL;
bgfx::setPlatformData(pd);
}
+#elif defined(OSD_MAC)
+inline void macSetWindow(void *_window)
+{
+ bgfx::PlatformData pd;
+ pd.ndt = NULL;
+ pd.nwh = GetOSWindow(_window);
+ pd.context = NULL;
+ pd.backBuffer = NULL;
+ pd.backBufferDS = NULL;
+ bgfx::setPlatformData(pd);
+}
#elif defined(OSD_SDL)
static void* sdlNativeWindowHandle(SDL_Window* _window)
{
@@ -240,6 +255,8 @@ int renderer_bgfx::create()
#elif defined(OSD_UWP)
winrtSetWindow(AsInspectable(std::static_pointer_cast<uwp_window_info>(win)->platform_window()));
+#elif defined(OSD_MAC)
+ macSetWindow(std::static_pointer_cast<mac_window_info>(win)->platform_window());
#else
sdlSetWindow(std::dynamic_pointer_cast<sdl_window_info>(win)->platform_window());
#endif
@@ -296,6 +313,8 @@ int renderer_bgfx::create()
m_framebuffer = m_targets->create_backbuffer(std::static_pointer_cast<win_window_info>(win)->platform_window(), m_width[win->m_index], m_height[win->m_index]);
#elif defined(OSD_UWP)
m_framebuffer = m_targets->create_backbuffer(AsInspectable(std::static_pointer_cast<uwp_window_info>(win)->platform_window()), m_width[win->m_index], m_height[win->m_index]);
+#elif defined(OSD_MAC)
+ m_framebuffer = m_targets->create_backbuffer(GetOSWindow(std::static_pointer_cast<mac_window_info>(win)->platform_window()), m_width[win->m_index], m_height[win->m_index]);
#else
m_framebuffer = m_targets->create_backbuffer(sdlNativeWindowHandle(std::dynamic_pointer_cast<sdl_window_info>(win)->platform_window()), m_width[win->m_index], m_height[win->m_index]);
#endif
@@ -949,6 +968,8 @@ bool renderer_bgfx::update_dimensions()
m_framebuffer = m_targets->create_backbuffer(std::static_pointer_cast<win_window_info>(win)->platform_window(), width, height);
#elif defined(OSD_UWP)
m_framebuffer = m_targets->create_backbuffer(AsInspectable(std::static_pointer_cast<uwp_window_info>(win)->platform_window()), width, height);
+#elif defined(OSD_MAC)
+ m_framebuffer = m_targets->create_backbuffer(GetOSWindow(std::static_pointer_cast<mac_window_info>(win)->platform_window()), width, height);
#else
m_framebuffer = m_targets->create_backbuffer(sdlNativeWindowHandle(std::dynamic_pointer_cast<sdl_window_info>(win)->platform_window()), width, height);
#endif
diff --git a/src/osd/modules/render/drawogl.cpp b/src/osd/modules/render/drawogl.cpp
index 6c1cb405316..bd4648be474 100644
--- a/src/osd/modules/render/drawogl.cpp
+++ b/src/osd/modules/render/drawogl.cpp
@@ -21,7 +21,11 @@
#include "emu.h"
#include "emuopts.h"
-#ifndef OSD_WINDOWS
+#ifdef OSD_MAC
+#define GL_SILENCE_DEPRECATION (1)
+#endif
+
+#if !defined(OSD_WINDOWS) && !defined(OSD_MAC)
// standard SDL headers
#define TOBEMIGRATED 1
#include <SDL2/SDL.h>
@@ -36,7 +40,7 @@
#include "modules/opengl/gl_shader_tool.h"
#include "modules/opengl/gl_shader_mgr.h"
-#if defined(SDLMAME_MACOSX)
+#if defined(SDLMAME_MACOSX) || defined(OSD_MAC)
#ifndef APIENTRY
#define APIENTRY
#endif
@@ -237,7 +241,7 @@ void renderer_ogl::set_blendmode(int blendmode)
//============================================================
// OGL 1.3
-#ifdef GL_ARB_multitexture
+#if defined(GL_ARB_multitexture) && !defined(OSD_MAC)
static PFNGLACTIVETEXTUREARBPROC pfn_glActiveTexture = nullptr;
#else
static PFNGLACTIVETEXTUREPROC pfn_glActiveTexture = nullptr;
@@ -558,6 +562,9 @@ int renderer_ogl::create()
// create renderer
#if defined(OSD_WINDOWS)
m_gl_context = global_alloc(win_gl_context(std::static_pointer_cast<win_window_info>(win)->platform_window()));
+#elif defined(OSD_MAC)
+// TODO
+// m_gl_context = global_alloc(mac_gl_context(std::static_pointer_cast<mac_window_info>(win)->platform_window()));
#else
m_gl_context = global_alloc(sdl_gl_context(std::static_pointer_cast<sdl_window_info>(win)->platform_window()));
#endif
@@ -886,7 +893,7 @@ void renderer_ogl::loadGLExtensions()
if ( m_useglsl )
{
- #ifdef GL_ARB_multitexture
+ #if defined(GL_ARB_multitexture) && !defined(OSD_MAC)
pfn_glActiveTexture = (PFNGLACTIVETEXTUREARBPROC) m_gl_context->getProcAddress("glActiveTextureARB");
#else
pfn_glActiveTexture = (PFNGLACTIVETEXTUREPROC) m_gl_context->getProcAddress("glActiveTexture");
diff --git a/src/osd/modules/render/drawogl.h b/src/osd/modules/render/drawogl.h
index 5444f203141..525ba0c3ffa 100644
--- a/src/osd/modules/render/drawogl.h
+++ b/src/osd/modules/render/drawogl.h
@@ -15,7 +15,11 @@
// OSD headers
#ifndef OSD_WINDOWS
+#ifdef OSD_MAC
+#include "osdmac.h"
+#else
#include "osdsdl.h"
+#endif
#include "window.h"
#else
#include "../windows/window.h"
@@ -24,6 +28,7 @@ typedef uint64_t HashT;
#if defined(OSD_WINDOWS)
#include "winglcontext.h"
+#elif defined (OSD_MAC)
#else
#include "sdlglcontext.h"
#endif