GSdx: Added the color control functionality known as "ShadeBoost". Thanks to KrossX for initial converting / GUI work and Pseudonym for normalizing / fixing the maths.

Note: Not sure if it should be shader #7 or smth else :p

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5110 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2 2012-02-29 00:29:29 +00:00
parent 0933ee2fd5
commit 954e7906ed
18 changed files with 466 additions and 52 deletions

View File

@ -38,6 +38,7 @@ GPURenderer::GPURenderer(GSDevice* dev)
m_vsync = !!theApp.GetConfig("vsync", 0);
m_fxaa = !!theApp.GetConfig("fxaa", 0);
m_scale = m_mem.GetScale();
m_shadeboost = !!theApp.GetConfig("ShadeBoost", 0);
#ifdef _WINDOWS
@ -117,6 +118,11 @@ bool GPURenderer::Merge()
m_dev->Merge(st, sr, dr, s, 1, 1, GSVector4(0, 0, 0, 1));
if(m_shadeboost)
{
m_dev->ShadeBoost();
}
if(m_fxaa)
{
m_dev->FXAA();

View File

@ -36,6 +36,7 @@ protected:
int m_aspectratio;
bool m_vsync;
bool m_fxaa;
bool m_shadeboost;
GSVector2i m_scale;
virtual void ResetDevice() {}

View File

@ -32,6 +32,7 @@ GSDevice::GSDevice()
, m_weavebob(NULL)
, m_blend(NULL)
, m_fxaa(NULL)
, m_shadeboost(NULL)
, m_1x1(NULL)
, m_frame(0)
{
@ -48,6 +49,7 @@ GSDevice::~GSDevice()
delete m_weavebob;
delete m_blend;
delete m_fxaa;
delete m_shadeboost;
delete m_1x1;
}
@ -69,6 +71,7 @@ bool GSDevice::Reset(int w, int h)
delete m_weavebob;
delete m_blend;
delete m_fxaa;
delete m_shadeboost;
delete m_1x1;
m_backbuffer = NULL;
@ -76,6 +79,7 @@ bool GSDevice::Reset(int w, int h)
m_weavebob = NULL;
m_blend = NULL;
m_fxaa = NULL;
m_shadeboost = NULL;
m_1x1 = NULL;
m_current = NULL; // current is special, points to other textures, no need to delete
@ -317,6 +321,26 @@ void GSDevice::FXAA()
}
}
void GSDevice::ShadeBoost()
{
GSVector2i s = m_current->GetSize();
if(m_shadeboost == NULL || m_shadeboost->GetSize() != s)
{
delete m_shadeboost;
m_shadeboost = CreateRenderTarget(s.x, s.y, false);
}
if(m_shadeboost != NULL)
{
GSVector4 sr(0, 0, 1, 1);
GSVector4 dr(0, 0, s.x, s.y);
StretchRect(m_current, sr, m_shadeboost, dr, 7, false);
DoShadeBoost(m_shadeboost, m_current);
}
}
bool GSDevice::ResizeTexture(GSTexture** t, int w, int h)
{
if(t == NULL) {ASSERT(0); return false;}

View File

@ -55,6 +55,15 @@ public:
FXAAConstantBuffer() {memset(this, 0, sizeof(*this));}
};
class ShadeBoostConstantBuffer
{
public:
GSVector4 rcpFrame;
GSVector4 rcpFrameOpt;
ShadeBoostConstantBuffer() {memset(this, 0, sizeof(*this));}
};
#pragma pack(pop)
class GSDevice : public GSAlignedClass<32>
@ -70,6 +79,7 @@ protected:
GSTexture* m_weavebob;
GSTexture* m_blend;
GSTexture* m_fxaa;
GSTexture* m_shadeboost;
GSTexture* m_1x1;
GSTexture* m_current;
struct {size_t stride, start, count, limit;} m_vertex;
@ -82,6 +92,7 @@ protected:
virtual void DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dt, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c) = 0;
virtual void DoInterlace(GSTexture* st, GSTexture* dt, int shader, bool linear, float yoffset) = 0;
virtual void DoFXAA(GSTexture* st, GSTexture* dt) {}
virtual void DoShadeBoost(GSTexture* st, GSTexture* dt) {}
public:
GSDevice();
@ -134,6 +145,7 @@ public:
void Merge(GSTexture* st[2], GSVector4* sr, GSVector4* dr, const GSVector2i& fs, bool slbg, bool mmod, const GSVector4& c);
void Interlace(const GSVector2i& ds, int field, int mode, float yoffset);
void FXAA();
void ShadeBoost();
bool ResizeTexture(GSTexture** t, int w, int h);

View File

@ -201,6 +201,36 @@ bool GSDevice11::Create(GSWnd* wnd)
hr = CompileShader(IDR_INTERLACE_FX, format("ps_main%d", i).c_str(), NULL, &m_interlace.ps[i]);
}
// Shade Boost
int ShadeBoost_Contrast = theApp.GetConfig("ShadeBoost_Contrast", 50);
int ShadeBoost_Brightness = theApp.GetConfig("ShadeBoost_Brightness", 50);
int ShadeBoost_Saturation = theApp.GetConfig("ShadeBoost_Saturation", 50);
string str[3];
str[0] = format("%d", ShadeBoost_Saturation);
str[1] = format("%d", ShadeBoost_Brightness);
str[2] = format("%d", ShadeBoost_Contrast);
D3D11_SHADER_MACRO macro[] =
{
{"SB_SATURATION", str[0].c_str()},
{"SB_BRIGHTNESS", str[1].c_str()},
{"SB_CONTRAST", str[2].c_str()},
{NULL, NULL},
};
memset(&bd, 0, sizeof(bd));
bd.ByteWidth = sizeof(ShadeBoostConstantBuffer);
bd.Usage = D3D11_USAGE_DEFAULT;
bd.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
hr = m_dev->CreateBuffer(&bd, NULL, &m_shadeboost.cb);
hr = CompileShader(IDR_SHADEBOOST_FX, "ps_main", macro, &m_shadeboost.ps);
// fxaa
memset(&bd, 0, sizeof(bd));
@ -670,6 +700,23 @@ void GSDevice11::DoFXAA(GSTexture* st, GSTexture* dt)
//dt->Save("c:\\temp1\\2.bmp");
}
void GSDevice11::DoShadeBoost(GSTexture* st, GSTexture* dt)
{
GSVector2i s = dt->GetSize();
GSVector4 sr(0, 0, 1, 1);
GSVector4 dr(0, 0, s.x, s.y);
ShadeBoostConstantBuffer cb;
cb.rcpFrame = GSVector4(1.0f / s.x, 1.0f / s.y, 0.0f, 0.0f);
cb.rcpFrameOpt = GSVector4::zero();
m_ctx->UpdateSubresource(m_shadeboost.cb, 0, NULL, &cb, 0, 0);
StretchRect(st, sr, dt, dr, m_shadeboost.ps, m_shadeboost.cb, true);
}
void GSDevice11::SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* vertices, bool datm)
{
const GSVector2i& size = rt->GetSize();

View File

@ -37,6 +37,7 @@ class GSDevice11 : public GSDeviceDX
void DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dt, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c);
void DoInterlace(GSTexture* st, GSTexture* dt, int shader, bool linear, float yoffset = 0);
void DoFXAA(GSTexture* st, GSTexture* dt);
void DoShadeBoost(GSTexture* st, GSTexture* dt);
//
@ -110,6 +111,12 @@ public: // TODO
CComPtr<ID3D11Buffer> cb;
} m_fxaa;
struct
{
CComPtr<ID3D11PixelShader> ps;
CComPtr<ID3D11Buffer> cb;
} m_shadeboost;
struct
{
CComPtr<ID3D11DepthStencilState> dss;

View File

@ -282,6 +282,28 @@ bool GSDevice9::Create(GSWnd* wnd)
CompileShader(IDR_INTERLACE_FX, format("ps_main%d", i), NULL, &m_interlace.ps[i]);
}
// Shade Boost
int ShadeBoost_Contrast = theApp.GetConfig("ShadeBoost_Contrast", 50);
int ShadeBoost_Brightness = theApp.GetConfig("ShadeBoost_Brightness", 50);
int ShadeBoost_Saturation = theApp.GetConfig("ShadeBoost_Saturation", 50);
string str[3];
str[0] = format("%d", ShadeBoost_Saturation);
str[1] = format("%d", ShadeBoost_Brightness);
str[2] = format("%d", ShadeBoost_Contrast);
D3DXMACRO macro[] =
{
{"SB_SATURATION", str[0].c_str()},
{"SB_BRIGHTNESS", str[1].c_str()},
{"SB_CONTRAST", str[2].c_str()},
{NULL, NULL},
};
CompileShader(IDR_SHADEBOOST_FX, "ps_main", macro, &m_shadeboost.ps);
// fxaa
CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps);
@ -860,6 +882,21 @@ void GSDevice9::DoFXAA(GSTexture* st, GSTexture* dt)
StretchRect(st, sr, dt, dr, m_fxaa.ps, (const float*)&cb, 2, true);
}
void GSDevice9::DoShadeBoost(GSTexture* st, GSTexture* dt)
{
GSVector2i s = dt->GetSize();
GSVector4 sr(0, 0, 1, 1);
GSVector4 dr(0, 0, s.x, s.y);
ShadeBoostConstantBuffer cb;
cb.rcpFrame = GSVector4(1.0f / s.x, 1.0f / s.y, 0.0f, 0.0f);
cb.rcpFrameOpt = GSVector4::zero();
StretchRect(st, sr, dt, dr, m_shadeboost.ps, (const float*)&cb, 1, true);
}
void GSDevice9::SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* vertices, bool datm)
{
const GSVector2i& size = rt->GetSize();

View File

@ -72,6 +72,7 @@ class GSDevice9 : public GSDeviceDX
void DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dt, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c);
void DoInterlace(GSTexture* st, GSTexture* dt, int shader, bool linear, float yoffset = 0);
void DoFXAA(GSTexture* st, GSTexture* dt);
void DoShadeBoost(GSTexture* st, GSTexture* dt);
//
@ -139,6 +140,11 @@ public: // TODO
CComPtr<IDirect3DPixelShader9> ps;
} m_fxaa;
struct
{
CComPtr<IDirect3DPixelShader9> ps;
} m_shadeboost;
struct
{
Direct3DDepthStencilState9 dss;

View File

@ -35,6 +35,7 @@ GSRenderer::GSRenderer()
m_aa1 = !!theApp.GetConfig("aa1", 0);
m_mipmap = !!theApp.GetConfig("mipmap", 1);
m_fxaa = !!theApp.GetConfig("fxaa", 0);
m_shadeboost = !!theApp.GetConfig("ShadeBoost", 0);
}
GSRenderer::~GSRenderer()
@ -254,6 +255,11 @@ bool GSRenderer::Merge(int field)
m_dev->Interlace(ds, field ^ field2, mode, tex[1] ? tex[1]->GetScale().y : tex[0]->GetScale().y);
}
if(m_shadeboost)
{
m_dev->ShadeBoost();
}
if(m_fxaa)
{
m_dev->FXAA();

View File

@ -44,6 +44,7 @@ protected:
bool m_mipmap;
bool m_framelimit;
bool m_fxaa;
bool m_shadeboost;
virtual GSTexture* GetOutput(int i) = 0;

View File

@ -110,6 +110,10 @@ void GSSettingsDlg::OnInit()
CheckDlgButton(m_hWnd, IDC_ALPHAHACK, theApp.GetConfig("UserHacks_AlphaHack", 0));
CheckDlgButton(m_hWnd, IDC_OFFSETHACK, theApp.GetConfig("UserHacks_HalfPixelOffset", 0));
CheckDlgButton(m_hWnd, IDC_SPRITEHACK, theApp.GetConfig("UserHacks_SpriteHack", 0));
// Shade Boost
CheckDlgButton(m_hWnd, IDC_SHADEBOOST, theApp.GetConfig("ShadeBoost", 0));
SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_SETRANGE, 0, MAKELPARAM(1000, 0));
SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("UserHacks_SkipDraw", 0), 0));
@ -220,6 +224,14 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
{
UpdateControls();
}
else if(id == IDC_SHADEBOOST && code == BN_CLICKED)
{
UpdateControls();
}
else if(id == IDC_SHADEBUTTON && code == BN_CLICKED)
{
ShadeBoostDlg.DoModal();
}
else if(id == IDOK)
{
INT_PTR data;
@ -278,6 +290,9 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
theApp.SetConfig("UserHacks_HalfPixelOffset", (int)IsDlgButtonChecked(m_hWnd, IDC_OFFSETHACK));
theApp.SetConfig("UserHacks_SpriteHack", (int)IsDlgButtonChecked(m_hWnd, IDC_SPRITEHACK));
theApp.SetConfig("UserHacks_SkipDraw", (int)SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_GETPOS, 0, 0));
// Shade Boost
theApp.SetConfig("ShadeBoost", (int)IsDlgButtonChecked(m_hWnd, IDC_SHADEBOOST));
}
return __super::OnCommand(hWnd, id, code);
@ -326,6 +341,9 @@ void GSSettingsDlg::UpdateControls()
EnableWindow(GetDlgItem(m_hWnd, IDC_MSAAEDIT), hw);
EnableWindow(GetDlgItem(m_hWnd, IDC_MSAA), hw);
// Shade Boost
EnableWindow(GetDlgItem(m_hWnd, IDC_SHADEBUTTON), IsDlgButtonChecked(m_hWnd, IDC_SHADEBOOST) == BST_CHECKED);
//ShowWindow(GetDlgItem(m_hWnd, IDC_USERHACKS), allowHacks && hw) ? SW_SHOW : SW_HIDE; //Don't disable the "Hacks" frame
ShowWindow(GetDlgItem(m_hWnd, IDC_HACKDISABLED), !(allowHacks && hw)) ? SW_SHOW : SW_HIDE;
ShowWindow(GetDlgItem(m_hWnd, IDC_MSAAEDIT), allowHacks && hw) ? SW_SHOW : SW_HIDE;
@ -341,3 +359,110 @@ void GSSettingsDlg::UpdateControls()
ShowWindow(GetDlgItem(m_hWnd, IDC_STATIC_TEXT_SKIPDRAW), allowHacks && hw) ? SW_SHOW : SW_HIDE;
}
}
GSShadeBostDlg::GSShadeBostDlg() :
GSDialog(IDD_SHADEBOOST)
{}
void GSShadeBostDlg::OnInit()
{
contrast = theApp.GetConfig("ShadeBoost_Contrast", 50);
brightness = theApp.GetConfig("ShadeBoost_Brightness", 50);
saturation = theApp.GetConfig("ShadeBoost_Saturation", 50);
UpdateControls();
}
void GSShadeBostDlg::UpdateControls()
{
SendMessage(GetDlgItem(m_hWnd, IDC_SATURATION_SLIDER), TBM_SETRANGE, TRUE, MAKELONG(0, 100));
SendMessage(GetDlgItem(m_hWnd, IDC_BRIGHTNESS_SLIDER), TBM_SETRANGE, TRUE, MAKELONG(0, 100));
SendMessage(GetDlgItem(m_hWnd, IDC_CONTRAST_SLIDER), TBM_SETRANGE, TRUE, MAKELONG(0, 100));
SendMessage(GetDlgItem(m_hWnd, IDC_SATURATION_SLIDER), TBM_SETPOS, TRUE, saturation);
SendMessage(GetDlgItem(m_hWnd, IDC_BRIGHTNESS_SLIDER), TBM_SETPOS, TRUE, brightness);
SendMessage(GetDlgItem(m_hWnd, IDC_CONTRAST_SLIDER), TBM_SETPOS, TRUE, contrast);
char text[8] = {0};
sprintf(text, "%d", saturation);
SetDlgItemText(m_hWnd, IDC_SATURATION_TEXT, text);
sprintf(text, "%d", brightness);
SetDlgItemText(m_hWnd, IDC_BRIGHTNESS_TEXT, text);
sprintf(text, "%d", contrast);
SetDlgItemText(m_hWnd, IDC_CONTRAST_TEXT, text);
}
bool GSShadeBostDlg::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_HSCROLL:
{
if((HWND)lParam == GetDlgItem(m_hWnd, IDC_SATURATION_SLIDER))
{
char text[8] = {0};
saturation = SendMessage(GetDlgItem(m_hWnd, IDC_SATURATION_SLIDER),TBM_GETPOS,0,0);
sprintf(text, "%d", saturation);
SetDlgItemText(m_hWnd, IDC_SATURATION_TEXT, text);
}
else if((HWND)lParam == GetDlgItem(m_hWnd, IDC_BRIGHTNESS_SLIDER))
{
char text[8] = {0};
brightness = SendMessage(GetDlgItem(m_hWnd, IDC_BRIGHTNESS_SLIDER),TBM_GETPOS,0,0);
sprintf(text, "%d", brightness);
SetDlgItemText(m_hWnd, IDC_BRIGHTNESS_TEXT, text);
}
else if((HWND)lParam == GetDlgItem(m_hWnd, IDC_CONTRAST_SLIDER))
{
char text[8] = {0};
contrast = SendMessage(GetDlgItem(m_hWnd, IDC_CONTRAST_SLIDER),TBM_GETPOS,0,0);
sprintf(text, "%d", contrast);
SetDlgItemText(m_hWnd, IDC_CONTRAST_TEXT, text);
}
} break;
case WM_COMMAND:
{
int id = LOWORD(wParam);
switch(id)
{
case IDOK:
{
theApp.SetConfig("ShadeBoost_Contrast", contrast);
theApp.SetConfig("ShadeBoost_Brightness", brightness);
theApp.SetConfig("ShadeBoost_Saturation", saturation);
EndDialog(m_hWnd, id);
} break;
case IDRESET:
{
contrast = 50;
brightness = 50;
saturation = 50;
UpdateControls();
} break;
}
} break;
case WM_CLOSE:EndDialog(m_hWnd, IDCANCEL); break;
default: return false;
}
return true;
}

View File

@ -24,6 +24,22 @@
#include "GSDialog.h"
#include "GSSetting.h"
class GSShadeBostDlg : public GSDialog
{
int saturation;
int brightness;
int contrast;
void UpdateControls();
protected:
void OnInit();
bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
public:
GSShadeBostDlg();
};
class GSSettingsDlg : public GSDialog
{
list<D3DDISPLAYMODE> m_modes;
@ -37,6 +53,9 @@ protected:
uint32 m_lastValidMsaa; // used to revert to previous dialog value if the user changed to invalid one, or lesser one and canceled
// Shade Boost
GSShadeBostDlg ShadeBoostDlg;
public:
GSSettingsDlg(bool isOpen2);
};

View File

@ -42,6 +42,7 @@ BEGIN
"#include ""res/interlace.fx""\r\n"
"#include ""res/merge.fx""\r\0"
"#include ""res/fxaa.fx""\r\0"
"#include ""res/shadeboost.fx""\r\0"
END
#endif // APSTUDIO_INVOKED
@ -58,6 +59,7 @@ IDR_MERGE_FX RCDATA "res\\merge.fx"
IDR_INTERLACE_FX RCDATA "res\\interlace.fx"
IDR_FXAA_FX RCDATA "res\\fxaa.fx"
IDR_CS_FX RCDATA "res\\cs.fx"
IDR_SHADEBOOST_FX RCDATA "res\\shadeboost.fx"
/////////////////////////////////////////////////////////////////////////////
//
@ -72,7 +74,26 @@ IDB_LOGO10 BITMAP "res\\logo10.bmp"
// Dialog
//
IDD_CONFIG DIALOGEX 0, 0, 189, 327
IDD_SHADEBOOST DIALOGEX 0, 0, 316, 129
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Shade Boost Settings"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,259,108,50,14
PUSHBUTTON "Reset",IDRESET,7,108,50,14
GROUPBOX "Color Adjustments",IDC_STATIC,7,7,302,95
LTEXT "Saturation",IDC_STATIC,15,25,34,8
CONTROL "",IDC_SATURATION_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,23,236,15
LTEXT "Brightness",IDC_STATIC,15,50,34,8
CONTROL "",IDC_BRIGHTNESS_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,48,236,15
LTEXT "Contrast",IDC_STATIC,15,75,29,8
CONTROL "",IDC_CONTRAST_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,72,236,15
RTEXT "100",IDC_SATURATION_TEXT,288,25,15,8
RTEXT "100",IDC_BRIGHTNESS_TEXT,288,50,15,8
RTEXT "100",IDC_CONTRAST_TEXT,288,75,15,8
END
IDD_CONFIG DIALOGEX 0, 0, 189, 337
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Settings..."
FONT 8, "MS Shell Dlg", 400, 0, 0x1
@ -87,9 +108,9 @@ BEGIN
COMBOBOX IDC_INTERLACE,71,86,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Aspect Ratio (F6):",IDC_STATIC,7,104,60,8
COMBOBOX IDC_ASPECTRATIO,71,101,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "OK",IDOK,43,303,50,14
PUSHBUTTON "Cancel",IDCANCEL,96,303,50,14
CONTROL "Windowed",IDC_WINDOWED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,231,93,10
DEFPUSHBUTTON "OK",IDOK,43,316,50,14
PUSHBUTTON "Cancel",IDCANCEL,96,316,50,14
CONTROL "Windowed",IDC_WINDOWED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,244,93,10
LTEXT "D3D internal res:",IDC_STATIC,18,135,55,8
EDITTEXT IDC_RESX_EDIT,82,132,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_RESX,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,110,135,11,14
@ -99,26 +120,28 @@ BEGIN
COMBOBOX IDC_UPSCALE_MULTIPLIER,82,147,74,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Or use Scaling:",IDC_STATIC,18,150,49,8
LTEXT "Or use original PS2 resolution :",IDC_STATIC,18,165,99,8
EDITTEXT IDC_MSAAEDIT,45,259,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_MSAA,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,76,261,11,14
LTEXT "HW AA",IDC_STATIC_TEXT_HWAA,18,261,24,8
EDITTEXT IDC_MSAAEDIT,45,272,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_MSAA,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,76,274,11,14
LTEXT "HW AA",IDC_STATIC_TEXT_HWAA,18,274,24,8
GROUPBOX "D3D Enhancements (can cause glitches)",IDC_STATIC,7,117,175,66
LTEXT "Extra rendering threads:",IDC_STATIC,7,189,80,8
EDITTEXT IDC_SWTHREADS_EDIT,89,187,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,117,190,11,14
CONTROL "Texture filtering",IDC_FILTER,"Button",BS_AUTO3STATE | WS_TABSTOP,7,203,67,10
CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,204,58,10
CONTROL "Allow 8-bit textures",IDC_PALTEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,217,82,10
CONTROL "Alpha correction (FBA)",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,217,93,10
CONTROL "Edge anti-aliasing",IDC_AA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,231,72,10
CONTROL "Alpha Hack",IDC_ALPHAHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,280,51,10
CONTROL "Offset Hack",IDC_OFFSETHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,67,280,51,10
GROUPBOX "Hacks",IDC_USERHACKS,7,244,175,53,BS_CENTER
EDITTEXT IDC_SKIPDRAWHACKEDIT,122,259,40,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SKIPDRAWHACK,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,161,261,11,14
LTEXT "SkipDraw:",IDC_STATIC_TEXT_SKIPDRAW,89,261,33,8
CONTROL "Sprite Hack",IDC_SPRITEHACK,"Button",BS_AUTO3STATE | WS_TABSTOP,123,280,51,10
LTEXT "HACKS DISABLED",IDC_HACKDISABLED,64,268,57,8,WS_DISABLED
LTEXT "Extra rendering threads:",IDC_STATIC,7,202,80,8
EDITTEXT IDC_SWTHREADS_EDIT,89,200,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,117,203,11,14
CONTROL "Texture filtering",IDC_FILTER,"Button",BS_AUTO3STATE | WS_TABSTOP,7,216,67,10
CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,217,58,10
CONTROL "Allow 8-bit textures",IDC_PALTEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,230,82,10
CONTROL "Alpha correction (FBA)",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,230,93,10
CONTROL "Edge anti-aliasing",IDC_AA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,244,72,10
CONTROL "Alpha Hack",IDC_ALPHAHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,293,51,10
CONTROL "Offset Hack",IDC_OFFSETHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,67,293,51,10
GROUPBOX "Hacks",IDC_USERHACKS,7,257,175,53,BS_CENTER
EDITTEXT IDC_SKIPDRAWHACKEDIT,122,272,40,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SKIPDRAWHACK,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,161,274,11,14
LTEXT "SkipDraw:",IDC_STATIC_TEXT_SKIPDRAW,89,274,33,8
CONTROL "Sprite Hack",IDC_SPRITEHACK,"Button",BS_AUTO3STATE | WS_TABSTOP,123,293,51,10
LTEXT "HACKS DISABLED",IDC_HACKDISABLED,64,281,57,8,WS_DISABLED
CONTROL "Enable Shade Boost",IDC_SHADEBOOST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,187,79,10
PUSHBUTTON "Settings...",IDC_SHADEBUTTON,88,184,94,14
END
IDD_CAPTURE DIALOGEX 0, 0, 279, 71
@ -165,13 +188,13 @@ BEGIN
CONTROL "Windowed",IDC_WINDOWED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,129,157,49,10
END
IDD_CONFIG2 DIALOGEX 0, 0, 187, 325
IDD_CONFIG2 DIALOGEX 0, 0, 187, 342
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Settings..."
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL 2022,IDC_LOGO11,"Static",SS_BITMAP,6,6,173,42
DEFPUSHBUTTON "OK",IDOK,41,301,50,14
DEFPUSHBUTTON "OK",IDOK,41,320,50,14
LTEXT "Renderer:",IDC_STATIC,6,57,34,8
COMBOBOX IDC_RENDERER,70,55,111,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Interlacing (F5):",IDC_STATIC,6,73,81,8
@ -182,33 +205,35 @@ BEGIN
EDITTEXT IDC_RESY_EDIT,130,132,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_RESY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,154,130,11,14
CONTROL "Native",IDC_NATIVERES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,105,33,10
LTEXT "Extra rendering threads:",IDC_STATIC,11,214,80,8
EDITTEXT IDC_SWTHREADS_EDIT,94,212,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,127,215,11,14
LTEXT "Extra rendering threads:",IDC_STATIC,11,233,80,8
EDITTEXT IDC_SWTHREADS_EDIT,94,231,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,127,234,11,14
COMBOBOX IDC_UPSCALE_MULTIPLIER,92,117,74,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Or use Scaling:",IDC_STATIC,38,119,49,8
LTEXT "Original PS2 resolution :",IDC_STATIC,10,105,80,8
CONTROL "Edge anti-aliasing (AA1)",IDC_AA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,230,93,10
PUSHBUTTON "Cancel",IDCANCEL,95,301,50,14
CONTROL "Edge anti-aliasing (AA1)",IDC_AA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,249,93,10
PUSHBUTTON "Cancel",IDCANCEL,95,320,50,14
CONTROL 2021,IDC_LOGO9,"Static",SS_BITMAP,6,6,175,44
CONTROL "Alpha Hack",IDC_ALPHAHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,279,51,10
CONTROL "Offset Hack",IDC_OFFSETHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,65,279,51,10
GROUPBOX "Hacks",IDC_USERHACKS,6,250,175,45,BS_CENTER
EDITTEXT IDC_SKIPDRAWHACKEDIT,125,260,40,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SKIPDRAWHACK,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,164,262,11,14
LTEXT "Skipdraw",IDC_STATIC_TEXT_SKIPDRAW,93,262,30,8
EDITTEXT IDC_MSAAEDIT,38,260,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_MSAA,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,72,263,11,14
CONTROL "Alpha Hack",IDC_ALPHAHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,298,51,10
CONTROL "Offset Hack",IDC_OFFSETHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,65,298,51,10
GROUPBOX "Hacks",IDC_USERHACKS,6,269,175,45,BS_CENTER
EDITTEXT IDC_SKIPDRAWHACKEDIT,125,279,40,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SKIPDRAWHACK,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,164,281,11,14
LTEXT "Skipdraw",IDC_STATIC_TEXT_SKIPDRAW,93,281,30,8
EDITTEXT IDC_MSAAEDIT,38,279,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_MSAA,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,72,282,11,14
GROUPBOX "D3D Internal resolution (can cause glitches)",IDC_STATIC,6,87,175,64,BS_CENTER
GROUPBOX "Software Mode Settings",IDC_STATIC,6,198,175,50,BS_CENTER
GROUPBOX "Hardware Mode Settings",IDC_STATIC,6,152,175,45,BS_CENTER
CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,166,58,10
CONTROL "Alpha correction (FBA)",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,179,87,10
CONTROL "Allow 8-bit textures",IDC_PALTEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,179,82,10
CONTROL "Texture filtering",IDC_FILTER,"Button",BS_AUTO3STATE | WS_TABSTOP,10,165,67,10
LTEXT "HW AA",IDC_STATIC_TEXT_HWAA,11,262,24,8
CONTROL "Sprite Hack",IDC_SPRITEHACK,"Button",BS_AUTO3STATE | WS_TABSTOP,125,279,51,10
LTEXT "HACKS DISABLED",IDC_HACKDISABLED,62,268,57,8,WS_DISABLED
GROUPBOX "Software Mode Settings",IDC_STATIC,6,217,175,50,BS_CENTER
GROUPBOX "Hardware Mode Settings",IDC_STATIC,6,171,175,45,BS_CENTER
CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,185,58,10
CONTROL "Alpha correction (FBA)",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,198,87,10
CONTROL "Allow 8-bit textures",IDC_PALTEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,198,82,10
CONTROL "Texture filtering",IDC_FILTER,"Button",BS_AUTO3STATE | WS_TABSTOP,10,184,67,10
LTEXT "HW AA",IDC_STATIC_TEXT_HWAA,11,281,24,8
CONTROL "Sprite Hack",IDC_SPRITEHACK,"Button",BS_AUTO3STATE | WS_TABSTOP,125,298,51,10
LTEXT "HACKS DISABLED",IDC_HACKDISABLED,62,287,57,8,WS_DISABLED
CONTROL "Enable Shade Boost",IDC_SHADEBOOST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,157,79,10
PUSHBUTTON "Settings...",IDC_SHADEBUTTON,95,154,75,14
END
@ -228,7 +253,7 @@ BEGIN
VERTGUIDE, 89
VERTGUIDE, 182
TOPMARGIN, 7
BOTTOMMARGIN, 320
BOTTOMMARGIN, 330
HORZGUIDE, 49
END
@ -256,7 +281,15 @@ BEGIN
RIGHTMARGIN, 181
VERTGUIDE, 87
TOPMARGIN, 6
BOTTOMMARGIN, 318
BOTTOMMARGIN, 335
END
IDD_SHADEBOOST, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 309
TOPMARGIN, 7
BOTTOMMARGIN, 122
END
END
#endif // APSTUDIO_INVOKED

View File

@ -1680,6 +1680,7 @@
<None Include="res\convert.fx" />
<None Include="res\interlace.fx" />
<None Include="res\merge.fx" />
<None Include="res\shadeboost.fx" />
<None Include="res\tfx.fx" />
<None Include="baseclasses\activex.rcv" />
<None Include="baseclasses\activex.ver" />

View File

@ -674,6 +674,9 @@
<None Include="res\cs.fx">
<Filter>Shaders</Filter>
</None>
<None Include="res\shadeboost.fx">
<Filter>Shaders</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="GSdx.rc">

View File

@ -1708,6 +1708,10 @@
RelativePath=".\res\merge.fx"
>
</File>
<File
RelativePath=".\res\shadeboost.fx"
>
</File>
<File
RelativePath=".\res\tfx.fx"
>

View File

@ -0,0 +1,71 @@
#ifdef SHADER_MODEL // make safe to include in resource file to enforce dependency
float4 ConvertYUV(float4 color)
{
float4 color2 = color;
float fSat = SB_SATURATION / 100.0;
float fBrt = SB_BRIGHTNESS / 100.0;
float fCont = SB_CONTRAST / 100.0;
float gY = color.r*0.299+color.g*0.587+color.b*0.114;
float gCr = ( color.r-gY )*0.713*(0.5+fSat);
float gCb = ( color.b-gY )*0.565*(0.5+fSat);
gY = gY*(0.5+fCont);
color2.r = gY + 1.40252*gCr;
color2.g = gY - 0.714403*gCr - 0.343731*gCb;
color2.b = gY + 1.76991*gCb;
color2.r = color2.r*(0.5+fBrt);
color2.g = color2.g*(0.5+fBrt);
color2.b = color2.b*(0.5+fBrt);
return color2;
}
#if SHADER_MODEL >= 0x400
Texture2D Texture;
SamplerState Sampler;
cbuffer cb0
{
float4 BGColor;
};
struct PS_INPUT
{
float4 p : SV_Position;
float2 t : TEXCOORD0;
};
float4 ps_main(PS_INPUT input) : SV_Target0
{
float4 c = Texture.Sample(Sampler, input.t);
return ConvertYUV(c);
}
#elif SHADER_MODEL <= 0x300
sampler Texture : register(s0);
float4 g_params[1];
#define BGColor (g_params[0])
struct PS_INPUT
{
float2 t : TEXCOORD0;
};
float4 ps_main(PS_INPUT input) : COLOR
{
float4 c = tex2D(Texture, input.t);
return ConvertYUV(c);
}
#endif
#endif

View File

@ -76,6 +76,15 @@
#define IDC_STATIC10 2049
#define IDC_HACKDISABLED 2050
#define IDC_SPRITEHACK 2051
#define IDRESET 2052
#define IDC_SATURATION_SLIDER 2053
#define IDC_BRIGHTNESS_SLIDER 2055
#define IDC_CONTRAST_SLIDER 2056
#define IDC_SHADEBUTTON 2058
#define IDC_SHADEBOOST 2059
#define IDC_SATURATION_TEXT 2061
#define IDC_BRIGHTNESS_TEXT 2062
#define IDC_CONTRAST_TEXT 2063
#define IDC_COLORSPACE 3000
#define IDR_CONVERT_FX 10000
#define IDR_TFX_FX 10001
@ -83,15 +92,17 @@
#define IDR_INTERLACE_FX 10003
#define IDD_CONFIG2 10004
#define IDR_FXAA_FX 10005
#define IDR_CS_FX 10006
#define IDR_CS_FX 10006
#define IDD_SHADEBOOST 10007
#define IDR_SHADEBOOST_FX 10009
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 10007
#define _APS_NEXT_RESOURCE_VALUE 10011
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 2052
#define _APS_NEXT_CONTROL_VALUE 2064
#define _APS_NEXT_SYMED_VALUE 5000
#endif
#endif