diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index ecc84293e..9efb5cea4 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -451,16 +451,18 @@ void CachedSurface::LoadGLBuffer() { | |||
| 451 | 451 | ||
| 452 | ASSERT(texture_src_data); | 452 | ASSERT(texture_src_data); |
| 453 | 453 | ||
| 454 | gl_buffer.resize(params.width * params.height * GetGLBytesPerPixel(params.pixel_format)); | 454 | const u32 bytes_per_pixel = GetGLBytesPerPixel(params.pixel_format); |
| 455 | const u32 copy_size = params.width * params.height * bytes_per_pixel; | ||
| 455 | 456 | ||
| 456 | MICROPROFILE_SCOPE(OpenGL_SurfaceLoad); | 457 | MICROPROFILE_SCOPE(OpenGL_SurfaceLoad); |
| 457 | 458 | ||
| 458 | if (!params.is_tiled) { | 459 | if (!params.is_tiled) { |
| 459 | const u32 bytes_per_pixel{params.GetFormatBpp() >> 3}; | 460 | const u8* const texture_src_data_end = texture_src_data + copy_size; |
| 460 | 461 | ||
| 461 | std::memcpy(gl_buffer.data(), texture_src_data, | 462 | gl_buffer.assign(texture_src_data, texture_src_data_end); |
| 462 | bytes_per_pixel * params.width * params.height); | ||
| 463 | } else { | 463 | } else { |
| 464 | gl_buffer.resize(copy_size); | ||
| 465 | |||
| 464 | morton_to_gl_fns[static_cast<size_t>(params.pixel_format)]( | 466 | morton_to_gl_fns[static_cast<size_t>(params.pixel_format)]( |
| 465 | params.width, params.block_height, params.height, gl_buffer.data(), params.addr); | 467 | params.width, params.block_height, params.height, gl_buffer.data(), params.addr); |
| 466 | } | 468 | } |