mirror of https://github.com/PCSX2/pcsx2.git
GS/OpenGL: Fix uploading large (>16MB) textures
This commit is contained in:
parent
9ed33d4337
commit
3b3072801c
|
@ -397,18 +397,17 @@ bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch, int
|
||||||
GL_PUSH("Upload Texture %d", m_texture_id);
|
GL_PUSH("Upload Texture %d", m_texture_id);
|
||||||
g_perfmon.Put(GSPerfMon::TextureUploads, 1);
|
g_perfmon.Put(GSPerfMon::TextureUploads, 1);
|
||||||
|
|
||||||
// The easy solution without PBO
|
// Don't use PBOs for huge texture uploads, let the driver sort it out.
|
||||||
#if 0
|
// Otherwise we'll just be syncing, or worse, crashing because the PBO routine above isn't great.
|
||||||
// Likely a bad texture
|
if (map_size >= PboPool::m_seg_size)
|
||||||
|
{
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, pitch >> m_int_shift);
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, pitch >> m_int_shift);
|
||||||
|
glTextureSubImage2D(m_texture_id, layer, r.x, r.y, r.width(), r.height(), m_int_format, m_int_type, data);
|
||||||
glTextureSubImage2D(m_texture_id, GL_TEX_LEVEL_0, r.x, r.y, r.width(), r.height(), m_int_format, m_int_type, data);
|
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); // Restore default behavior
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); // Restore default behavior
|
||||||
#endif
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// The complex solution with PBO
|
// The complex solution with PBO
|
||||||
#if 1
|
|
||||||
char* src = (char*)data;
|
char* src = (char*)data;
|
||||||
char* map = PboPool::Map(map_size);
|
char* map = PboPool::Map(map_size);
|
||||||
|
|
||||||
|
@ -429,7 +428,7 @@ bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch, int
|
||||||
PboPool::UnbindPbo();
|
PboPool::UnbindPbo();
|
||||||
|
|
||||||
PboPool::EndTransfer();
|
PboPool::EndTransfer();
|
||||||
#endif
|
}
|
||||||
|
|
||||||
m_needs_mipmaps_generated = true;
|
m_needs_mipmaps_generated = true;
|
||||||
|
|
||||||
|
@ -451,13 +450,15 @@ bool GSTextureOGL::Map(GSMap& m, const GSVector4i* _r, int layer)
|
||||||
|
|
||||||
if (m_type == Type::Texture || m_type == Type::RenderTarget)
|
if (m_type == Type::Texture || m_type == Type::RenderTarget)
|
||||||
{
|
{
|
||||||
|
const u32 map_size = r.height() * row_byte;
|
||||||
|
if (map_size > PboPool::m_seg_size)
|
||||||
|
return false;
|
||||||
|
|
||||||
GL_PUSH_("Upload Texture %d", m_texture_id); // POP is in Unmap
|
GL_PUSH_("Upload Texture %d", m_texture_id); // POP is in Unmap
|
||||||
g_perfmon.Put(GSPerfMon::TextureUploads, 1);
|
g_perfmon.Put(GSPerfMon::TextureUploads, 1);
|
||||||
|
|
||||||
m_clean = false;
|
m_clean = false;
|
||||||
|
|
||||||
u32 map_size = r.height() * row_byte;
|
|
||||||
|
|
||||||
m.bits = (u8*)PboPool::Map(map_size);
|
m.bits = (u8*)PboPool::Map(map_size);
|
||||||
|
|
||||||
#ifdef ENABLE_OGL_DEBUG_MEM_BW
|
#ifdef ENABLE_OGL_DEBUG_MEM_BW
|
||||||
|
|
Loading…
Reference in New Issue