diff options
author | bunnei <bunneidev@gmail.com> | 2018-10-13 04:28:02 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2018-10-16 17:31:00 +0200 |
commit | b4e29ccb8143ed54d9efeb378db9f45d0153b2e2 (patch) | |
tree | 681442d561a2f0f50791be49eaaed05614964d83 /src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |
parent | gl_rasterizer_cache: Clamp cached surface size to mapped GPU region size. (diff) | |
download | yuzu-b4e29ccb8143ed54d9efeb378db9f45d0153b2e2.tar yuzu-b4e29ccb8143ed54d9efeb378db9f45d0153b2e2.tar.gz yuzu-b4e29ccb8143ed54d9efeb378db9f45d0153b2e2.tar.bz2 yuzu-b4e29ccb8143ed54d9efeb378db9f45d0153b2e2.tar.lz yuzu-b4e29ccb8143ed54d9efeb378db9f45d0153b2e2.tar.xz yuzu-b4e29ccb8143ed54d9efeb378db9f45d0153b2e2.tar.zst yuzu-b4e29ccb8143ed54d9efeb378db9f45d0153b2e2.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 24781a3c1..3eedb0d50 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -668,8 +668,10 @@ static void CopySurface(const Surface& src_surface, const Surface& dst_surface, std::size_t remaining_size = dst_params.size_in_bytes_total - src_params.size_in_bytes_total; std::vector<u8> data(remaining_size); - Memory::ReadBlock(dst_params.addr + src_params.size_in_bytes_total, data.data(), - data.size()); + std::memcpy(data.data(), + Memory::GetPointer(dst_params.addr + src_params.size_in_bytes_total), + data.size()); + glBufferSubData(GL_PIXEL_PACK_BUFFER, src_params.size_in_bytes_total, remaining_size, data.data()); } @@ -916,13 +918,8 @@ void CachedSurface::LoadGLBuffer() { MICROPROFILE_DEFINE(OpenGL_SurfaceFlush, "OpenGL", "Surface Flush", MP_RGB(128, 192, 64)); void CachedSurface::FlushGLBuffer() { MICROPROFILE_SCOPE(OpenGL_SurfaceFlush); - const auto& rect{params.GetRect()}; + // Load data from memory to the surface - const GLint x0 = static_cast<GLint>(rect.left); - const GLint y0 = static_cast<GLint>(rect.bottom); - const size_t buffer_offset = - static_cast<size_t>(static_cast<size_t>(y0) * params.width + static_cast<size_t>(x0)) * - GetGLBytesPerPixel(params.pixel_format); const u32 bytes_per_pixel = GetGLBytesPerPixel(params.pixel_format); const u32 copy_size = params.width * params.height * bytes_per_pixel; gl_buffer.resize(static_cast<size_t>(params.depth) * copy_size); @@ -931,7 +928,6 @@ void CachedSurface::FlushGLBuffer() { ASSERT(params.width * GetGLBytesPerPixel(params.pixel_format) % 4 == 0); glPixelStorei(GL_PACK_ROW_LENGTH, static_cast<GLint>(params.width)); ASSERT(!tuple.compressed); - ASSERT(x0 == 0 && y0 == 0); glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); glGetTextureImage(texture.handle, 0, tuple.format, tuple.type, gl_buffer.size(), gl_buffer.data()); @@ -954,11 +950,10 @@ void CachedSurface::FlushGLBuffer() { block_depth = 1U; } gl_to_morton_fns[static_cast<size_t>(params.pixel_format)]( - params.width, params.block_height, params.height, block_depth, depth, - &gl_buffer[buffer_offset], copy_size, params.addr + buffer_offset); + params.width, params.block_height, params.height, block_depth, depth, gl_buffer.data(), + copy_size, GetAddr()); } else { - Memory::WriteBlock(params.addr + buffer_offset, &gl_buffer[buffer_offset], - gl_buffer.size() - buffer_offset); + std::memcpy(Memory::GetPointer(GetAddr()), gl_buffer.data(), GetSizeInBytes()); } } |