summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-04-15 19:56:09 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2019-04-15 19:56:09 +0200
commit773d955dfa77e3ee08ce4c1c0669d0532530d70c (patch)
tree9ec3c18ccc3a8bc7f4a701ff4a606eb35761b8f0 /src/video_core
parentMerge pull request #2378 from lioncash/ro (diff)
downloadyuzu-773d955dfa77e3ee08ce4c1c0669d0532530d70c.tar
yuzu-773d955dfa77e3ee08ce4c1c0669d0532530d70c.tar.gz
yuzu-773d955dfa77e3ee08ce4c1c0669d0532530d70c.tar.bz2
yuzu-773d955dfa77e3ee08ce4c1c0669d0532530d70c.tar.lz
yuzu-773d955dfa77e3ee08ce4c1c0669d0532530d70c.tar.xz
yuzu-773d955dfa77e3ee08ce4c1c0669d0532530d70c.tar.zst
yuzu-773d955dfa77e3ee08ce4c1c0669d0532530d70c.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp7
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() {
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;