diff options
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 2e68dab11..8b6d1b89d 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -449,22 +449,24 @@ MICROPROFILE_DEFINE(OpenGL_SurfaceLoad, "OpenGL", "Surface Load", MP_RGB(128, 64 | |||
| 449 | void CachedSurface::LoadGLBuffer() { | 449 | void CachedSurface::LoadGLBuffer() { |
| 450 | ASSERT(params.type != SurfaceType::Fill); | 450 | ASSERT(params.type != SurfaceType::Fill); |
| 451 | 451 | ||
| 452 | u8* const texture_src_data = Memory::GetPointer(params.GetCpuAddr()); | 452 | const u8* const texture_src_data = Memory::GetPointer(params.GetCpuAddr()); |
| 453 | 453 | ||
| 454 | ASSERT(texture_src_data); | 454 | ASSERT(texture_src_data); |
| 455 | 455 | ||
| 456 | gl_buffer.resize(params.width * params.height * GetGLBytesPerPixel(params.pixel_format)); | 456 | const u32 bytes_per_pixel = GetGLBytesPerPixel(params.pixel_format); |
| 457 | const u32 copy_size = params.width * params.height * bytes_per_pixel; | ||
| 457 | 458 | ||
| 458 | MICROPROFILE_SCOPE(OpenGL_SurfaceLoad); | 459 | MICROPROFILE_SCOPE(OpenGL_SurfaceLoad); |
| 459 | 460 | ||
| 460 | if (!params.is_tiled) { | 461 | if (params.is_tiled) { |
| 461 | const u32 bytes_per_pixel{params.GetFormatBpp() >> 3}; | 462 | gl_buffer.resize(copy_size); |
| 462 | 463 | ||
| 463 | std::memcpy(gl_buffer.data(), texture_src_data, | ||
| 464 | bytes_per_pixel * params.width * params.height); | ||
| 465 | } else { | ||
| 466 | morton_to_gl_fns[static_cast<size_t>(params.pixel_format)]( | 464 | morton_to_gl_fns[static_cast<size_t>(params.pixel_format)]( |
| 467 | params.width, params.block_height, params.height, gl_buffer.data(), params.addr); | 465 | params.width, params.block_height, params.height, gl_buffer.data(), params.addr); |
| 466 | } else { | ||
| 467 | const u8* const texture_src_data_end = texture_src_data + copy_size; | ||
| 468 | |||
| 469 | gl_buffer.assign(texture_src_data, texture_src_data_end); | ||
| 468 | } | 470 | } |
| 469 | 471 | ||
| 470 | ConvertFormatAsNeeded_LoadGLBuffer(gl_buffer, params.pixel_format, params.width, params.height); | 472 | ConvertFormatAsNeeded_LoadGLBuffer(gl_buffer, params.pixel_format, params.width, params.height); |