summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2018-06-17 23:37:12 -0400
committerGravatar bunnei2018-06-18 00:55:59 -0400
commitfe906fff361789225bea6b50ade0ccd6dfe84448 (patch)
tree1046cc09cc505530b992a6c03179930684888a3f
parentMerge pull request #568 from bunnei/lop (diff)
downloadyuzu-fe906fff361789225bea6b50ade0ccd6dfe84448.tar.gz
yuzu-fe906fff361789225bea6b50ade0ccd6dfe84448.tar.xz
yuzu-fe906fff361789225bea6b50ade0ccd6dfe84448.zip
gl_rasterizer_cache: Loosen things up a bit.
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp34
1 files changed, 8 insertions, 26 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index ff48a2669..e61960cc0 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -888,9 +888,6 @@ Surface RasterizerCacheOpenGL::GetSurface(const SurfaceParams& params, ScaleMatc
888 // Use GetSurfaceSubRect instead 888 // Use GetSurfaceSubRect instead
889 ASSERT(params.width == params.stride); 889 ASSERT(params.width == params.stride);
890 890
891 ASSERT(!params.is_tiled ||
892 (params.GetActualWidth() % 8 == 0 && params.GetActualHeight() % 8 == 0));
893
894 // Check for an exact match in existing surfaces 891 // Check for an exact match in existing surfaces
895 Surface surface = 892 Surface surface =
896 FindMatch<MatchFlags::Exact | MatchFlags::Invalid>(surface_cache, params, match_res_scale); 893 FindMatch<MatchFlags::Exact | MatchFlags::Invalid>(surface_cache, params, match_res_scale);
@@ -1048,8 +1045,13 @@ Surface RasterizerCacheOpenGL::GetTextureSurface(const Tegra::Texture::FullTextu
1048 1045
1049 if (config.tic.IsTiled()) { 1046 if (config.tic.IsTiled()) {
1050 params.block_height = config.tic.BlockHeight(); 1047 params.block_height = config.tic.BlockHeight();
1051 params.width = Common::AlignUp(params.width, params.block_height); 1048
1052 params.height = Common::AlignUp(params.height, params.block_height); 1049 // TODO(bunnei): The below align up is a hack. This is here because some compressed textures
1050 // are not a multiple of their own compression factor, and so this accounts for that. This
1051 // could potentially result in an extra row of 4px being decoded if a texture is not a
1052 // multiple of 4.
1053 params.width = Common::AlignUp(params.width, 4);
1054 params.height = Common::AlignUp(params.height, 4);
1053 } else { 1055 } else {
1054 // Use the texture-provided stride value if the texture isn't tiled. 1056 // Use the texture-provided stride value if the texture isn't tiled.
1055 params.stride = static_cast<u32>(params.PixelsInBytes(config.tic.Pitch())); 1057 params.stride = static_cast<u32>(params.PixelsInBytes(config.tic.Pitch()));
@@ -1057,26 +1059,6 @@ Surface RasterizerCacheOpenGL::GetTextureSurface(const Tegra::Texture::FullTextu
1057 1059
1058 params.UpdateParams(); 1060 params.UpdateParams();
1059 1061
1060 if (params.GetActualWidth() % 8 != 0 || params.GetActualHeight() % 8 != 0 ||
1061 params.stride != params.width) {
1062 Surface src_surface;
1063 MathUtil::Rectangle<u32> rect;
1064 std::tie(src_surface, rect) = GetSurfaceSubRect(params, ScaleMatch::Ignore, true);
1065
1066 rect = rect.Scale(params.GetCompresssionFactor());
1067
1068 params.res_scale = src_surface->res_scale;
1069 Surface tmp_surface = CreateSurface(params);
1070
1071 auto dst_rect = tmp_surface->GetScaledRect().Scale(params.GetCompresssionFactor());
1072 BlitTextures(src_surface->texture.handle, rect, tmp_surface->texture.handle, dst_rect,
1073 SurfaceParams::GetFormatType(params.pixel_format), read_framebuffer.handle,
1074 draw_framebuffer.handle);
1075
1076 remove_surfaces.emplace(tmp_surface);
1077 return tmp_surface;
1078 }
1079
1080 return GetSurface(params, ScaleMatch::Ignore, true); 1062 return GetSurface(params, ScaleMatch::Ignore, true);
1081} 1063}
1082 1064
@@ -1251,7 +1233,7 @@ void RasterizerCacheOpenGL::ValidateSurface(const Surface& surface, Tegra::GPUVA
1251 1233
1252 const auto interval = *it & validate_interval; 1234 const auto interval = *it & validate_interval;
1253 // Look for a valid surface to copy from 1235 // Look for a valid surface to copy from
1254 SurfaceParams params = surface->FromInterval(interval); 1236 SurfaceParams params = *surface;
1255 1237
1256 Surface copy_surface = 1238 Surface copy_surface =
1257 FindMatch<MatchFlags::Copy>(surface_cache, params, ScaleMatch::Ignore, interval); 1239 FindMatch<MatchFlags::Copy>(surface_cache, params, ScaleMatch::Ignore, interval);