From f5b174f985d0531d8a4f48e126c6de2b03c8f5d0 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Mon, 16 May 2016 19:20:01 +0200 Subject: [PATCH] gsdx ogl: pitch is always the width of the transfer not the size of the texture --- plugins/GSdx/GSTextureOGL.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/GSdx/GSTextureOGL.cpp b/plugins/GSdx/GSTextureOGL.cpp index 1b287b6772..c28a2e95b8 100644 --- a/plugins/GSdx/GSTextureOGL.cpp +++ b/plugins/GSdx/GSTextureOGL.cpp @@ -355,8 +355,13 @@ bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch) bool GSTextureOGL::Map(GSMap& m, const GSVector4i* _r) { GSVector4i r = _r ? *_r : GSVector4i(0, 0, m_size.x, m_size.y); + // Will need some investigation + ASSERT(r.width() != 0); + ASSERT(r.height() != 0); + + uint32 row_byte = r.width() << m_int_shift; + m.pitch = row_byte; - // LOTS OF CRAP CODE!!!! PLEASE FIX ME !!! if (m_type == GSTexture::Offscreen) { // The fastest way will be to use a PBO to read the data asynchronously. Unfortunately GSdx // architecture is waiting the data right now. @@ -379,7 +384,6 @@ bool GSTextureOGL::Map(GSMap& m, const GSVector4i* _r) #endif m.bits = m_local_buffer; - m.pitch = m_size.x << m_int_shift; return true; } else if (m_type == GSTexture::Texture || m_type == GSTexture::RenderTarget) { @@ -387,11 +391,9 @@ bool GSTextureOGL::Map(GSMap& m, const GSVector4i* _r) m_clean = false; - uint32 row_byte = r.width() << m_int_shift; uint32 map_size = r.height() * row_byte; m.bits = (uint8*)PboPool::Map(map_size); - m.pitch = row_byte; #ifdef ENABLE_OGL_DEBUG_MEM_BW g_real_texture_upload_byte += map_size;