mirror of https://github.com/PCSX2/pcsx2.git
gsdx ogl: Enable by default advance DATE effect on nvidia (GL4 GPU)
Note: DATE is used for shadows (persona 3) and others effect You can disable it when you disable gl image extension (override_GL_ARB_shader_image_load_store = 0) You can also enable it on AMD too (set it to 1 this time) but no guarantee. If you feel the extension is too slow, you can try disable some gl barrier (aka "damn the torpedo full steam ahead!"). It can be done with the option UserHacks_DateGL4 = 1. Otherwise just disable the extension. Note: don't enable UserHacks_AlphaStencil in the same time. GL_ARB_shader_image_load_store is an alternative implementation. Enabling both in the same time will lead to undefined (well surely wrong) behavior. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5890 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
907964a7d1
commit
3d7b86660a
|
@ -241,8 +241,13 @@ namespace GLLoader {
|
|||
if (ext.compare("GL_ARB_texture_storage") == 0) found_GL_ARB_texture_storage = true;
|
||||
if (ext.compare("GL_ARB_copy_image") == 0) found_GL_ARB_copy_image = true;
|
||||
if (ext.compare("GL_ARB_gpu_shader5") == 0) found_GL_ARB_gpu_shader5 = true;
|
||||
if (ext.compare("GL_ARB_shader_image_load_store") == 0) found_GL_ARB_shader_image_load_store = true;
|
||||
if (ext.compare("GL_NV_depth_buffer_float") == 0) found_GL_NV_depth_buffer_float = true;
|
||||
if (ext.compare("GL_ARB_explicit_uniform_location") == 0) found_GL_ARB_explicit_uniform_location = true;
|
||||
if (ext.compare("GL_ARB_multi_bind") == 0) found_GL_ARB_multi_bind = true;
|
||||
|
||||
// Only enable this extension on nvidia
|
||||
if (nvidia_buggy_driver && ext.compare("GL_ARB_shader_image_load_store") == 0) found_GL_ARB_shader_image_load_store = true;
|
||||
|
||||
#if 0
|
||||
// Erratum: on nvidia implementation, gain is very nice : 42.5 fps => 46.5 fps
|
||||
//
|
||||
|
@ -256,14 +261,11 @@ namespace GLLoader {
|
|||
|
||||
if (ext.compare("GL_ARB_shader_subroutine") == 0) found_GL_ARB_shader_subroutine = true;
|
||||
#endif
|
||||
if (ext.compare("GL_ARB_explicit_uniform_location") == 0) found_GL_ARB_explicit_uniform_location = true;
|
||||
#ifdef GL44 // Need to debug the code first
|
||||
// Need to check the clean (in particular of depth/stencil texture)
|
||||
if (ext.compare("GL_ARB_clear_texture") == 0) found_GL_ARB_clear_texture = true;
|
||||
// FIXME unattach context case + perf
|
||||
if (ext.compare("GL_ARB_buffer_storage") == 0) found_GL_ARB_buffer_storage = true;
|
||||
// OK but no apitrace support
|
||||
if (ext.compare("GL_ARB_multi_bind") == 0) found_GL_ARB_multi_bind = true;
|
||||
#endif
|
||||
#ifdef GLBINDLESS // Need to debug the code first
|
||||
if (ext.compare("GL_ARB_bindless_texture") == 0) found_GL_ARB_bindless_texture = true;
|
||||
|
|
|
@ -189,55 +189,8 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
|
|||
|
||||
GSDeviceOGL* dev = (GSDeviceOGL*)m_dev;
|
||||
|
||||
if(DATE)
|
||||
{
|
||||
// Note at the moment OGL has always stencil. Rt can be disabled
|
||||
if(dev->HasStencil())
|
||||
{
|
||||
GSVector4 s = GSVector4(rtscale.x / rtsize.x, rtscale.y / rtsize.y);
|
||||
GSVector4 o = GSVector4(-1.0f, 1.0f);
|
||||
|
||||
GSVector4 src = ((m_vt.m_min.p.xyxy(m_vt.m_max.p) + o.xxyy()) * s.xyxy()).sat(o.zzyy());
|
||||
GSVector4 dst = src * 2.0f + o.xxxx();
|
||||
|
||||
GSVertexPT1 vertices[] =
|
||||
{
|
||||
{GSVector4(dst.x, dst.y, 0.5f, 1.0f), GSVector2(src.x, src.y)},
|
||||
{GSVector4(dst.z, dst.y, 0.5f, 1.0f), GSVector2(src.z, src.y)},
|
||||
{GSVector4(dst.x, dst.w, 0.5f, 1.0f), GSVector2(src.x, src.w)},
|
||||
{GSVector4(dst.z, dst.w, 0.5f, 1.0f), GSVector2(src.z, src.w)},
|
||||
};
|
||||
|
||||
dev->SetupDATE(rt, ds, vertices, m_context->TEST.DATM);
|
||||
}
|
||||
|
||||
// Create an r32ui image that will containt primitive ID
|
||||
if (UserHacks_DateGL4 && GLLoader::found_GL_ARB_shader_image_load_store)
|
||||
dev->InitPrimDateTexture(rtsize.x, rtsize.y);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
dev->BeginScene();
|
||||
|
||||
// om
|
||||
|
||||
GSDeviceOGL::OMDepthStencilSelector om_dssel;
|
||||
|
||||
if(context->TEST.ZTE)
|
||||
{
|
||||
om_dssel.ztst = context->TEST.ZTST;
|
||||
om_dssel.zwe = !context->ZBUF.ZMSK;
|
||||
}
|
||||
else
|
||||
{
|
||||
om_dssel.ztst = ZTST_ALWAYS;
|
||||
}
|
||||
|
||||
if(m_fba)
|
||||
{
|
||||
om_dssel.fba = context->FBA.FBA;
|
||||
}
|
||||
// Blend
|
||||
|
||||
GSDeviceOGL::OMBlendSelector om_bsel;
|
||||
|
||||
|
@ -269,14 +222,63 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
|
|||
|
||||
om_bsel.wrgba = ~GSVector4i::load((int)context->FRAME.FBMSK).eq8(GSVector4i::xffffffff()).mask();
|
||||
|
||||
// TODO
|
||||
if (UserHacks_DateGL4 && DATE && om_bsel.wa && (!context->TEST.ATE || context->TEST.ATST == ATST_ALWAYS)) {
|
||||
//if (!(context->FBA.FBA && context->TEST.DATM == 1))
|
||||
|
||||
//advance_DATE = true;
|
||||
if (DATE && om_bsel.wa && (!context->TEST.ATE || context->TEST.ATST == ATST_ALWAYS)) {
|
||||
advance_DATE = GLLoader::found_GL_ARB_shader_image_load_store;
|
||||
}
|
||||
|
||||
// DATE
|
||||
|
||||
if(DATE)
|
||||
{
|
||||
// Note at the moment OGL has always stencil. Rt can be disabled
|
||||
if(dev->HasStencil())
|
||||
{
|
||||
GSVector4 s = GSVector4(rtscale.x / rtsize.x, rtscale.y / rtsize.y);
|
||||
GSVector4 o = GSVector4(-1.0f, 1.0f);
|
||||
|
||||
GSVector4 src = ((m_vt.m_min.p.xyxy(m_vt.m_max.p) + o.xxyy()) * s.xyxy()).sat(o.zzyy());
|
||||
GSVector4 dst = src * 2.0f + o.xxxx();
|
||||
|
||||
GSVertexPT1 vertices[] =
|
||||
{
|
||||
{GSVector4(dst.x, dst.y, 0.5f, 1.0f), GSVector2(src.x, src.y)},
|
||||
{GSVector4(dst.z, dst.y, 0.5f, 1.0f), GSVector2(src.z, src.y)},
|
||||
{GSVector4(dst.x, dst.w, 0.5f, 1.0f), GSVector2(src.x, src.w)},
|
||||
{GSVector4(dst.z, dst.w, 0.5f, 1.0f), GSVector2(src.z, src.w)},
|
||||
};
|
||||
|
||||
dev->SetupDATE(rt, ds, vertices, m_context->TEST.DATM);
|
||||
}
|
||||
|
||||
// Must be done here to avoid any GL state pertubation (clear function...)
|
||||
// Create an r32ui image that will containt primitive ID
|
||||
if (advance_DATE)
|
||||
dev->InitPrimDateTexture(rtsize.x, rtsize.y);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
dev->BeginScene();
|
||||
|
||||
// om
|
||||
|
||||
GSDeviceOGL::OMDepthStencilSelector om_dssel;
|
||||
|
||||
if(context->TEST.ZTE)
|
||||
{
|
||||
om_dssel.ztst = context->TEST.ZTST;
|
||||
om_dssel.zwe = !context->ZBUF.ZMSK;
|
||||
}
|
||||
else
|
||||
{
|
||||
om_dssel.ztst = ZTST_ALWAYS;
|
||||
}
|
||||
|
||||
if(m_fba)
|
||||
{
|
||||
om_dssel.fba = context->FBA.FBA;
|
||||
}
|
||||
|
||||
// vs
|
||||
|
||||
GSDeviceOGL::VSSelector vs_sel;
|
||||
|
@ -520,7 +522,8 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
|
|||
dev->SetupPS(ps_sel);
|
||||
|
||||
// Be sure that first pass is finished !
|
||||
dev->Barrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
|
||||
if (!UserHacks_DateGL4)
|
||||
dev->Barrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
|
||||
}
|
||||
|
||||
if(context->TEST.DoFirstPass())
|
||||
|
|
Loading…
Reference in New Issue