From b9b47e3ec763f342ffb98700290a7cb4d89800f8 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 9 Feb 2023 08:42:10 +1000 Subject: [PATCH] GS/OGL: Fix upload row length for texture Update() --- pcsx2/GS/Renderers/OpenGL/GSTextureOGL.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pcsx2/GS/Renderers/OpenGL/GSTextureOGL.cpp b/pcsx2/GS/Renderers/OpenGL/GSTextureOGL.cpp index 48d575c569..135e3e1bb0 100644 --- a/pcsx2/GS/Renderers/OpenGL/GSTextureOGL.cpp +++ b/pcsx2/GS/Renderers/OpenGL/GSTextureOGL.cpp @@ -261,9 +261,14 @@ bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch, int sb->Unmap(map_size); sb->Bind(); + const u32 row_length = CalcUploadRowLengthFromPitch(preferred_pitch); + glPixelStorei(GL_UNPACK_ROW_LENGTH, row_length); + glTextureSubImage2D(m_texture_id, layer, r.x, r.y, r.width(), r.height(), m_int_format, m_int_type, reinterpret_cast(static_cast(map.buffer_offset))); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + sb->Unbind(); }