diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index f2ffc4710..4ebc343c3 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -643,13 +643,16 @@ void CachedSurface::LoadGLBuffer() { | |||
| 643 | SwizzleFunc(MortonSwizzleMode::MortonToLinear, params, gl_buffer[i], i); | 643 | SwizzleFunc(MortonSwizzleMode::MortonToLinear, params, gl_buffer[i], i); |
| 644 | } else { | 644 | } else { |
| 645 | const u32 bpp = params.GetFormatBpp() / 8; | 645 | const u32 bpp = params.GetFormatBpp() / 8; |
| 646 | const u32 copy_size = params.width * bpp; | 646 | const u32 copy_size = (params.width * bpp + GetDefaultBlockWidth(params.pixel_format) - 1) / |
| 647 | GetDefaultBlockWidth(params.pixel_format); | ||
| 647 | if (params.pitch == copy_size) { | 648 | if (params.pitch == copy_size) { |
| 648 | std::memcpy(gl_buffer[0].data(), params.host_ptr, params.size_in_bytes_gl); | 649 | std::memcpy(gl_buffer[0].data(), params.host_ptr, params.size_in_bytes_gl); |
| 649 | } else { | 650 | } else { |
| 651 | const u32 height = (params.height + GetDefaultBlockHeight(params.pixel_format) - 1) / | ||
| 652 | GetDefaultBlockHeight(params.pixel_format); | ||
| 650 | const u8* start{params.host_ptr}; | 653 | const u8* start{params.host_ptr}; |
| 651 | u8* write_to = gl_buffer[0].data(); | 654 | u8* write_to = gl_buffer[0].data(); |
| 652 | for (u32 h = params.height; h > 0; h--) { | 655 | for (u32 h = height; h > 0; h--) { |
| 653 | std::memcpy(write_to, start, copy_size); | 656 | std::memcpy(write_to, start, copy_size); |
| 654 | start += params.pitch; | 657 | start += params.pitch; |
| 655 | write_to += copy_size; | 658 | write_to += copy_size; |