first try of osx fix, mostly by pauldachz
This commit is contained in:
parent
dae1226e1b
commit
376a807dea
|
@ -90,11 +90,7 @@ else()
|
|||
if(WIN32)
|
||||
set(SRCS ${SRCS} Src/GLInterface/GLW.cpp)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
if(USE_WX)
|
||||
set(SRCS ${SRCS} Src/GLInterface/WX.cpp)
|
||||
else()
|
||||
set(SRCS ${SRCS} Src/GLInterface/AGL.cpp)
|
||||
endif()
|
||||
set(SRCS ${SRCS} Src/GLInterface/AGL.cpp)
|
||||
else()
|
||||
set(SRCS ${SRCS} Src/GLInterface/GLX.cpp
|
||||
Src/GLInterface/X11_Util.cpp)
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
|
||||
#if defined(USE_EGL) && USE_EGL
|
||||
#include "GLInterface/EGL.h"
|
||||
#elif defined(USE_WX) && USE_WX
|
||||
#include "GLInterface/WX.h"
|
||||
#elif defined(__APPLE__)
|
||||
#include "GLInterface/AGL.h"
|
||||
#elif defined(_WIN32)
|
||||
|
@ -46,10 +44,6 @@ typedef struct {
|
|||
std::thread xEventThread;
|
||||
int x, y;
|
||||
unsigned int width, height;
|
||||
#elif defined(USE_WX) && USE_WX
|
||||
wxGLCanvas *glCanvas;
|
||||
wxGLContext *glCtxt;
|
||||
wxPanel *panel;
|
||||
#elif defined(__APPLE__)
|
||||
NSWindow *cocoaWin;
|
||||
NSOpenGLContext *cocoaCtx;
|
||||
|
|
|
@ -48,7 +48,7 @@ bool cInterfaceAGL::Create(void *&window_handle)
|
|||
|
||||
NSRect size;
|
||||
NSUInteger style = NSMiniaturizableWindowMask;
|
||||
NSOpenGLPixelFormatAttribute attr[2] = { NSOpenGLPFADoubleBuffer, 0 };
|
||||
NSOpenGLPixelFormatAttribute attr[4] = { NSOpenGLPFADoubleBuffer, NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core, 0 };
|
||||
NSOpenGLPixelFormat *fmt = [[NSOpenGLPixelFormat alloc]
|
||||
initWithAttributes: attr];
|
||||
if (fmt == nil) {
|
||||
|
@ -57,7 +57,7 @@ bool cInterfaceAGL::Create(void *&window_handle)
|
|||
}
|
||||
|
||||
GLWin.cocoaCtx = [[NSOpenGLContext alloc]
|
||||
initWithFormat: fmt shareContext: nil kCGLPFAOpenGLProfile: kCGLOGLPVersion_3_2_Core ];
|
||||
initWithFormat: fmt shareContext: nil];
|
||||
[fmt release];
|
||||
if (GLWin.cocoaCtx == nil) {
|
||||
ERROR_LOG(VIDEO, "failed to create context");
|
||||
|
@ -97,7 +97,7 @@ bool cInterfaceAGL::MakeCurrent()
|
|||
width = [[GLWin.cocoaWin contentView] frame].size.width;
|
||||
height = [[GLWin.cocoaWin contentView] frame].size.height;
|
||||
if (width == s_backbuffer_width && height == s_backbuffer_height)
|
||||
return;
|
||||
return true;
|
||||
|
||||
[GLWin.cocoaCtx setView: [GLWin.cocoaWin contentView]];
|
||||
[GLWin.cocoaCtx update];
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "VideoConfig.h"
|
||||
#include "Host.h"
|
||||
#include "RenderBase.h"
|
||||
|
||||
#include "VertexShaderManager.h"
|
||||
#include "../GLInterface.h"
|
||||
#include "WX.h"
|
||||
|
||||
void cInterfaceWX::Swap()
|
||||
{
|
||||
GLWin.glCanvas->SwapBuffers();
|
||||
}
|
||||
|
||||
void cInterfaceWX::UpdateFPSDisplay(const char *text)
|
||||
{
|
||||
// Handled by Host_UpdateTitle()
|
||||
}
|
||||
|
||||
// Create rendering window.
|
||||
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
|
||||
bool cInterfaceWX::Create(void *&window_handle)
|
||||
{
|
||||
int _tx, _ty, _twidth, _theight;
|
||||
Host_GetRenderWindowSize(_tx, _ty, _twidth, _theight);
|
||||
|
||||
// Control window size and picture scaling
|
||||
s_backbuffer_width = _twidth;
|
||||
s_backbuffer_height = _theight;
|
||||
|
||||
GLWin.panel = (wxPanel *)window_handle;
|
||||
GLWin.glCanvas = new wxGLCanvas(GLWin.panel, wxID_ANY, NULL,
|
||||
wxPoint(0, 0), wxSize(_twidth, _theight));
|
||||
GLWin.glCanvas->Show(true);
|
||||
if (GLWin.glCtxt == NULL) // XXX dirty hack
|
||||
GLWin.glCtxt = new wxGLContext(GLWin.glCanvas);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cInterfaceWX::MakeCurrent()
|
||||
{
|
||||
return GLWin.glCanvas->SetCurrent(*GLWin.glCtxt);
|
||||
}
|
||||
|
||||
// Update window width, size and etc. Called from Render.cpp
|
||||
void cInterfaceWX::Update()
|
||||
{
|
||||
int width, height;
|
||||
|
||||
GLWin.panel->GetSize(&width, &height);
|
||||
if (width == s_backbuffer_width && height == s_backbuffer_height)
|
||||
return;
|
||||
|
||||
GLWin.glCanvas->SetFocus();
|
||||
GLWin.glCanvas->SetSize(0, 0, width, height);
|
||||
GLWin.glCtxt->SetCurrent(*GLWin.glCanvas);
|
||||
s_backbuffer_width = width;
|
||||
s_backbuffer_height = height;
|
||||
}
|
||||
|
||||
// Close backend
|
||||
void cInterfaceWX::Shutdown()
|
||||
{
|
||||
GLWin.glCanvas->Hide();
|
||||
}
|
||||
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
#ifndef _INTERFACEWX_H_
|
||||
#define _INTERFACEWX_H_
|
||||
|
||||
#if defined HAVE_X11 && HAVE_X11
|
||||
#include <GL/glxew.h>
|
||||
#include <GL/gl.h>
|
||||
#elif defined __APPLE__
|
||||
#include <GL/glew.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
#endif
|
||||
|
||||
#if defined USE_WX && USE_WX
|
||||
#include "wx/wx.h"
|
||||
#include "wx/glcanvas.h"
|
||||
#endif
|
||||
|
||||
#include "InterfaceBase.h"
|
||||
|
||||
class cInterfaceWX : public cInterfaceBase
|
||||
{
|
||||
public:
|
||||
void Swap();
|
||||
void UpdateFPSDisplay(const char *Text);
|
||||
bool Create(void *&window_handle);
|
||||
bool MakeCurrent();
|
||||
void Shutdown();
|
||||
|
||||
void Update();
|
||||
};
|
||||
#endif
|
||||
|
|
@ -56,8 +56,6 @@ void InitInterface()
|
|||
{
|
||||
#if defined(USE_EGL) && USE_EGL
|
||||
GLInterface = new cInterfaceEGL;
|
||||
#elif defined(USE_WX) && USE_WX
|
||||
GLInterface = new cInterfaceWX;
|
||||
#elif defined(__APPLE__)
|
||||
GLInterface = new cInterfaceAGL;
|
||||
#elif defined(_WIN32)
|
||||
|
|
|
@ -334,9 +334,6 @@ Renderer::Renderer()
|
|||
// Handle VSync on/off
|
||||
#ifdef __APPLE__
|
||||
int swapInterval = g_ActiveConfig.bVSync ? 1 : 0;
|
||||
#if defined USE_WX && USE_WX
|
||||
NSOpenGLContext *ctx = GLWin.glCtxt->GetWXGLContext();
|
||||
#else
|
||||
NSOpenGLContext *ctx = GLWin.cocoaCtx;
|
||||
#endif
|
||||
[ctx setValues: &swapInterval forParameter: NSOpenGLCPSwapInterval];
|
||||
|
|
|
@ -137,7 +137,8 @@ size_t StreamBuffer::Upload ( u8* data, size_t size )
|
|||
break;
|
||||
case PINNED_MEMORY:
|
||||
case MAP_AND_RISK:
|
||||
memcpy(pointer+m_iterator, data, size);
|
||||
if(pointer)
|
||||
memcpy(pointer+m_iterator, data, size);
|
||||
break;
|
||||
case BUFFERSUBDATA:
|
||||
glBufferSubData(m_buffertype, m_iterator, size, data);
|
||||
|
@ -187,6 +188,8 @@ void StreamBuffer::Init()
|
|||
glBufferData(m_buffertype, m_size, NULL, GL_STREAM_DRAW);
|
||||
pointer = (u8*)glMapBuffer(m_buffertype, GL_WRITE_ONLY);
|
||||
glUnmapBuffer(m_buffertype);
|
||||
if(!pointer)
|
||||
ERROR_LOG(VIDEO, "buffer allocation failed");
|
||||
|
||||
case STREAM_DETECT:
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue