gl_rasterizer_cache: LoadGLBuffer should do a morton copy.

This commit is contained in:
bunnei 2018-03-22 22:54:04 -04:00
parent 740310113b
commit 6ced80bb47

View File

@ -530,7 +530,7 @@ MICROPROFILE_DEFINE(OpenGL_SurfaceLoad, "OpenGL", "Surface Load", MP_RGB(128, 64
void CachedSurface::LoadGLBuffer(VAddr load_start, VAddr load_end) { void CachedSurface::LoadGLBuffer(VAddr load_start, VAddr load_end) {
ASSERT(type != SurfaceType::Fill); ASSERT(type != SurfaceType::Fill);
const u8* const texture_src_data = Memory::GetPointer(addr); u8* texture_src_data = Memory::GetPointer(addr);
if (texture_src_data == nullptr) if (texture_src_data == nullptr)
return; return;
@ -539,13 +539,6 @@ void CachedSurface::LoadGLBuffer(VAddr load_start, VAddr load_end) {
gl_buffer.reset(new u8[gl_buffer_size]); gl_buffer.reset(new u8[gl_buffer_size]);
} }
// TODO: Should probably be done in ::Memory:: and check for other regions too
if (load_start < Memory::VRAM_VADDR_END && load_end > Memory::VRAM_VADDR_END)
load_end = Memory::VRAM_VADDR_END;
if (load_start < Memory::VRAM_VADDR && load_end > Memory::VRAM_VADDR)
load_start = Memory::VRAM_VADDR;
MICROPROFILE_SCOPE(OpenGL_SurfaceLoad); MICROPROFILE_SCOPE(OpenGL_SurfaceLoad);
ASSERT(load_start >= addr && load_end <= end); ASSERT(load_start >= addr && load_end <= end);
@ -553,15 +546,11 @@ void CachedSurface::LoadGLBuffer(VAddr load_start, VAddr load_end) {
if (!is_tiled) { if (!is_tiled) {
ASSERT(type == SurfaceType::Color); ASSERT(type == SurfaceType::Color);
std::memcpy(&gl_buffer[start_offset], texture_src_data + start_offset, VideoCore::MortonCopyPixels128(width, height, GetFormatBpp(), 4,
load_end - load_start); texture_src_data + start_offset, &gl_buffer[start_offset],
true);
} else { } else {
if (type == SurfaceType::Texture) {
ASSERT_MSG(false, "Unimplemented"); ASSERT_MSG(false, "Unimplemented");
} else {
morton_to_gl_fns[static_cast<size_t>(pixel_format)](stride, height, &gl_buffer[0], addr,
load_start, load_end);
}
} }
} }