diff options
author | bunnei <bunneidev@gmail.com> | 2020-02-23 05:09:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-23 05:09:50 +0100 |
commit | 754aac331f82b55bed1a2c0fdf4e87e9893903e1 (patch) | |
tree | 1971a7120143a4faaf74f9a7bc3d9875baa020a1 | |
parent | Merge pull request #3416 from FernandoS27/schedule (diff) | |
parent | surface_base: Implement texture buffer flushes (diff) | |
download | yuzu-754aac331f82b55bed1a2c0fdf4e87e9893903e1.tar yuzu-754aac331f82b55bed1a2c0fdf4e87e9893903e1.tar.gz yuzu-754aac331f82b55bed1a2c0fdf4e87e9893903e1.tar.bz2 yuzu-754aac331f82b55bed1a2c0fdf4e87e9893903e1.tar.lz yuzu-754aac331f82b55bed1a2c0fdf4e87e9893903e1.tar.xz yuzu-754aac331f82b55bed1a2c0fdf4e87e9893903e1.tar.zst yuzu-754aac331f82b55bed1a2c0fdf4e87e9893903e1.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.cpp | 7 | ||||
-rw-r--r-- | src/video_core/texture_cache/surface_base.cpp | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index d4b81cd87..5c1ae1418 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp @@ -260,6 +260,13 @@ CachedSurface::~CachedSurface() = default; void CachedSurface::DownloadTexture(std::vector<u8>& staging_buffer) { MICROPROFILE_SCOPE(OpenGL_Texture_Download); + if (params.IsBuffer()) { + glGetNamedBufferSubData(texture_buffer.handle, 0, + static_cast<GLsizeiptr>(params.GetHostSizeInBytes()), + staging_buffer.data()); + return; + } + SCOPE_EXIT({ glPixelStorei(GL_PACK_ROW_LENGTH, 0); }); for (u32 level = 0; level < params.emulated_levels; ++level) { diff --git a/src/video_core/texture_cache/surface_base.cpp b/src/video_core/texture_cache/surface_base.cpp index 84469b7ba..002df414f 100644 --- a/src/video_core/texture_cache/surface_base.cpp +++ b/src/video_core/texture_cache/surface_base.cpp @@ -277,6 +277,10 @@ void SurfaceBaseImpl::FlushBuffer(Tegra::MemoryManager& memory_manager, SwizzleFunc(MortonSwizzleMode::LinearToMorton, host_ptr, params, staging_buffer.data() + host_offset, level); } + } else if (params.IsBuffer()) { + // Buffers don't have pitch or any fancy layout property. We can just memcpy them to guest + // memory. + std::memcpy(host_ptr, staging_buffer.data(), guest_memory_size); } else { ASSERT(params.target == SurfaceTarget::Texture2D); ASSERT(params.num_levels == 1); |