Merge pull request #2122 from PCSX2/target_load

GSdx-TC: Fix load size calculation in target update Fixes #1972 Fixes #2110 Fixes #2138
This commit is contained in:
refractionpcsx2 2018-03-03 03:31:25 +00:00 committed by GitHub
commit 084530eeca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 16 deletions

View File

@ -1457,3 +1457,9 @@ enum class CRCHackLevel : int8
Full,
Aggressive
};
#ifdef ENABLE_ACCURATE_BUFFER_EMULATION
const GSVector2i default_rt_size(2048, 2048);
#else
const GSVector2i default_rt_size(1280, 1024);
#endif

View File

@ -23,8 +23,8 @@
#include "GSRendererHW.h"
GSRendererHW::GSRendererHW(GSTextureCache* tc)
: m_width(native_buffer.x)
, m_height(native_buffer.y)
: m_width(default_rt_size.x)
, m_height(default_rt_size.y)
, m_custom_width(1024)
, m_custom_height(1024)
, m_reset(false)
@ -159,8 +159,8 @@ void GSRendererHW::CustomResolutionScaling()
return;
m_tc->RemovePartial();
m_width = std::max(m_width, native_buffer.x);
m_height = std::max(framebuffer_height[m_large_framebuffer], native_buffer.y);
m_width = std::max(m_width, default_rt_size.x);
m_height = std::max(framebuffer_height[m_large_framebuffer], default_rt_size.y);
std::string overhead = std::to_string(framebuffer_height[1] - framebuffer_height[0]);
std::string message = "(Custom resolution) Framebuffer size set to " + std::to_string(crtc_width) + "x" + std::to_string(crtc_height);

View File

@ -30,7 +30,6 @@
class GSRendererHW : public GSRenderer
{
private:
GSVector2i native_buffer = GSVector2i{1280, 1024};
int m_width;
int m_height;
int m_custom_width;

View File

@ -1846,18 +1846,13 @@ void GSTextureCache::Target::Update()
// Alternate
// 1/ uses multiple vertex rectangle
GSVector2i t_size = m_texture->GetSize();
GSVector2 t_scale = m_texture->GetScale();
GSVector2i t_size = default_rt_size;
//Avoids division by zero when calculating texture size.
t_scale = GSVector2(std::max(1.0f, t_scale.x), std::max(1.0f, t_scale.y));
t_size.x = lround(static_cast<float>(t_size.x) / t_scale.x);
t_size.y = lround(static_cast<float>(t_size.y) / t_scale.y);
// Don't load above the GS memory
int max_y_blocks = (MAX_BLOCKS - m_TEX0.TBP0) / std::max(1u, m_TEX0.TBW);
int max_y = (max_y_blocks >> 5) * GSLocalMemory::m_psm[m_TEX0.PSM].pgs.y;
t_size.y = std::min(t_size.y, max_y);
// Ensure buffer width is at least of the minimum required value.
// Probably not necessary but doesn't hurt to be on the safe side.
// I've seen some games use buffer sizes over 1024, which might bypass our default limit
int buffer_width = m_TEX0.TBW << 6;
t_size.x = std::max(buffer_width, t_size.x);
GSVector4i r = m_dirty.GetDirtyRectAndClear(m_TEX0, t_size);

View File

@ -23,6 +23,7 @@
//#define ENABLE_VTUNE
//#define ENABLE_PCRTC_DEBUG
//#define ENABLE_ACCURATE_BUFFER_EMULATION
#define ENABLE_JIT_RASTERIZER
#define EXTERNAL_SHADER_LOADING 1