diff options
author | Lioncash <mathew1800@gmail.com> | 2018-08-09 05:28:01 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-08-09 05:34:58 +0200 |
commit | 434f352eb37fba2a5c80bead61a8c5593785730d (patch) | |
tree | 8ea1988115400fdde58094c12aa3f451947a4a66 | |
parent | gl_rasterizer_cache: Make pointer const in LoadGLBuffer() (diff) | |
download | yuzu-434f352eb37fba2a5c80bead61a8c5593785730d.tar yuzu-434f352eb37fba2a5c80bead61a8c5593785730d.tar.gz yuzu-434f352eb37fba2a5c80bead61a8c5593785730d.tar.bz2 yuzu-434f352eb37fba2a5c80bead61a8c5593785730d.tar.lz yuzu-434f352eb37fba2a5c80bead61a8c5593785730d.tar.xz yuzu-434f352eb37fba2a5c80bead61a8c5593785730d.tar.zst yuzu-434f352eb37fba2a5c80bead61a8c5593785730d.zip |
-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() { ASSERT(texture_src_data); - gl_buffer.resize(params.width * params.height * GetGLBytesPerPixel(params.pixel_format)); + const u32 bytes_per_pixel = GetGLBytesPerPixel(params.pixel_format); + const u32 copy_size = params.width * params.height * bytes_per_pixel; MICROPROFILE_SCOPE(OpenGL_SurfaceLoad); if (!params.is_tiled) { - const u32 bytes_per_pixel{params.GetFormatBpp() >> 3}; + const u8* const texture_src_data_end = texture_src_data + copy_size; - std::memcpy(gl_buffer.data(), texture_src_data, - bytes_per_pixel * params.width * params.height); + gl_buffer.assign(texture_src_data, texture_src_data_end); } else { + gl_buffer.resize(copy_size); + morton_to_gl_fns[static_cast<size_t>(params.pixel_format)]( params.width, params.block_height, params.height, gl_buffer.data(), params.addr); } |