diff options
| author | 2018-06-08 12:27:19 -0500 | |
|---|---|---|
| committer | 2018-06-08 12:27:19 -0500 | |
| commit | 8d9534d830226f7095796da8358ef980f46af32e (patch) | |
| tree | 9337f6c89f6d757826f8f76b857dff27481be193 | |
| parent | Merge pull request #478 from janisozaur/patch-1 (diff) | |
| download | yuzu-8d9534d830226f7095796da8358ef980f46af32e.tar.gz yuzu-8d9534d830226f7095796da8358ef980f46af32e.tar.xz yuzu-8d9534d830226f7095796da8358ef980f46af32e.zip | |
GLCache: Align compressed texture sizes to their compression ratio, and then align that compressed size to the block height for tiled textures.
This fixes issues with retrieving non-block-aligned tiled compressed textures from the cache.
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index df2474ea2..ff48a2669 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -1033,8 +1033,11 @@ Surface RasterizerCacheOpenGL::GetTextureSurface(const Tegra::Texture::FullTextu | |||
| 1033 | params.addr = config.tic.Address(); | 1033 | params.addr = config.tic.Address(); |
| 1034 | params.is_tiled = config.tic.IsTiled(); | 1034 | params.is_tiled = config.tic.IsTiled(); |
| 1035 | params.pixel_format = SurfaceParams::PixelFormatFromTextureFormat(config.tic.format); | 1035 | params.pixel_format = SurfaceParams::PixelFormatFromTextureFormat(config.tic.format); |
| 1036 | params.width = config.tic.Width() / params.GetCompresssionFactor(); | 1036 | |
| 1037 | params.height = config.tic.Height() / params.GetCompresssionFactor(); | 1037 | params.width = Common::AlignUp(config.tic.Width(), params.GetCompresssionFactor()) / |
| 1038 | params.GetCompresssionFactor(); | ||
| 1039 | params.height = Common::AlignUp(config.tic.Height(), params.GetCompresssionFactor()) / | ||
| 1040 | params.GetCompresssionFactor(); | ||
| 1038 | 1041 | ||
| 1039 | // TODO(Subv): Different types per component are not supported. | 1042 | // TODO(Subv): Different types per component are not supported. |
| 1040 | ASSERT(config.tic.r_type.Value() == config.tic.g_type.Value() && | 1043 | ASSERT(config.tic.r_type.Value() == config.tic.g_type.Value() && |
| @@ -1045,6 +1048,8 @@ Surface RasterizerCacheOpenGL::GetTextureSurface(const Tegra::Texture::FullTextu | |||
| 1045 | 1048 | ||
| 1046 | if (config.tic.IsTiled()) { | 1049 | if (config.tic.IsTiled()) { |
| 1047 | params.block_height = config.tic.BlockHeight(); | 1050 | params.block_height = config.tic.BlockHeight(); |
| 1051 | params.width = Common::AlignUp(params.width, params.block_height); | ||
| 1052 | params.height = Common::AlignUp(params.height, params.block_height); | ||
| 1048 | } else { | 1053 | } else { |
| 1049 | // Use the texture-provided stride value if the texture isn't tiled. | 1054 | // Use the texture-provided stride value if the texture isn't tiled. |
| 1050 | params.stride = static_cast<u32>(params.PixelsInBytes(config.tic.Pitch())); | 1055 | params.stride = static_cast<u32>(params.PixelsInBytes(config.tic.Pitch())); |