mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 00:59:44 -06:00
Merge branch 'GLSL-master'
Merge an endless story. The branch name is a lie, it was started as glsl, but now it is a complete reworked opengl3 backend. It just began with simple changes which aren't supported on osx. They either support ogl2 OR ogl3 core, but mixing isn't allowed. As the branch name says, the vicious circle starts with GLSL, but just implementing one wasn't possible either: - OSX supports only GLSL100 which doesn't support our shaders. - Vertex Array Objects are needed for ogl3, but not supported on ogl2 - immediate mode isn't supported any more, so we must implement vertex buffers - uniform buffers are recommended as else we would need tons glUniform - postprocessing shaders have to be converted to glsl - lots of smaller outdated issues and bug fixes :-) Thanks at all for testing and at Sonic for converting all of our shaders to glsl130 And sorry for all upcoming bugs...
This commit is contained in:
@ -95,11 +95,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)
|
||||
|
@ -136,7 +136,6 @@
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /e /s /y /d
|
||||
echo Copying External .dlls
|
||||
xcopy "$(SolutionDir)..\Externals\Cg\*.dll" "$(TargetDir)" /e /s /y /q /d
|
||||
xcopy "$(SolutionDir)..\Externals\OpenAL\Win32\*.dll" "$(TargetDir)" /e /s /y /q /d
|
||||
xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /s /y /q /d
|
||||
</Command>
|
||||
@ -151,7 +150,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /e /s /y /d
|
||||
echo Copying External .dlls
|
||||
xcopy "$(SolutionDir)..\Externals\Cg64\*.dll" "$(TargetDir)" /e /s /y /q /d
|
||||
xcopy "$(SolutionDir)..\Externals\OpenAL\Win64\*.dll" "$(TargetDir)" /e /s /y /q /d
|
||||
xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /s /y /q /d
|
||||
</Command>
|
||||
@ -168,7 +166,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /e /s /y /d
|
||||
echo Copying External .dlls
|
||||
xcopy "$(SolutionDir)..\Externals\Cg\*.dll" "$(TargetDir)" /e /s /y /q /d
|
||||
xcopy "$(SolutionDir)..\Externals\OpenAL\Win32\*.dll" "$(TargetDir)" /e /s /y /q /d
|
||||
xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /s /y /q /d
|
||||
</Command>
|
||||
@ -183,7 +180,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /e /s /y /d
|
||||
echo Copying External .dlls
|
||||
xcopy "$(SolutionDir)..\Externals\Cg\*.dll" "$(TargetDir)" /e /s /y /q /d
|
||||
xcopy "$(SolutionDir)..\Externals\OpenAL\Win32\*.dll" "$(TargetDir)" /e /s /y /q /d
|
||||
xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /s /y /q /d
|
||||
</Command>
|
||||
@ -200,7 +196,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /e /s /y /d
|
||||
echo Copying External .dlls
|
||||
xcopy "$(SolutionDir)..\Externals\Cg64\*.dll" "$(TargetDir)" /e /s /y /q /d
|
||||
xcopy "$(SolutionDir)..\Externals\OpenAL\Win64\*.dll" "$(TargetDir)" /e /s /y /q /d
|
||||
xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /s /y /q /d
|
||||
</Command>
|
||||
@ -217,7 +212,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /e /s /y /d
|
||||
echo Copying External .dlls
|
||||
xcopy "$(SolutionDir)..\Externals\Cg64\*.dll" "$(TargetDir)" /e /s /y /q /d
|
||||
xcopy "$(SolutionDir)..\Externals\OpenAL\Win64\*.dll" "$(TargetDir)" /e /s /y /q /d
|
||||
xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /s /y /q /d
|
||||
</Command>
|
||||
|
@ -23,8 +23,6 @@
|
||||
#include <GLInterface/InterfaceBase.h>
|
||||
#elif defined(USE_EGL) && USE_EGL
|
||||
#include "GLInterface/EGL_X11.h"
|
||||
#elif defined(USE_WX) && USE_WX
|
||||
#include "GLInterface/WX.h"
|
||||
#elif defined(__APPLE__)
|
||||
#include "GLInterface/AGL.h"
|
||||
#elif defined(_WIN32)
|
||||
@ -51,12 +49,8 @@ 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;
|
||||
NSView *cocoaWin;
|
||||
NSOpenGLContext *cocoaCtx;
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
int screen;
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include "RenderBase.h"
|
||||
#include "ConfigManager.h"
|
||||
|
||||
#include <wx/panel.h>
|
||||
|
||||
#include "VertexShaderManager.h"
|
||||
#include "../GLInterface.h"
|
||||
#include "AGL.h"
|
||||
@ -32,7 +34,7 @@ void cInterfaceAGL::Swap()
|
||||
// Show the current FPS
|
||||
void cInterfaceAGL::UpdateFPSDisplay(const char *text)
|
||||
{
|
||||
[GLWin.cocoaWin setTitle: [NSString stringWithUTF8String: text]];
|
||||
[[GLWin.cocoaWin window] setTitle: [NSString stringWithUTF8String: text]];
|
||||
}
|
||||
|
||||
// Create rendering window.
|
||||
@ -48,7 +50,7 @@ bool cInterfaceAGL::Create(void *&window_handle)
|
||||
|
||||
NSRect size;
|
||||
NSUInteger style = NSMiniaturizableWindowMask;
|
||||
NSOpenGLPixelFormatAttribute attr[2] = { NSOpenGLPFADoubleBuffer, 0 };
|
||||
NSOpenGLPixelFormatAttribute attr[] = { NSOpenGLPFADoubleBuffer, NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core, NSOpenGLPFAAccelerated, 0 };
|
||||
NSOpenGLPixelFormat *fmt = [[NSOpenGLPixelFormat alloc]
|
||||
initWithAttributes: attr];
|
||||
if (fmt == nil) {
|
||||
@ -72,8 +74,7 @@ bool cInterfaceAGL::Create(void *&window_handle)
|
||||
style |= NSResizableWindowMask | NSTitledWindowMask;
|
||||
}
|
||||
|
||||
GLWin.cocoaWin = [[NSWindow alloc] initWithContentRect: size
|
||||
styleMask: style backing: NSBackingStoreBuffered defer: NO];
|
||||
GLWin.cocoaWin = (NSView*)(((wxPanel*)window_handle)->GetHandle());;
|
||||
if (GLWin.cocoaWin == nil) {
|
||||
ERROR_LOG(VIDEO, "failed to create window");
|
||||
return NULL;
|
||||
@ -84,8 +85,8 @@ bool cInterfaceAGL::Create(void *&window_handle)
|
||||
[GLWin.cocoaWin setLevel: CGShieldingWindowLevel()];
|
||||
}
|
||||
|
||||
[GLWin.cocoaCtx setView: [GLWin.cocoaWin contentView]];
|
||||
[GLWin.cocoaWin makeKeyAndOrderFront: nil];
|
||||
[GLWin.cocoaCtx setView: GLWin.cocoaWin];
|
||||
[[GLWin.cocoaWin window] makeKeyAndOrderFront: nil];
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -94,12 +95,12 @@ bool cInterfaceAGL::MakeCurrent()
|
||||
{
|
||||
int width, height;
|
||||
|
||||
width = [[GLWin.cocoaWin contentView] frame].size.width;
|
||||
height = [[GLWin.cocoaWin contentView] frame].size.height;
|
||||
if (width == s_backbuffer_width && height == s_backbuffer_height)
|
||||
return;
|
||||
width = [GLWin.cocoaWin frame].size.width;
|
||||
height = [GLWin.cocoaWin frame].size.height;
|
||||
//if (width == s_backbuffer_width && height == s_backbuffer_height)
|
||||
// return true;
|
||||
|
||||
[GLWin.cocoaCtx setView: [GLWin.cocoaWin contentView]];
|
||||
[GLWin.cocoaCtx setView: GLWin.cocoaWin];
|
||||
[GLWin.cocoaCtx update];
|
||||
[GLWin.cocoaCtx makeCurrentContext];
|
||||
s_backbuffer_width = width;
|
||||
@ -110,7 +111,6 @@ bool cInterfaceAGL::MakeCurrent()
|
||||
// Close backend
|
||||
void cInterfaceAGL::Shutdown()
|
||||
{
|
||||
[GLWin.cocoaWin close];
|
||||
[GLWin.cocoaCtx clearDrawable];
|
||||
[GLWin.cocoaCtx release];
|
||||
}
|
||||
|
@ -69,8 +69,6 @@ bool cInterfaceGLX::Create(void *&window_handle)
|
||||
GLX_GREEN_SIZE, 8,
|
||||
GLX_BLUE_SIZE, 8,
|
||||
GLX_DEPTH_SIZE, 24,
|
||||
GLX_SAMPLE_BUFFERS_ARB, g_Config.iMultisampleMode != MULTISAMPLE_OFF?1:0,
|
||||
GLX_SAMPLES_ARB, g_Config.iMultisampleMode != MULTISAMPLE_OFF?1:0,
|
||||
None };
|
||||
|
||||
int attrListDefault[] = {
|
||||
|
@ -1,96 +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::SwapInterval(int Interval)
|
||||
{
|
||||
// WX interface only used on Apple
|
||||
#ifdef __APPLE__
|
||||
#if defined USE_WX && USE_WX
|
||||
NSOpenGLContext *ctx = GLWin.glCtxt->GetWXGLContext();
|
||||
#else
|
||||
NSOpenGLContext *ctx = GLWin.cocoaCtx;
|
||||
#endif
|
||||
[ctx setValues: &Interval forParameter: NSOpenGLCPSwapInterval];
|
||||
#endif
|
||||
}
|
||||
|
||||
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,48 +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 SwapInterval(int Interval);
|
||||
void Swap();
|
||||
void UpdateFPSDisplay(const char *Text);
|
||||
bool Create(void *&window_handle);
|
||||
bool MakeCurrent();
|
||||
void Shutdown();
|
||||
|
||||
void Update();
|
||||
};
|
||||
#endif
|
||||
|
@ -64,6 +64,10 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#import <AppKit/AppKit.h>
|
||||
#endif
|
||||
|
||||
// Nvidia drivers >= v302 will check if the application exports a global
|
||||
// variable named NvOptimusEnablement to know if it should run the app in high
|
||||
// performance graphics mode or using the IGP.
|
||||
@ -232,6 +236,17 @@ bool DolphinApp::OnInit()
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
if (floor(NSAppKitVersionNumber) < NSAppKitVersionNumber10_7)
|
||||
{
|
||||
PanicAlertT("Hi,\n\nDolphin requires OS X 10.7 or greater.\n"
|
||||
"Unfortunately you're running an old version of OS X.\n"
|
||||
"The last Dolphin version to support OS X 10.6 is Dolphin 3.5\n"
|
||||
"Please upgrade to 10.7 or greater to use the newest Dolphin version.\n\n"
|
||||
"Sayonara!\n");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
if (!wxSetWorkingDirectory(StrToWxStr(File::GetExeDirectory())))
|
||||
|
@ -82,6 +82,7 @@ wxString af_desc = wxTRANSLATE("Enable anisotropic filtering.\nEnhances visual q
|
||||
wxString aa_desc = wxTRANSLATE("Reduces the amount of aliasing caused by rasterizing 3D graphics.\nThis makes the rendered picture look less blocky.\nHeavily decreases emulation speed and sometimes causes issues.\n\nIf unsure, select None.");
|
||||
wxString scaled_efb_copy_desc = wxTRANSLATE("Greatly increases quality of textures generated using render to texture effects.\nRaising the internal resolution will improve the effect of this setting.\nSlightly decreases performance and possibly causes issues (although unlikely).\n\nIf unsure, leave this checked.");
|
||||
wxString pixel_lighting_desc = wxTRANSLATE("Calculate lighting of 3D graphics per-pixel rather than per vertex.\nDecreases emulation speed by some percent (depending on your GPU).\nThis usually is a safe enhancement, but might cause issues sometimes.\n\nIf unsure, leave this unchecked.");
|
||||
wxString hacked_buffer_upload_desc = wxTRANSLATE("Use a hacked upload strategy to stream vertices.\nThis usually speed up, but is forbidden by OpenGL specification and may causes heavy glitches.\n\nIf unsure, leave this unchecked.");
|
||||
wxString force_filtering_desc = wxTRANSLATE("Force texture filtering even if the emulated game explicitly disabled it.\nImproves texture quality slightly but causes glitches in some games.\n\nIf unsure, leave this unchecked.");
|
||||
wxString _3d_vision_desc = wxTRANSLATE("Enable 3D effects via stereoscopy using Nvidia 3D Vision technology if it's supported by your GPU.\nPossibly causes issues.\nRequires fullscreen to work.\n\nIf unsure, leave this unchecked.");
|
||||
wxString internal_res_desc = wxTRANSLATE("Specifies the resolution used to render at. A high resolution will improve visual quality a lot but is also quite heavy on performance and might cause glitches in certain games.\n\"Multiple of 640x528\" is a bit slower than \"Window Size\" but yields less issues. Generally speaking, the lower the internal resolution is, the better your performance will be.\n\nIf unsure, select 640x528.");
|
||||
@ -486,13 +487,17 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
||||
// - other hacks
|
||||
{
|
||||
wxGridSizer* const szr_other = new wxGridSizer(2, 5, 5);
|
||||
|
||||
SettingCheckBox* hacked_buffer_upload_cb;
|
||||
szr_other->Add(CreateCheckBox(page_hacks, _("Cache Display Lists"), wxGetTranslation(dlc_desc), vconfig.bDlistCachingEnable));
|
||||
szr_other->Add(CreateCheckBox(page_hacks, _("Disable Fog"), wxGetTranslation(disable_fog_desc), vconfig.bDisableFog));
|
||||
szr_other->Add(CreateCheckBox(page_hacks, _("Skip Dest. Alpha Pass"), wxGetTranslation(disable_alphapass_desc), vconfig.bDstAlphaPass));
|
||||
szr_other->Add(CreateCheckBox(page_hacks, _("OpenCL Texture Decoder"), wxGetTranslation(opencl_desc), vconfig.bEnableOpenCL));
|
||||
szr_other->Add(CreateCheckBox(page_hacks, _("OpenMP Texture Decoder"), wxGetTranslation(omp_desc), vconfig.bOMPDecoder));
|
||||
szr_other->Add(hacked_buffer_upload_cb = CreateCheckBox(page_hacks, _("Hacked Buffer Upload"), wxGetTranslation(hacked_buffer_upload_desc), vconfig.bHackedBufferUpload));
|
||||
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
hacked_buffer_upload_cb->Disable();
|
||||
|
||||
wxStaticBoxSizer* const group_other = new wxStaticBoxSizer(wxVERTICAL, page_hacks, _("Other"));
|
||||
group_other->Add(szr_other, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
|
||||
szr_hacks->Add(group_other, 0, wxEXPAND | wxALL, 5);
|
||||
@ -564,7 +569,6 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
||||
szr_misc->Add(cb_prog_scan);
|
||||
}
|
||||
|
||||
|
||||
wxStaticBoxSizer* const group_misc = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Misc"));
|
||||
szr_advanced->Add(group_misc, 0, wxEXPAND | wxALL, 5);
|
||||
group_misc->Add(szr_misc, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
|
||||
|
Reference in New Issue
Block a user