mirror of https://github.com/PCSX2/pcsx2.git
gsdx tc: avoid potential division by 0
This commit is contained in:
parent
265ea82780
commit
91c164ecca
|
@ -1744,11 +1744,11 @@ void GSTextureCache::Target::Update()
|
|||
|
||||
GSVector2i t_size = m_texture->GetSize();
|
||||
GSVector2 t_scale = m_texture->GetScale();
|
||||
t_size.x = (int)((float)t_size.x/t_scale.x);
|
||||
t_size.y = (int)((float)t_size.y/t_scale.y);
|
||||
t_size.x = (int)((float)t_size.x/max(1.0f, t_scale.x));
|
||||
t_size.y = (int)((float)t_size.y/max(1.0f, t_scale.y));
|
||||
|
||||
// Don't load above the GS memory
|
||||
int max_y_blocks = (MAX_BLOCKS - m_TEX0.TBP0) / m_TEX0.TBW;
|
||||
int max_y_blocks = (MAX_BLOCKS - m_TEX0.TBP0) / 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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue