diff options
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 22 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 8 |
2 files changed, 12 insertions, 18 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index ab681f227..fb56decc0 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -53,8 +53,6 @@ static VAddr TryGetCpuAddr(Tegra::GPUVAddr gpu_addr) { | |||
| 53 | params.width = Common::AlignUp(config.tic.Width(), GetCompressionFactor(params.pixel_format)); | 53 | params.width = Common::AlignUp(config.tic.Width(), GetCompressionFactor(params.pixel_format)); |
| 54 | params.height = Common::AlignUp(config.tic.Height(), GetCompressionFactor(params.pixel_format)); | 54 | params.height = Common::AlignUp(config.tic.Height(), GetCompressionFactor(params.pixel_format)); |
| 55 | params.unaligned_height = config.tic.Height(); | 55 | params.unaligned_height = config.tic.Height(); |
| 56 | params.cache_width = Common::AlignUp(params.width, 8); | ||
| 57 | params.cache_height = Common::AlignUp(params.height, 8); | ||
| 58 | params.target = SurfaceTargetFromTextureType(config.tic.texture_type); | 56 | params.target = SurfaceTargetFromTextureType(config.tic.texture_type); |
| 59 | 57 | ||
| 60 | switch (params.target) { | 58 | switch (params.target) { |
| @@ -89,8 +87,6 @@ static VAddr TryGetCpuAddr(Tegra::GPUVAddr gpu_addr) { | |||
| 89 | params.width = config.width; | 87 | params.width = config.width; |
| 90 | params.height = config.height; | 88 | params.height = config.height; |
| 91 | params.unaligned_height = config.height; | 89 | params.unaligned_height = config.height; |
| 92 | params.cache_width = Common::AlignUp(params.width, 8); | ||
| 93 | params.cache_height = Common::AlignUp(params.height, 8); | ||
| 94 | params.target = SurfaceTarget::Texture2D; | 90 | params.target = SurfaceTarget::Texture2D; |
| 95 | params.depth = 1; | 91 | params.depth = 1; |
| 96 | params.size_in_bytes = params.SizeInBytes(); | 92 | params.size_in_bytes = params.SizeInBytes(); |
| @@ -110,8 +106,6 @@ static VAddr TryGetCpuAddr(Tegra::GPUVAddr gpu_addr) { | |||
| 110 | params.width = zeta_width; | 106 | params.width = zeta_width; |
| 111 | params.height = zeta_height; | 107 | params.height = zeta_height; |
| 112 | params.unaligned_height = zeta_height; | 108 | params.unaligned_height = zeta_height; |
| 113 | params.cache_width = Common::AlignUp(params.width, 8); | ||
| 114 | params.cache_height = Common::AlignUp(params.height, 8); | ||
| 115 | params.target = SurfaceTarget::Texture2D; | 109 | params.target = SurfaceTarget::Texture2D; |
| 116 | params.depth = 1; | 110 | params.depth = 1; |
| 117 | params.size_in_bytes = params.SizeInBytes(); | 111 | params.size_in_bytes = params.SizeInBytes(); |
| @@ -814,16 +808,20 @@ Surface RasterizerCacheOpenGL::RecreateSurface(const Surface& surface, | |||
| 814 | // Get a new surface with the new parameters, and blit the previous surface to it | 808 | // Get a new surface with the new parameters, and blit the previous surface to it |
| 815 | Surface new_surface{GetUncachedSurface(new_params)}; | 809 | Surface new_surface{GetUncachedSurface(new_params)}; |
| 816 | 810 | ||
| 817 | // If format is unchanged, we can do a faster blit without reinterpreting pixel data | 811 | if (params.pixel_format == new_params.pixel_format || |
| 818 | if (params.pixel_format == new_params.pixel_format) { | 812 | !Settings::values.use_accurate_framebuffers) { |
| 813 | // If the format is the same, just do a framebuffer blit. This is significantly faster than | ||
| 814 | // using PBOs. The is also likely less accurate, as textures will be converted rather than | ||
| 815 | // reinterpreted. | ||
| 816 | |||
| 819 | BlitTextures(surface->Texture().handle, params.GetRect(), new_surface->Texture().handle, | 817 | BlitTextures(surface->Texture().handle, params.GetRect(), new_surface->Texture().handle, |
| 820 | params.GetRect(), params.type, read_framebuffer.handle, | 818 | params.GetRect(), params.type, read_framebuffer.handle, |
| 821 | draw_framebuffer.handle); | 819 | draw_framebuffer.handle); |
| 822 | return new_surface; | 820 | } else { |
| 823 | } | 821 | // When use_accurate_framebuffers setting is enabled, perform a more accurate surface copy, |
| 822 | // where pixels are reinterpreted as a new format (without conversion). This code path uses | ||
| 823 | // OpenGL PBOs and is quite slow. | ||
| 824 | 824 | ||
| 825 | // When using accurate framebuffers, always copy old data to new surface, regardless of format | ||
| 826 | if (Settings::values.use_accurate_framebuffers) { | ||
| 827 | auto source_format = GetFormatTuple(params.pixel_format, params.component_type); | 825 | auto source_format = GetFormatTuple(params.pixel_format, params.component_type); |
| 828 | auto dest_format = GetFormatTuple(new_params.pixel_format, new_params.component_type); | 826 | auto dest_format = GetFormatTuple(new_params.pixel_format, new_params.component_type); |
| 829 | 827 | ||
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index e660998d0..57ea8593b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -680,8 +680,8 @@ struct SurfaceParams { | |||
| 680 | 680 | ||
| 681 | /// Checks if surfaces are compatible for caching | 681 | /// Checks if surfaces are compatible for caching |
| 682 | bool IsCompatibleSurface(const SurfaceParams& other) const { | 682 | bool IsCompatibleSurface(const SurfaceParams& other) const { |
| 683 | return std::tie(pixel_format, type, cache_width, cache_height) == | 683 | return std::tie(pixel_format, type, width, height) == |
| 684 | std::tie(other.pixel_format, other.type, other.cache_width, other.cache_height); | 684 | std::tie(other.pixel_format, other.type, other.width, other.height); |
| 685 | } | 685 | } |
| 686 | 686 | ||
| 687 | VAddr addr; | 687 | VAddr addr; |
| @@ -696,10 +696,6 @@ struct SurfaceParams { | |||
| 696 | u32 unaligned_height; | 696 | u32 unaligned_height; |
| 697 | size_t size_in_bytes; | 697 | size_t size_in_bytes; |
| 698 | SurfaceTarget target; | 698 | SurfaceTarget target; |
| 699 | |||
| 700 | // Parameters used for caching only | ||
| 701 | u32 cache_width; | ||
| 702 | u32 cache_height; | ||
| 703 | }; | 699 | }; |
| 704 | 700 | ||
| 705 | }; // namespace OpenGL | 701 | }; // namespace OpenGL |