GS/SW: Zero out texture cache buffers

This _shouldn't_ be necessary, but apparently our texture min/max is wrong
somewhere, and we end up sampling from "random" malloc memory, which breaks
GS dump runs.
This commit is contained in:
Stenzek 2024-06-13 23:28:39 +10:00 committed by Connor McLaughlin
parent bdeb0fcb76
commit affbcfe135
1 changed files with 6 additions and 1 deletions

View File

@ -225,10 +225,15 @@ bool GSTextureCacheSW::Texture::Update(const GSVector4i& rect)
if (!m_buff)
{
const u32 pitch = (1 << m_tw) << shift;
const size_t size = pitch * th * 4;
m_buff = _aligned_malloc(pitch * th * 4, VECTOR_ALIGNMENT);
m_buff = _aligned_malloc(size, VECTOR_ALIGNMENT);
if (!m_buff)
return false;
// This _shouldn't_ be necessary, but apparently our texture min/max is wrong somewhere,
// and we end up sampling from "random" malloc memory, which breaks GS dump runs.
std::memset(m_buff, 0, size);
}
GSLocalMemory& mem = g_gs_renderer->m_mem;