gsdx ogl:

* restore the old fxaa (Asmodeam will be integrated when I got time)
* port the recently added new scanline algo


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5818 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut 2014-01-18 14:46:13 +00:00
parent f8264bce2c
commit c2aa4ff3fd
6 changed files with 1312 additions and 38 deletions

View File

@ -20,13 +20,11 @@ eval {
print "Disable MD5\n";
};
my @gsdx_res = qw/convert.glsl interlace.glsl merge.glsl shadeboost.glsl tfx.glsl fxaa.fx/;
# Keep the old FXAA for now
my @gsdx_res = qw/convert.glsl interlace.glsl merge.glsl shadeboost.glsl tfx.glsl old_fxaa.fx/;
my $gsdx_path = File::Spec->catdir(dirname(abs_path($0)), "..", "plugins", "GSdx", "res");
my $gsdx_out = File::Spec->catdir($gsdx_path, "glsl_source.h");
# Keep the old FXAA for now
print "Warning: the rebuilding of GSdx ogl shader was temporary disabled\n";
print "It will be reenabled when we got time to test Asmodean new fxaa shader\n";
#glsl2h($gsdx_path, $gsdx_out, \@gsdx_res);
glsl2h($gsdx_path, $gsdx_out, \@gsdx_res);
my @zz_res = qw/ps2hw_gl4.glsl/;
my $zz_path = File::Spec->catdir(dirname(abs_path($0)), "..", "plugins", "zzogl-pg", "opengl");

View File

@ -286,7 +286,7 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
fxaa_macro += "#define FXAA_GATHER4_ALPHA 1\n";
}
m_fxaa.cb = new GSUniformBufferOGL(g_fxaa_cb_index, sizeof(FXAAConstantBuffer));
m_fxaa.ps = m_shader->Compile("fxaa.fx", "ps_main", GL_FRAGMENT_SHADER, fxaa_fx, fxaa_macro);
m_fxaa.ps = m_shader->Compile("fxaa.fx", "ps_main", GL_FRAGMENT_SHADER, old_fxaa_fx, fxaa_macro);
// ****************************************************************
// DATE

View File

@ -476,7 +476,7 @@ class GSDeviceOGL : public GSDevice
struct {
GLuint vs; // program object
GLuint ps[9]; // program object
GLuint ps[10]; // program object
GLuint ln; // sampler object
GLuint pt; // sampler object
GSDepthStencilOGL* dss;

View File

@ -111,15 +111,6 @@ vec4 sample_c()
return texture(TextureSampler, PSin_t );
}
//uniform vec4 mask[4] = vec4[4]
//(
// vec4(1, 0, 0, 0),
// vec4(0, 1, 0, 0),
// vec4(0, 0, 1, 0),
// vec4(1, 1, 1, 0)
//);
vec4 ps_crt(uint i)
{
vec4 mask[4] = vec4[4]
@ -132,12 +123,12 @@ vec4 ps_crt(uint i)
return sample_c() * clamp((mask[i] + 0.5f), 0.0f, 1.0f);
}
vec4 ps_scanlines(int i)
vec4 ps_scanlines(uint i)
{
float4 mask[2] =
vec4 mask[2] =
{
float4(1, 1, 1, 0),
float4(0, 0, 0, 0)
vec4(1, 1, 1, 0),
vec4(0, 0, 0, 0)
};
return sample_c() * clamp((mask[i] + 0.5f), 0.0f, 1.0f);
@ -188,7 +179,7 @@ void ps_main5() // scanlines
#ifdef ps_main6
void ps_main6() // diagonal
{
uvec4 p = uvec4(PSin_p);
highp uvec4 p = uvec4(PSin_p);
vec4 c = ps_crt((p.x + (p.y % 3u)) % 3u);
@ -199,7 +190,7 @@ void ps_main6() // diagonal
#ifdef ps_main8
void ps_main8() // triangular
{
uvec4 p = uvec4(PSin_p);
highp uvec4 p = uvec4(PSin_p);
vec4 c = ps_crt(((p.x + ((p.y >> 1u) & 1u) * 3u) >> 1u) % 3u);
@ -207,6 +198,26 @@ void ps_main8() // triangular
}
#endif
#ifdef ps_main9
void ps_main9()
{
const float PI = 3.14159265359f;
vec2 texdim = vec2(textureSize(TextureSampler, 0));
vec4 c;
if (dFdy(PSin_t.y) * PSin_t.y > 0.5f) {
c = sample_c();
} else {
float factor = (0.9f - 0.4f * cos(2.0f * PI * PSin_t.y * texdim.y));
c = factor * texture(TextureSampler, vec2(PSin_t.x, (floor(PSin_t.y * texdim.y) + 0.5f) / texdim.y));
}
SV_Target0 = c;
}
#endif
// Used for DATE (stencil)
// DATM == 1
#ifdef ps_main2

View File

@ -136,15 +136,6 @@ static const char* convert_glsl =
" return texture(TextureSampler, PSin_t );\n"
"}\n"
"\n"
"//uniform vec4 mask[4] = vec4[4]\n"
"//(\n"
"// vec4(1, 0, 0, 0),\n"
"// vec4(0, 1, 0, 0),\n"
"// vec4(0, 0, 1, 0),\n"
"// vec4(1, 1, 1, 0)\n"
"//);\n"
"\n"
"\n"
"vec4 ps_crt(uint i)\n"
"{\n"
" vec4 mask[4] = vec4[4]\n"
@ -157,12 +148,12 @@ static const char* convert_glsl =
" return sample_c() * clamp((mask[i] + 0.5f), 0.0f, 1.0f);\n"
"}\n"
"\n"
"vec4 ps_scanlines(int i)\n"
"vec4 ps_scanlines(uint i)\n"
"{\n"
" float4 mask[2] =\n"
" vec4 mask[2] =\n"
" {\n"
" float4(1, 1, 1, 0),\n"
" float4(0, 0, 0, 0)\n"
" vec4(1, 1, 1, 0),\n"
" vec4(0, 0, 0, 0)\n"
" };\n"
"\n"
" return sample_c() * clamp((mask[i] + 0.5f), 0.0f, 1.0f);\n"
@ -213,7 +204,7 @@ static const char* convert_glsl =
"#ifdef ps_main6\n"
"void ps_main6() // diagonal\n"
"{\n"
" uvec4 p = uvec4(PSin_p);\n"
" highp uvec4 p = uvec4(PSin_p);\n"
"\n"
" vec4 c = ps_crt((p.x + (p.y % 3u)) % 3u);\n"
"\n"
@ -224,7 +215,7 @@ static const char* convert_glsl =
"#ifdef ps_main8\n"
"void ps_main8() // triangular\n"
"{\n"
" uvec4 p = uvec4(PSin_p);\n"
" highp uvec4 p = uvec4(PSin_p);\n"
"\n"
" vec4 c = ps_crt(((p.x + ((p.y >> 1u) & 1u) * 3u) >> 1u) % 3u);\n"
"\n"
@ -232,6 +223,26 @@ static const char* convert_glsl =
"}\n"
"#endif\n"
"\n"
"#ifdef ps_main9\n"
"void ps_main9()\n"
"{\n"
"\n"
" const float PI = 3.14159265359f;\n"
"\n"
" vec2 texdim = vec2(textureSize(TextureSampler, 0)); \n"
"\n"
" vec4 c;\n"
" if (dFdy(PSin_t.y) * PSin_t.y > 0.5f) {\n"
" c = sample_c(); \n"
" } else {\n"
" float factor = (0.9f - 0.4f * cos(2.0f * PI * PSin_t.y * texdim.y));\n"
" c = factor * texture(TextureSampler, vec2(PSin_t.x, (floor(PSin_t.y * texdim.y) + 0.5f) / texdim.y));\n"
" }\n"
"\n"
" SV_Target0 = c;\n"
"}\n"
"#endif\n"
"\n"
"// Used for DATE (stencil)\n"
"// DATM == 1\n"
"#ifdef ps_main2\n"
@ -1653,7 +1664,7 @@ static const char* tfx_glsl =
"#endif\n"
;
static const char* fxaa_fx =
static const char* old_fxaa_fx =
"#if defined(SHADER_MODEL) || defined(FXAA_GLSL_130) // make safe to include in resource file to enforce dependency\n"
"\n"
"#ifndef FXAA_GLSL_130\n"

1254
plugins/GSdx/res/old_fxaa.fx Normal file

File diff suppressed because it is too large Load Diff