mirror of https://github.com/PCSX2/pcsx2.git
GSRendererNew: Remove another constant buffer copy
This commit is contained in:
parent
212848e931
commit
e006442e4f
|
@ -135,7 +135,7 @@ struct HWBlend
|
||||||
u16 flags, op, src, dst;
|
u16 flags, op, src, dst;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GSHWDrawConfig
|
struct alignas(16) GSHWDrawConfig
|
||||||
{
|
{
|
||||||
enum class Topology: u8
|
enum class Topology: u8
|
||||||
{
|
{
|
||||||
|
@ -476,9 +476,6 @@ struct GSHWDrawConfig
|
||||||
DestinationAlphaMode destination_alpha;
|
DestinationAlphaMode destination_alpha;
|
||||||
bool datm;
|
bool datm;
|
||||||
|
|
||||||
VSConstantBuffer cb_vs;
|
|
||||||
PSConstantBuffer cb_ps;
|
|
||||||
|
|
||||||
struct AlphaSecondPass
|
struct AlphaSecondPass
|
||||||
{
|
{
|
||||||
bool enable;
|
bool enable;
|
||||||
|
@ -487,6 +484,9 @@ struct GSHWDrawConfig
|
||||||
PSSelector ps;
|
PSSelector ps;
|
||||||
float ps_aref;
|
float ps_aref;
|
||||||
} alpha_second_pass;
|
} alpha_second_pass;
|
||||||
|
|
||||||
|
VSConstantBuffer cb_vs;
|
||||||
|
PSConstantBuffer cb_ps;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GSDevice : public GSAlignedClass<32>
|
class GSDevice : public GSAlignedClass<32>
|
||||||
|
|
|
@ -1113,27 +1113,27 @@ void GSRendererNew::EmulateATST(float& AREF, GSHWDrawConfig::PSSelector& ps, boo
|
||||||
switch (atst)
|
switch (atst)
|
||||||
{
|
{
|
||||||
case ATST_LESS:
|
case ATST_LESS:
|
||||||
AREF = (float)m_context->TEST.AREF - 0.1f;
|
AREF = static_cast<float>(m_context->TEST.AREF) - 0.1f;
|
||||||
ps.atst = 1;
|
ps.atst = 1;
|
||||||
break;
|
break;
|
||||||
case ATST_LEQUAL:
|
case ATST_LEQUAL:
|
||||||
AREF = (float)m_context->TEST.AREF - 0.1f + 1.0f;
|
AREF = static_cast<float>(m_context->TEST.AREF) - 0.1f + 1.0f;
|
||||||
ps.atst = 1;
|
ps.atst = 1;
|
||||||
break;
|
break;
|
||||||
case ATST_GEQUAL:
|
case ATST_GEQUAL:
|
||||||
AREF = (float)m_context->TEST.AREF - 0.1f;
|
AREF = static_cast<float>(m_context->TEST.AREF) - 0.1f;
|
||||||
ps.atst = 2;
|
ps.atst = 2;
|
||||||
break;
|
break;
|
||||||
case ATST_GREATER:
|
case ATST_GREATER:
|
||||||
AREF = (float)m_context->TEST.AREF - 0.1f + 1.0f;
|
AREF = static_cast<float>(m_context->TEST.AREF) - 0.1f + 1.0f;
|
||||||
ps.atst = 2;
|
ps.atst = 2;
|
||||||
break;
|
break;
|
||||||
case ATST_EQUAL:
|
case ATST_EQUAL:
|
||||||
AREF = (float)m_context->TEST.AREF;
|
AREF = static_cast<float>(m_context->TEST.AREF);
|
||||||
ps.atst = 3;
|
ps.atst = 3;
|
||||||
break;
|
break;
|
||||||
case ATST_NOTEQUAL:
|
case ATST_NOTEQUAL:
|
||||||
AREF = (float)m_context->TEST.AREF;
|
AREF = static_cast<float>(m_context->TEST.AREF);
|
||||||
ps.atst = 4;
|
ps.atst = 4;
|
||||||
break;
|
break;
|
||||||
case ATST_NEVER: // Draw won't be done so no need to implement it in shader
|
case ATST_NEVER: // Draw won't be done so no need to implement it in shader
|
||||||
|
@ -1146,11 +1146,9 @@ void GSRendererNew::EmulateATST(float& AREF, GSHWDrawConfig::PSSelector& ps, boo
|
||||||
|
|
||||||
void GSRendererNew::ResetStates()
|
void GSRendererNew::ResetStates()
|
||||||
{
|
{
|
||||||
GSHWDrawConfig::VSConstantBuffer vs_tmp = m_conf.cb_vs;
|
// We don't want to zero out the constant buffers, since fields used by the current draw could result in redundant uploads.
|
||||||
GSHWDrawConfig::PSConstantBuffer ps_tmp = m_conf.cb_ps;
|
// This memset should be pretty efficient - the struct is 16 byte aligned, as is the cb_vs offset.
|
||||||
memset(&m_conf, 0, sizeof(m_conf));
|
memset(&m_conf, 0, reinterpret_cast<const char*>(&m_conf.cb_vs) - reinterpret_cast<const char*>(&m_conf));
|
||||||
m_conf.cb_vs = vs_tmp;
|
|
||||||
m_conf.cb_ps = ps_tmp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSRendererNew::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* tex)
|
void GSRendererNew::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* tex)
|
||||||
|
@ -1592,10 +1590,7 @@ void GSRendererNew::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
|
||||||
m_conf.require_one_barrier = true;
|
m_conf.require_one_barrier = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_conf.require_full_barrier && m_vt.m_primclass == GS_SPRITE_CLASS)
|
m_conf.drawlist = (m_conf.require_full_barrier && m_vt.m_primclass == GS_SPRITE_CLASS) ? &m_drawlist : nullptr;
|
||||||
{
|
|
||||||
m_conf.drawlist = &m_drawlist;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_conf.rt = rt;
|
m_conf.rt = rt;
|
||||||
m_conf.ds = ds;
|
m_conf.ds = ds;
|
||||||
|
|
Loading…
Reference in New Issue