From 1155dd6e21ab74ac4bc654bc3587a88dd2fb6842 Mon Sep 17 00:00:00 2001 From: "ramapcsx2.code" Date: Sun, 12 Jan 2014 19:47:49 +0000 Subject: [PATCH] GSdx: Add another scanline algorithm, made by pseudonym. This one is pretty fancy, using a cosinus function for generating the dark lines. It only works on unscaled output, so use software rendering or native resolution for hardware. It's an effect that works best on 240p converted games (like the SNES titles in Mega Man Collection). git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5812 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/GSdx/GSDevice.cpp | 2 +- plugins/GSdx/GSDevice11.h | 2 +- plugins/GSdx/GSDevice9.h | 2 +- plugins/GSdx/GSRenderer.cpp | 2 +- plugins/GSdx/res/convert.fx | 30 ++++++++++++++++++++++++++++++ 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/plugins/GSdx/GSDevice.cpp b/plugins/GSdx/GSDevice.cpp index ce11e433df..174bea9799 100644 --- a/plugins/GSdx/GSDevice.cpp +++ b/plugins/GSdx/GSDevice.cpp @@ -106,7 +106,7 @@ void GSDevice::Present(const GSVector4i& r, int shader) if(m_current) { - static int s_shader[4] = {0, 5, 6, 8}; // FIXME + static int s_shader[5] = {0, 5, 6, 8, 9}; // FIXME Present(m_current, m_backbuffer, GSVector4(r), s_shader[shader]); } diff --git a/plugins/GSdx/GSDevice11.h b/plugins/GSdx/GSDevice11.h index 8f5e7d3fe7..1e4e4240a4 100644 --- a/plugins/GSdx/GSDevice11.h +++ b/plugins/GSdx/GSDevice11.h @@ -90,7 +90,7 @@ public: // TODO { CComPtr il; CComPtr vs; - CComPtr ps[9]; + CComPtr ps[10]; CComPtr ln; CComPtr pt; CComPtr dss; diff --git a/plugins/GSdx/GSDevice9.h b/plugins/GSdx/GSDevice9.h index 7db4f2cc98..31a18d8401 100644 --- a/plugins/GSdx/GSDevice9.h +++ b/plugins/GSdx/GSDevice9.h @@ -119,7 +119,7 @@ public: // TODO { CComPtr il; CComPtr vs; - CComPtr ps[9]; + CComPtr ps[10]; Direct3DSamplerState9 ln; Direct3DSamplerState9 pt; Direct3DDepthStencilState9 dss; diff --git a/plugins/GSdx/GSRenderer.cpp b/plugins/GSdx/GSRenderer.cpp index 356cfeb747..a9f7afee56 100644 --- a/plugins/GSdx/GSRenderer.cpp +++ b/plugins/GSdx/GSRenderer.cpp @@ -534,7 +534,7 @@ void GSRenderer::EndCapture() void GSRenderer::KeyEvent(GSKeyEventData* e) { const unsigned int interlace_nb = 8; - const unsigned int post_shader_nb = 4; + const unsigned int post_shader_nb = 5; const unsigned int aspect_ratio_nb = 3; #ifdef _WINDOWS if(e->type == KEYPRESS) diff --git a/plugins/GSdx/res/convert.fx b/plugins/GSdx/res/convert.fx index 042214702e..7ce10cd6d8 100644 --- a/plugins/GSdx/res/convert.fx +++ b/plugins/GSdx/res/convert.fx @@ -204,6 +204,21 @@ PS_OUTPUT ps_main8(PS_INPUT input) // triangular return output; } +static const float PI = 3.14159265359f; +PS_OUTPUT ps_main9(PS_INPUT input) // triangular +{ + PS_OUTPUT output; + + float2 texdim, halfpixel; + Texture.GetDimensions(texdim.x, texdim.y); + if (ddy(input.t.y) * texdim.y > 0.5) + output.c = sample_c(input.t); + else + output.c = (0.5 - 0.5 * cos(2 * PI * input.t.y * texdim.y)) * sample_c(float2(input.t.x, (floor(input.t.y * texdim.y) + 0.5) / texdim.y)); + + return output; +} + #elif SHADER_MODEL <= 0x300 PS_OUTPUT ps_main1(PS_INPUT input) @@ -284,5 +299,20 @@ PS_OUTPUT ps_main8(PS_INPUT input) // triangular return output; } +static const float PI = 3.14159265359f; +PS_OUTPUT ps_main9(PS_INPUT input) // triangular +{ + PS_OUTPUT output; + + float2 texdim, halfpixel; + Texture.GetDimensions(texdim.x, texdim.y); + if (ddy(input.t.y) * texdim.y > 0.5) + output.c = sample_c(input.t); + else + output.c = (0.5 - 0.5 * cos(2 * PI * input.t.y * texdim.y)) * sample_c(float2(input.t.x, (floor(input.t.y * texdim.y) + 0.5) / texdim.y)); + + return output; +} + #endif #endif