summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-03-22 22:54:04 -0400
committerGravatar bunnei2018-03-22 22:54:04 -0400
commit6ced80bb470977a8a261275bdb4d2a133932facf (patch)
tree80937f4c85c19bbce3f91fcc99f8d0d35cb7e046 /src
parentvideo_core: Move MortonCopyPixels128 to utils header. (diff)
downloadyuzu-6ced80bb470977a8a261275bdb4d2a133932facf.tar.gz
yuzu-6ced80bb470977a8a261275bdb4d2a133932facf.tar.xz
yuzu-6ced80bb470977a8a261275bdb4d2a133932facf.zip
gl_rasterizer_cache: LoadGLBuffer should do a morton copy.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 7ef08980f..175f329e3 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -530,7 +530,7 @@ MICROPROFILE_DEFINE(OpenGL_SurfaceLoad, "OpenGL", "Surface Load", MP_RGB(128, 64
530void CachedSurface::LoadGLBuffer(VAddr load_start, VAddr load_end) { 530void CachedSurface::LoadGLBuffer(VAddr load_start, VAddr load_end) {
531 ASSERT(type != SurfaceType::Fill); 531 ASSERT(type != SurfaceType::Fill);
532 532
533 const u8* const texture_src_data = Memory::GetPointer(addr); 533 u8* texture_src_data = Memory::GetPointer(addr);
534 if (texture_src_data == nullptr) 534 if (texture_src_data == nullptr)
535 return; 535 return;
536 536
@@ -539,13 +539,6 @@ void CachedSurface::LoadGLBuffer(VAddr load_start, VAddr load_end) {
539 gl_buffer.reset(new u8[gl_buffer_size]); 539 gl_buffer.reset(new u8[gl_buffer_size]);
540 } 540 }
541 541
542 // TODO: Should probably be done in ::Memory:: and check for other regions too
543 if (load_start < Memory::VRAM_VADDR_END && load_end > Memory::VRAM_VADDR_END)
544 load_end = Memory::VRAM_VADDR_END;
545
546 if (load_start < Memory::VRAM_VADDR && load_end > Memory::VRAM_VADDR)
547 load_start = Memory::VRAM_VADDR;
548
549 MICROPROFILE_SCOPE(OpenGL_SurfaceLoad); 542 MICROPROFILE_SCOPE(OpenGL_SurfaceLoad);
550 543
551 ASSERT(load_start >= addr && load_end <= end); 544 ASSERT(load_start >= addr && load_end <= end);
@@ -553,15 +546,11 @@ void CachedSurface::LoadGLBuffer(VAddr load_start, VAddr load_end) {
553 546
554 if (!is_tiled) { 547 if (!is_tiled) {
555 ASSERT(type == SurfaceType::Color); 548 ASSERT(type == SurfaceType::Color);
556 std::memcpy(&gl_buffer[start_offset], texture_src_data + start_offset, 549 VideoCore::MortonCopyPixels128(width, height, GetFormatBpp(), 4,
557 load_end - load_start); 550 texture_src_data + start_offset, &gl_buffer[start_offset],
551 true);
558 } else { 552 } else {
559 if (type == SurfaceType::Texture) { 553 ASSERT_MSG(false, "Unimplemented");
560 ASSERT_MSG(false, "Unimplemented");
561 } else {
562 morton_to_gl_fns[static_cast<size_t>(pixel_format)](stride, height, &gl_buffer[0], addr,
563 load_start, load_end);
564 }
565 } 554 }
566} 555}
567 556