summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-08-09 20:36:06 +0200
committerGitHub <noreply@github.com>2018-08-09 20:36:06 +0200
commit88b18b9ba40d7e1d624c782220767a8e3a8a6354 (patch)
tree5d36e55cc944b80b58090b948dd9a22a6bebe69c
parentMerge pull request #993 from bunnei/smo-vtx-pts (diff)
parentgl_rasterizer_cache: Invert conditional in LoadGLBuffer() (diff)
downloadyuzu-88b18b9ba40d7e1d624c782220767a8e3a8a6354.tar
yuzu-88b18b9ba40d7e1d624c782220767a8e3a8a6354.tar.gz
yuzu-88b18b9ba40d7e1d624c782220767a8e3a8a6354.tar.bz2
yuzu-88b18b9ba40d7e1d624c782220767a8e3a8a6354.tar.lz
yuzu-88b18b9ba40d7e1d624c782220767a8e3a8a6354.tar.xz
yuzu-88b18b9ba40d7e1d624c782220767a8e3a8a6354.tar.zst
yuzu-88b18b9ba40d7e1d624c782220767a8e3a8a6354.zip
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp16
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
void CachedSurface::LoadGLBuffer() {
ASSERT(params.type != SurfaceType::Fill);
- u8* const texture_src_data = Memory::GetPointer(params.GetCpuAddr());
+ const u8* const texture_src_data = Memory::GetPointer(params.GetCpuAddr());
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};
+ if (params.is_tiled) {
+ gl_buffer.resize(copy_size);
- std::memcpy(gl_buffer.data(), texture_src_data,
- bytes_per_pixel * params.width * params.height);
- } else {
morton_to_gl_fns[static_cast<size_t>(params.pixel_format)](
params.width, params.block_height, params.height, gl_buffer.data(), params.addr);
+ } else {
+ const u8* const texture_src_data_end = texture_src_data + copy_size;
+
+ gl_buffer.assign(texture_src_data, texture_src_data_end);
}
ConvertFormatAsNeeded_LoadGLBuffer(gl_buffer, params.pixel_format, params.width, params.height);