From 1c8de02c8d3d733e4c31109d3e3497c4177c1323 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Fri, 10 Jun 2016 20:44:35 +0200 Subject: [PATCH] gsdx ogl: trace shader permutation Too much permutation is bad for driver performances --- plugins/GSdx/GSDeviceOGL.cpp | 56 ++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index c85d71f7a2..87970cef12 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -1556,9 +1556,6 @@ void GSDeviceOGL::SetupCBMisc(const GSVector4i& channel) void GSDeviceOGL::SetupPipeline(const VSSelector& vsel, const GSSelector& gsel, const PSSelector& psel) { - // ************************************************************* - // Static - // ************************************************************* GLuint ps; auto i = m_ps.find(psel); @@ -1569,9 +1566,56 @@ void GSDeviceOGL::SetupPipeline(const VSSelector& vsel, const GSSelector& gsel, ps = i->second; } - // ************************************************************* - // Dynamic - // ************************************************************* + { +#if defined(_DEBUG) && 0 + // Toggling Shader is bad for the perf. Let's trace parameter that often toggle to detect + // potential uber shader possibilities. + static PSSelector old_psel; + static GLuint old_ps = 0; + std::string msg(""); +#define CHECK_STATE(p) if (psel.p != old_psel.p) msg.append(" ").append(#p); + + if (old_ps != ps) { + + CHECK_STATE(tex_fmt); + CHECK_STATE(dfmt); + CHECK_STATE(depth_fmt); + CHECK_STATE(aem); + CHECK_STATE(fba); + CHECK_STATE(fog); + CHECK_STATE(iip); + CHECK_STATE(date); + CHECK_STATE(atst); + CHECK_STATE(fst); + CHECK_STATE(tfx); + CHECK_STATE(tcc); + CHECK_STATE(wms); + CHECK_STATE(wmt); + CHECK_STATE(ltf); + CHECK_STATE(shuffle); + CHECK_STATE(read_ba); + CHECK_STATE(write_rg); + CHECK_STATE(fbmask); + CHECK_STATE(blend_a); + CHECK_STATE(blend_b); + CHECK_STATE(blend_c); + CHECK_STATE(blend_d); + CHECK_STATE(clr1); + CHECK_STATE(pabe); + CHECK_STATE(hdr); + CHECK_STATE(colclip); + // CHECK_STATE(channel); + // CHECK_STATE(tcoffsethack); + // CHECK_STATE(urban_chaos_hle); + // CHECK_STATE(tales_of_abyss_hle); + GL_PERF("New PS :%s", msg.c_str()); + } + + old_psel.key = psel.key; + old_ps = ps; +#endif + } + if (GLLoader::buggy_sso_dual_src) m_shader->BindProgram(m_vs[vsel], m_gs[gsel], ps); else