diff options
| author | 2019-04-22 17:09:42 -0400 | |
|---|---|---|
| committer | 2019-04-22 17:09:42 -0400 | |
| 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.gz yuzu-b5889cbd6f036f46df63a60398a107027daed492.tar.xz yuzu-b5889cbd6f036f46df63a60398a107027daed492.zip | |
Merge pull request #2403 from FernandoS27/compressed-linear
Support compressed formats on linear textures.
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 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() { | |||
| 640 | SwizzleFunc(MortonSwizzleMode::MortonToLinear, params, gl_buffer[i], i); | 640 | SwizzleFunc(MortonSwizzleMode::MortonToLinear, params, gl_buffer[i], i); |
| 641 | } else { | 641 | } else { |
| 642 | const u32 bpp = params.GetFormatBpp() / 8; | 642 | const u32 bpp = params.GetFormatBpp() / 8; |
| 643 | const u32 copy_size = params.width * bpp; | 643 | const u32 copy_size = (params.width * bpp + GetDefaultBlockWidth(params.pixel_format) - 1) / |
| 644 | GetDefaultBlockWidth(params.pixel_format); | ||
| 644 | if (params.pitch == copy_size) { | 645 | if (params.pitch == copy_size) { |
| 645 | std::memcpy(gl_buffer[0].data(), params.host_ptr, params.size_in_bytes_gl); | 646 | std::memcpy(gl_buffer[0].data(), params.host_ptr, params.size_in_bytes_gl); |
| 646 | } else { | 647 | } else { |
| 648 | const u32 height = (params.height + GetDefaultBlockHeight(params.pixel_format) - 1) / | ||
| 649 | GetDefaultBlockHeight(params.pixel_format); | ||
| 647 | const u8* start{params.host_ptr}; | 650 | const u8* start{params.host_ptr}; |
| 648 | u8* write_to = gl_buffer[0].data(); | 651 | u8* write_to = gl_buffer[0].data(); |
| 649 | for (u32 h = params.height; h > 0; h--) { | 652 | for (u32 h = height; h > 0; h--) { |
| 650 | std::memcpy(write_to, start, copy_size); | 653 | std::memcpy(write_to, start, copy_size); |
| 651 | start += params.pitch; | 654 | start += params.pitch; |
| 652 | write_to += copy_size; | 655 | write_to += copy_size; |