mirror of https://github.com/PCSX2/pcsx2.git
GS: Only copy draw area for colclip/DATE
This commit is contained in:
parent
efed92b15c
commit
5d15d5958e
|
@ -459,6 +459,7 @@ struct alignas(16) GSHWDrawConfig
|
|||
u32 indices_per_prim; ///< Number of indices that make up one primitive
|
||||
const std::vector<size_t>* drawlist; ///< For reducing barriers on sprites
|
||||
GSVector4i scissor; ///< Scissor rect
|
||||
GSVector4i drawarea; ///< Area in the framebuffer which will be modified.
|
||||
Topology topology; ///< Draw topology
|
||||
|
||||
GSSelector gs;
|
||||
|
|
|
@ -1514,7 +1514,7 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config)
|
|||
|
||||
if (config.destination_alpha != GSHWDrawConfig::DestinationAlphaMode::Off)
|
||||
{
|
||||
const GSVector4 src = GSVector4(config.scissor) / GSVector4(config.ds->GetSize()).xyxy();
|
||||
const GSVector4 src = GSVector4(config.drawarea) / GSVector4(config.ds->GetSize()).xyxy();
|
||||
const GSVector4 dst = src * 2.0f - 1.0f;
|
||||
|
||||
GSVertexPT1 vertices[] =
|
||||
|
@ -1532,10 +1532,10 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config)
|
|||
if (config.ps.hdr)
|
||||
{
|
||||
const GSVector2i size = config.rt->GetSize();
|
||||
const GSVector4 dRect(config.scissor);
|
||||
const GSVector4 dRect(config.drawarea);
|
||||
const GSVector4 sRect = dRect / GSVector4(size.x, size.y).xyxy();
|
||||
hdr_rt = CreateRenderTarget(size.x, size.y, GSTexture::Format::FloatColor);
|
||||
hdr_rt->CommitRegion(GSVector2i(config.scissor.z, config.scissor.w));
|
||||
hdr_rt->CommitRegion(GSVector2i(config.drawarea.z, config.drawarea.w));
|
||||
// Warning: StretchRect must be called before BeginScene otherwise
|
||||
// vertices will be overwritten. Trust me you don't want to do that.
|
||||
StretchRect(config.rt, sRect, hdr_rt, dRect, ShaderConvert::COPY, false);
|
||||
|
@ -1604,7 +1604,7 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config)
|
|||
if (hdr_rt)
|
||||
{
|
||||
const GSVector2i size = config.rt->GetSize();
|
||||
const GSVector4 dRect(config.scissor);
|
||||
const GSVector4 dRect(config.drawarea);
|
||||
const GSVector4 sRect = dRect / GSVector4(size.x, size.y).xyxy();
|
||||
StretchRect(hdr_rt, sRect, config.rt, dRect, ShaderConvert::MOD_256, false);
|
||||
Recycle(hdr_rt);
|
||||
|
|
|
@ -1494,16 +1494,16 @@ void GSRendererNew::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
|
|||
const GSVector4& hacked_scissor = m_channel_shuffle ? GSVector4(0, 0, 1024, 1024) : m_context->scissor.in;
|
||||
const GSVector4i scissor = GSVector4i(GSVector4(rtscale).xyxy() * hacked_scissor).rintersect(GSVector4i(rtsize).zwxy());
|
||||
|
||||
const GSVector4i commitRect = ComputeBoundingBox(rtscale, rtsize);
|
||||
m_conf.scissor = (DATE && !DATE_GL45) ? scissor.rintersect(commitRect) : scissor;
|
||||
m_conf.drawarea = scissor.rintersect(ComputeBoundingBox(rtscale, rtsize));
|
||||
m_conf.scissor = (DATE && !DATE_GL45) ? m_conf.drawarea : scissor;
|
||||
|
||||
SetupIA(sx, sy);
|
||||
|
||||
if (rt)
|
||||
rt->CommitRegion(GSVector2i(commitRect.z, commitRect.w));
|
||||
rt->CommitRegion(GSVector2i(m_conf.drawarea.z, m_conf.drawarea.w));
|
||||
|
||||
if (ds)
|
||||
ds->CommitRegion(GSVector2i(commitRect.z, commitRect.w));
|
||||
ds->CommitRegion(GSVector2i(m_conf.drawarea.z, m_conf.drawarea.w));
|
||||
|
||||
m_conf.alpha_second_pass.enable = ate_second_pass;
|
||||
|
||||
|
|
|
@ -2018,14 +2018,14 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
|
|||
case GSHWDrawConfig::DestinationAlphaMode::Full:
|
||||
break; // No setup
|
||||
case GSHWDrawConfig::DestinationAlphaMode::PrimIDTracking:
|
||||
InitPrimDateTexture(config.rt, config.scissor);
|
||||
InitPrimDateTexture(config.rt, config.drawarea);
|
||||
break;
|
||||
case GSHWDrawConfig::DestinationAlphaMode::StencilOne:
|
||||
ClearStencil(config.ds, 1);
|
||||
break;
|
||||
case GSHWDrawConfig::DestinationAlphaMode::Stencil:
|
||||
{
|
||||
const GSVector4 src = GSVector4(config.scissor) / GSVector4(config.ds->GetSize()).xyxy();
|
||||
const GSVector4 src = GSVector4(config.drawarea) / GSVector4(config.ds->GetSize()).xyxy();
|
||||
const GSVector4 dst = src * 2.f - 1.f;
|
||||
GSVertexPT1 vertices[] =
|
||||
{
|
||||
|
@ -2043,12 +2043,12 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
|
|||
{
|
||||
GSVector2i size = config.rt->GetSize();
|
||||
hdr_rt = CreateRenderTarget(size.x, size.y, GSTexture::Format::FloatColor);
|
||||
hdr_rt->CommitRegion(GSVector2i(config.scissor.z, config.scissor.w));
|
||||
hdr_rt->CommitRegion(GSVector2i(config.drawarea.z, config.drawarea.w));
|
||||
OMSetRenderTargets(hdr_rt, config.ds, &config.scissor);
|
||||
|
||||
// save blend state, since BlitRect destroys it
|
||||
const bool old_blend = GLState::blend;
|
||||
BlitRect(config.rt, config.scissor, config.rt->GetSize(), false, false);
|
||||
BlitRect(config.rt, config.drawarea, config.rt->GetSize(), false, false);
|
||||
if (old_blend)
|
||||
{
|
||||
GLState::blend = old_blend;
|
||||
|
@ -2167,7 +2167,7 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
|
|||
if (hdr_rt)
|
||||
{
|
||||
GSVector2i size = config.rt->GetSize();
|
||||
GSVector4 dRect(config.scissor);
|
||||
GSVector4 dRect(config.drawarea);
|
||||
const GSVector4 sRect = dRect / GSVector4(size.x, size.y).xyxy();
|
||||
StretchRect(hdr_rt, sRect, config.rt, dRect, ShaderConvert::MOD_256, false);
|
||||
|
||||
|
|
Loading…
Reference in New Issue