diff options
author | bunnei <bunneidev@gmail.com> | 2019-04-22 23:09:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-22 23:09:42 +0200 |
commit | b5889cbd6f036f46df63a60398a107027daed492 (patch) | |
tree | 1c32bd8677a15692a27a7d44ea0a8ac623d08a77 /src | |
parent | Merge pull request #2411 from FernandoS27/unsafe-gpu (diff) | |
parent | Support compressed formats on linear textures. (diff) | |
download | yuzu-b5889cbd6f036f46df63a60398a107027daed492.tar yuzu-b5889cbd6f036f46df63a60398a107027daed492.tar.gz yuzu-b5889cbd6f036f46df63a60398a107027daed492.tar.bz2 yuzu-b5889cbd6f036f46df63a60398a107027daed492.tar.lz yuzu-b5889cbd6f036f46df63a60398a107027daed492.tar.xz yuzu-b5889cbd6f036f46df63a60398a107027daed492.tar.zst yuzu-b5889cbd6f036f46df63a60398a107027daed492.zip |
Diffstat (limited to '')
-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 7a68b8738..5a25f5b37 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -640,13 +640,16 @@ void CachedSurface::LoadGLBuffer() { SwizzleFunc(MortonSwizzleMode::MortonToLinear, params, gl_buffer[i], i); } else { const u32 bpp = params.GetFormatBpp() / 8; - const u32 copy_size = params.width * bpp; + const u32 copy_size = (params.width * bpp + GetDefaultBlockWidth(params.pixel_format) - 1) / + GetDefaultBlockWidth(params.pixel_format); if (params.pitch == copy_size) { std::memcpy(gl_buffer[0].data(), params.host_ptr, params.size_in_bytes_gl); } else { + const u32 height = (params.height + GetDefaultBlockHeight(params.pixel_format) - 1) / + GetDefaultBlockHeight(params.pixel_format); const u8* start{params.host_ptr}; u8* write_to = gl_buffer[0].data(); - for (u32 h = params.height; h > 0; h--) { + for (u32 h = height; h > 0; h--) { std::memcpy(write_to, start, copy_size); start += params.pitch; write_to += copy_size; |