Merge pull request #356 from PCSX2/issue-fixes

various bug-tracker fixes
This commit is contained in:
Gregory Hainaut 2014-12-06 19:48:13 +01:00
commit 070dce4c83
9 changed files with 74 additions and 39 deletions

View File

@ -515,13 +515,12 @@ float4 FxaaPixelShader(float2 pos, FxaaTex tex, float2 fxaaRcpFrame, float fxaaS
float4 FxaaPass(float4 FxaaColor, float2 texcoord)
{
FxaaTex tex;
#if(GLSL == 1)
tex = TextureSampler;
vec2 PixelSize = textureSize(tex, 0);
FxaaColor = FxaaPixelShader(texcoord, tex, 1.0/PixelSize.xy, FxaaSubpixMax, FxaaEdgeThreshold, FxaaEdgeThresholdMin);
FxaaColor = FxaaPixelShader(texcoord, TextureSampler, pixelSize.xy, FxaaSubpixMax, FxaaEdgeThreshold, FxaaEdgeThresholdMin);
#else
FxaaTex tex;
tex.tex = Texture;
tex.smpl = TextureSampler;
FxaaColor = FxaaPixelShader(texcoord, tex, pixelSize.xy, FxaaSubpixMax, FxaaEdgeThreshold, FxaaEdgeThresholdMin);

View File

@ -0,0 +1,44 @@
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2014 PCSX2 Dev Team
*
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* PCSX2 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 for more details.
*
* You should have received a copy of the GNU General Public License along with PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <wx/apptrait.h>
// --------------------------------------------------------------------------------------
// Pcsx2AppTraits
// --------------------------------------------------------------------------------------
// Overrides and customizes some default wxWidgets behaviors. This class is instanized by
// calls to Pcsx2App::CreateTraits(), which is called from wxWidgets as-needed. wxWidgets
// does cache an instance of the traits, so the object construction need not be trivial
// (translation: it can be complicated-ish -- it won't affect performance).
//
class Pcsx2AppTraits : public wxGUIAppTraits
{
typedef wxGUIAppTraits _parent;
public:
virtual ~Pcsx2AppTraits() {}
wxMessageOutput* CreateMessageOutput();
#ifdef wxUSE_STDPATHS
#if wxMAJOR_VERSION < 3
wxStandardPathsBase& GetStandardPaths();
#else
wxStandardPaths& GetStandardPaths();
#endif
#endif
};

View File

@ -20,6 +20,7 @@
#include "Threading.h"
#include "wxGuiTools.h"
#include "pxEvents.h"
#include "AppTrait.h"
using namespace Threading;
@ -81,6 +82,8 @@ public:
wxAppWithHelpers();
virtual ~wxAppWithHelpers() {}
wxAppTraits* CreateTraits();
void CleanUp();
void DeleteObject( BaseDeletableObject& obj );

View File

@ -664,6 +664,18 @@ void wxAppWithHelpers::OnDeleteObject( wxCommandEvent& evt )
delete (BaseDeletableObject*)evt.GetClientData();
}
// In theory we create a Pcsx2App object which inherit from wxAppWithHelpers,
// so Pcsx2App::CreateTraits must be used instead.
//
// However it doesn't work this way because wxAppWithHelpers constructor will
// be called first. This constructor will build some wx objects (here wxTimer)
// that require a trait. In others word, wxAppWithHelpers::CreateTraits will be
// called instead
wxAppTraits* wxAppWithHelpers::CreateTraits()
{
return new Pcsx2AppTraits;
}
// Threads have their own deletion handler that propagates exceptions thrown by the thread to the UI.
// (thus we have a fairly automatic threaded exception system!)
void wxAppWithHelpers::OnDeleteThread( wxCommandEvent& evt )

View File

@ -362,31 +362,6 @@ public:
}
};
// --------------------------------------------------------------------------------------
// Pcsx2AppTraits
// --------------------------------------------------------------------------------------
// Overrides and customizes some default wxWidgets behaviors. This class is instanized by
// calls to Pcsx2App::CreateTraits(), which is called from wxWidgets as-needed. wxWidgets
// does cache an instance of the traits, so the object construction need not be trivial
// (translation: it can be complicated-ish -- it won't affect performance).
//
class Pcsx2AppTraits : public wxGUIAppTraits
{
typedef wxGUIAppTraits _parent;
public:
virtual ~Pcsx2AppTraits() {}
wxMessageOutput* CreateMessageOutput();
#ifdef wxUSE_STDPATHS
#if wxMAJOR_VERSION < 3
wxStandardPathsBase& GetStandardPaths();
#else
wxStandardPaths& GetStandardPaths();
#endif
#endif
};
// =====================================================================================================
// Pcsx2App - main wxApp class
// =====================================================================================================

View File

@ -31,6 +31,7 @@
#include "Debugger/DisassemblyDialog.h"
#include "Utilities/IniInterface.h"
#include "Utilities/AppTrait.h"
#include <wx/stdpaths.h>

View File

@ -57,7 +57,10 @@ bool GSWndWGL::CreateContext(int major, int minor)
// FIXME : Request a debug context to ease opengl development
// Note: don't support deprecated feature (pre openg 3.1)
//GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB | GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
#ifdef ENABLE_OGL_DEBUG
WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_DEBUG_BIT_ARB,
#endif
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
0
};

View File

@ -527,9 +527,9 @@ float4 FxaaPass(float4 FxaaColor, float2 uv0)
float4 FxaaPass(float4 FxaaColor : COLOR0, float2 uv0 : TEXCOORD0)
#endif
{
FxaaTex tex;
#if (SHADER_MODEL >= 0x400)
FxaaTex tex;
tex.tex = Texture;
tex.smpl = TextureSampler;
@ -538,12 +538,11 @@ float4 FxaaPass(float4 FxaaColor : COLOR0, float2 uv0 : TEXCOORD0)
#elif (FXAA_GLSL_130 == 1)
tex = TextureSampler;
vec2 PixelSize = textureSize(tex, 0);
FxaaColor = FxaaPixelShader(uv0, tex, 1.0/PixelSize.xy, FxaaSubpixMax, FxaaEdgeThreshold, FxaaEdgeThresholdMin);
vec2 PixelSize = textureSize(TextureSampler, 0);
FxaaColor = FxaaPixelShader(uv0, TextureSampler, 1.0/PixelSize.xy, FxaaSubpixMax, FxaaEdgeThreshold, FxaaEdgeThresholdMin);
#else
FxaaTex tex;
tex = TextureSampler;
FxaaColor = FxaaPixelShader(uv0, tex, PixelSize.xy, FxaaSubpixMax, FxaaEdgeThreshold, FxaaEdgeThresholdMin);
#endif

View File

@ -2053,9 +2053,9 @@ static const char* fxaa_fx =
"float4 FxaaPass(float4 FxaaColor : COLOR0, float2 uv0 : TEXCOORD0)\n"
"#endif\n"
"{\n"
" FxaaTex tex;\n"
"\n"
" #if (SHADER_MODEL >= 0x400)\n"
" FxaaTex tex;\n"
" tex.tex = Texture;\n"
" tex.smpl = TextureSampler;\n"
"\n"
@ -2064,12 +2064,11 @@ static const char* fxaa_fx =
"\n"
" #elif (FXAA_GLSL_130 == 1)\n"
"\n"
" tex = TextureSampler;\n"
" vec2 PixelSize = textureSize(tex, 0);\n"
" FxaaColor = FxaaPixelShader(uv0, tex, 1.0/PixelSize.xy, FxaaSubpixMax, FxaaEdgeThreshold, FxaaEdgeThresholdMin);\n"
" vec2 PixelSize = textureSize(TextureSampler, 0);\n"
" FxaaColor = FxaaPixelShader(uv0, TextureSampler, 1.0/PixelSize.xy, FxaaSubpixMax, FxaaEdgeThreshold, FxaaEdgeThresholdMin);\n"
"\n"
" #else\n"
"\n"
" FxaaTex tex;\n"
" tex = TextureSampler;\n"
" FxaaColor = FxaaPixelShader(uv0, tex, PixelSize.xy, FxaaSubpixMax, FxaaEdgeThreshold, FxaaEdgeThresholdMin);\n"
" #endif\n"