gsdx ogl: do the same as previous commit but for ogl ;)

* fix the missing auto interlace opt when cycling with hotkey on linux


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5810 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut 2014-01-12 11:38:50 +00:00
parent 2ac3c47c42
commit 2238095a82
5 changed files with 62 additions and 15 deletions

View File

@ -69,19 +69,19 @@ GSDeviceOGL::~GSDeviceOGL()
delete (m_vb_sr);
// Clean m_merge_obj
for (uint32 i = 0; i < 2; i++)
for (size_t i = 0; i < countof(m_merge_obj.ps); i++)
m_shader->Delete(m_merge_obj.ps[i]);
delete (m_merge_obj.cb);
delete (m_merge_obj.bs);
// Clean m_interlace
for (uint32 i = 0; i < 2; i++)
for (size_t i = 0; i < countof(m_interlace.ps); i++)
m_shader->Delete(m_interlace.ps[i]);
delete (m_interlace.cb);
// Clean m_convert
m_shader->Delete(m_convert.vs);
for (uint32 i = 0; i < 2; i++)
for (size_t i = 0; i < countof(m_convert.ps); i++)
m_shader->Delete(m_convert.ps[i]);
delete m_convert.dss;
delete m_convert.bs;

View File

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

View File

@ -533,6 +533,9 @@ void GSRenderer::EndCapture()
void GSRenderer::KeyEvent(GSKeyEventData* e)
{
const unsigned int interlace_nb = 8;
const unsigned int post_shader_nb = 4;
const unsigned int aspect_ratio_nb = 3;
#ifdef _WINDOWS
if(e->type == KEYPRESS)
{
@ -542,15 +545,15 @@ void GSRenderer::KeyEvent(GSKeyEventData* e)
switch(e->key)
{
case VK_F5:
m_interlace = (m_interlace + 8 + step) % 8;
m_interlace = (m_interlace + interlace_nb + step) % interlace_nb;
printf("GSdx: Set deinterlace mode to %d (%s).\n", (int)m_interlace, theApp.m_gs_interlace.at(m_interlace).name.c_str());
return;
case VK_F6:
if( m_wnd->IsManaged() )
m_aspectratio = (m_aspectratio + 3 + step) % 3;
m_aspectratio = (m_aspectratio + aspect_ratio_nb + step) % aspect_ratio_nb;
return;
case VK_F7:
m_shader = (m_shader + 4 + step) % 4;
m_shader = (m_shader + post_shader_nb + step) % post_shader_nb;
printf("GSdx: Set shader %d.\n", (int)m_shader);
return;
case VK_DELETE:
@ -576,15 +579,15 @@ void GSRenderer::KeyEvent(GSKeyEventData* e)
switch(e->key)
{
case XK_F5:
m_interlace = (m_interlace + 7 + step) % 7;
m_interlace = (m_interlace + interlace_nb + step) % interlace_nb;
fprintf(stderr, "GSdx: Set deinterlace mode to %d (%s).\n", (int)m_interlace, theApp.m_gs_interlace.at(m_interlace).name.c_str());
return;
case XK_F6:
if( m_wnd->IsManaged() )
m_aspectratio = (m_aspectratio + 3 + step) % 3;
m_aspectratio = (m_aspectratio + aspect_ratio_nb + step) % aspect_ratio_nb;
return;
case XK_F7:
m_shader = (m_shader + 3 + step) % 3;
m_shader = (m_shader + post_shader_nb + step) % post_shader_nb;
fprintf(stderr,"GSdx: Set shader %d.\n", (int)m_shader);
return;
case XK_Delete:

View File

@ -132,6 +132,17 @@ vec4 ps_crt(uint i)
return sample_c() * clamp((mask[i] + 0.5f), 0.0f, 1.0f);
}
vec4 ps_scanlines(int i)
{
float4 mask[2] =
{
float4(1, 1, 1, 0),
float4(0, 0, 0, 0)
};
return sample_c() * clamp((mask[i] + 0.5f), 0.0f, 1.0f);
}
#ifdef ps_main0
void ps_main0()
{
@ -164,11 +175,11 @@ void ps_main7()
#endif
#ifdef ps_main5
void ps_main5() // triangular
void ps_main5() // scanlines
{
highp uvec4 p = uvec4(PSin_p);
vec4 c = ps_crt(((p.x + ((p.y >> 1u) & 1u) * 3u) >> 1u) % 3u);
vec4 c = ps_scanlines(p.y % 2u);
SV_Target0 = c;
}
@ -185,6 +196,17 @@ void ps_main6() // diagonal
}
#endif
#ifdef ps_main8
void ps_main8() // triangular
{
uvec4 p = uvec4(PSin_p);
vec4 c = ps_crt(((p.x + ((p.y >> 1u) & 1u) * 3u) >> 1u) % 3u);
SV_Target0 = c;
}
#endif
// Used for DATE (stencil)
// DATM == 1
#ifdef ps_main2

View File

@ -157,6 +157,17 @@ 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"
"{\n"
" float4 mask[2] =\n"
" {\n"
" float4(1, 1, 1, 0),\n"
" float4(0, 0, 0, 0)\n"
" };\n"
"\n"
" return sample_c() * clamp((mask[i] + 0.5f), 0.0f, 1.0f);\n"
"}\n"
"\n"
"#ifdef ps_main0\n"
"void ps_main0()\n"
"{\n"
@ -189,11 +200,11 @@ static const char* convert_glsl =
"#endif\n"
"\n"
"#ifdef ps_main5\n"
"void ps_main5() // triangular\n"
"void ps_main5() // scanlines\n"
"{\n"
" highp uvec4 p = uvec4(PSin_p);\n"
"\n"
" vec4 c = ps_crt(((p.x + ((p.y >> 1u) & 1u) * 3u) >> 1u) % 3u);\n"
" vec4 c = ps_scanlines(p.y % 2u);\n"
"\n"
" SV_Target0 = c;\n"
"}\n"
@ -210,6 +221,17 @@ static const char* convert_glsl =
"}\n"
"#endif\n"
"\n"
"#ifdef ps_main8\n"
"void ps_main8() // triangular\n"
"{\n"
" uvec4 p = uvec4(PSin_p);\n"
"\n"
" vec4 c = ps_crt(((p.x + ((p.y >> 1u) & 1u) * 3u) >> 1u) % 3u);\n"
"\n"
" SV_Target0 = c;\n"
"}\n"
"#endif\n"
"\n"
"// Used for DATE (stencil)\n"
"// DATM == 1\n"
"#ifdef ps_main2\n"
@ -1725,7 +1747,7 @@ static const char* fxaa_fx =
"#endif\n"
"#endif\n"
"\n"
"#if !pGL_ES && __VERSION__ > 140\n"
"#if !GL_ES && __VERSION__ > 140\n"
"\n"
"in SHADER\n"
"{\n"