From 5fbf702500c31598cfc8f6e7af47edcc365881aa Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Mon, 15 Aug 2016 11:35:24 +0200 Subject: [PATCH] gsdx ogl: new optimization to bypass the alpha test In FB_ONLY mode the alpha test impacts (discard) only the depth value. If there is no depth buffer, we don't care about depth write. So alpha test is useless and we can do the draw with a single draw call and no program switch --- plugins/GSdx/GSRendererOGL.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/GSdx/GSRendererOGL.cpp b/plugins/GSdx/GSRendererOGL.cpp index 6969ddd21d..827069d39d 100644 --- a/plugins/GSdx/GSRendererOGL.cpp +++ b/plugins/GSdx/GSRendererOGL.cpp @@ -1295,8 +1295,13 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour // pass to handle the depth based on the alpha test. bool complex_ate = ate_first_pass & ate_second_pass; bool ate_all_color_then_depth = complex_ate & (m_context->TEST.AFAIL == AFAIL_FB_ONLY) & (m_om_dssel.ztst == ZTST_ALWAYS); + // In FB_ONLY mode, only the z buffer is impacted by the alpha test. No depth => useless alpha test + bool ate_skip = complex_ate & (m_context->TEST.AFAIL == AFAIL_FB_ONLY) & (ds == nullptr); - if (ate_all_color_then_depth) { + if (ate_skip) { + GL_INS("Alternate ATE handling: ate_skip"); + ate_second_pass = false; + } else if (ate_all_color_then_depth) { GL_INS("Alternate ATE handling: ate_all_color_then_depth"); // Render all color but don't update depth // ATE is disabled here