From 4d1241070768879602f5a690508eda3a1d424869 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Fri, 7 Aug 2015 09:44:42 +0200 Subject: [PATCH] gsdx-ogl: latch constant buffer in rendering object * Initialization of the object is done once * Avoid to reupload it when an useless parameter toggle => -10% of UBO update --- plugins/GSdx/GSRendererOGL.cpp | 14 ++++---------- plugins/GSdx/GSRendererOGL.h | 8 +++++--- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/plugins/GSdx/GSRendererOGL.cpp b/plugins/GSdx/GSRendererOGL.cpp index e7a285a0bd..18b5567ac5 100644 --- a/plugins/GSdx/GSRendererOGL.cpp +++ b/plugins/GSdx/GSRendererOGL.cpp @@ -152,7 +152,7 @@ void GSRendererOGL::SetupIA() dev->IASetPrimitiveTopology(t); } -bool GSRendererOGL::EmulateTextureShuffleAndFbmask(GSDeviceOGL::PSSelector& ps_sel, GSDeviceOGL::OMColorMaskSelector& om_csel, GSDeviceOGL::PSConstantBuffer& ps_cb) +bool GSRendererOGL::EmulateTextureShuffleAndFbmask(GSDeviceOGL::PSSelector& ps_sel, GSDeviceOGL::OMColorMaskSelector& om_csel) { bool require_barrier = false; @@ -301,7 +301,7 @@ bool GSRendererOGL::EmulateTextureShuffleAndFbmask(GSDeviceOGL::PSSelector& ps_s return require_barrier; } -bool GSRendererOGL::EmulateBlending(GSDeviceOGL::PSSelector& ps_sel, GSDeviceOGL::PSConstantBuffer& ps_cb, bool DATE_GL42) +bool GSRendererOGL::EmulateBlending(GSDeviceOGL::PSSelector& ps_sel, bool DATE_GL42) { const GIFRegALPHA& ALPHA = m_context->ALPHA; bool require_barrier = false; @@ -577,16 +577,10 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour GSDeviceOGL* dev = (GSDeviceOGL*)m_dev; dev->s_n = s_n; - // FIXME: optimization, latch ps_cb & vs_cb in the object - // 1/ Avoid a reset every draw - // 2/ potentially less update GSDeviceOGL::VSSelector vs_sel; - GSDeviceOGL::VSConstantBuffer vs_cb; - GSDeviceOGL::GSSelector gs_sel; GSDeviceOGL::PSSelector ps_sel; - GSDeviceOGL::PSConstantBuffer ps_cb; GSDeviceOGL::PSSamplerSelector ps_ssel; GSDeviceOGL::OMColorMaskSelector om_csel; @@ -604,7 +598,7 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour m_prim_overlap = PRIM_OVERLAP_UNKNOW; } - require_barrier |= EmulateTextureShuffleAndFbmask(ps_sel, om_csel, ps_cb); + require_barrier |= EmulateTextureShuffleAndFbmask(ps_sel, om_csel); // DATE: selection of the algorithm. Must be done before blending because GL42 is not compatible with blending @@ -632,7 +626,7 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour // Blend if (!IsOpaque() && rt) { - require_barrier |= EmulateBlending(ps_sel, ps_cb, DATE_GL42); + require_barrier |= EmulateBlending(ps_sel, DATE_GL42); } else { dev->OMSetBlendState(); // No blending please } diff --git a/plugins/GSdx/GSRendererOGL.h b/plugins/GSdx/GSRendererOGL.h index 941a1a968a..8024b210da 100644 --- a/plugins/GSdx/GSRendererOGL.h +++ b/plugins/GSdx/GSRendererOGL.h @@ -48,19 +48,21 @@ class GSRendererOGL : public GSRendererHW GSVector2 m_pixelcenter; bool m_accurate_date; int m_sw_blending; + PRIM_OVERLAP m_prim_overlap; unsigned int UserHacks_TCOffset; float UserHacks_TCO_x, UserHacks_TCO_y; - PRIM_OVERLAP m_prim_overlap; + GSDeviceOGL::VSConstantBuffer vs_cb; + GSDeviceOGL::PSConstantBuffer ps_cb; GSVector4i ComputeBoundingBox(const GSVector2& rtscale, const GSVector2i& rtsize); protected: void EmulateGS(); void SetupIA(); - bool EmulateTextureShuffleAndFbmask(GSDeviceOGL::PSSelector& ps_sel, GSDeviceOGL::OMColorMaskSelector& om_csel, GSDeviceOGL::PSConstantBuffer& ps_cb); - bool EmulateBlending(GSDeviceOGL::PSSelector& ps_sel, GSDeviceOGL::PSConstantBuffer& ps_cb, bool DATE_GL42); + bool EmulateTextureShuffleAndFbmask(GSDeviceOGL::PSSelector& ps_sel, GSDeviceOGL::OMColorMaskSelector& om_csel); + bool EmulateBlending(GSDeviceOGL::PSSelector& ps_sel, bool DATE_GL42); public: GSRendererOGL();