summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-09-11 02:28:40 +0200
committerGitHub <noreply@github.com>2018-09-11 02:28:40 +0200
commit12445b476dd7dd2a98f3c2690a78149f179844dd (patch)
treeac29d6cd53975b9611fb387045c25cee3ce3ebf2
parentMerge pull request #1284 from bunnei/bgra8_srgb (diff)
parentgl_rasterizer_cache: Only use depth for applicable texture formats. (diff)
downloadyuzu-12445b476dd7dd2a98f3c2690a78149f179844dd.tar
yuzu-12445b476dd7dd2a98f3c2690a78149f179844dd.tar.gz
yuzu-12445b476dd7dd2a98f3c2690a78149f179844dd.tar.bz2
yuzu-12445b476dd7dd2a98f3c2690a78149f179844dd.tar.lz
yuzu-12445b476dd7dd2a98f3c2690a78149f179844dd.tar.xz
yuzu-12445b476dd7dd2a98f3c2690a78149f179844dd.tar.zst
yuzu-12445b476dd7dd2a98f3c2690a78149f179844dd.zip
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 20a8e1cda..29d61eccd 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -52,12 +52,28 @@ static VAddr TryGetCpuAddr(Tegra::GPUVAddr gpu_addr) {
params.type = GetFormatType(params.pixel_format);
params.width = Common::AlignUp(config.tic.Width(), GetCompressionFactor(params.pixel_format));
params.height = Common::AlignUp(config.tic.Height(), GetCompressionFactor(params.pixel_format));
- params.depth = config.tic.Depth();
params.unaligned_height = config.tic.Height();
- params.size_in_bytes = params.SizeInBytes();
params.cache_width = Common::AlignUp(params.width, 8);
params.cache_height = Common::AlignUp(params.height, 8);
params.target = SurfaceTargetFromTextureType(config.tic.texture_type);
+
+ switch (params.target) {
+ case SurfaceTarget::Texture1D:
+ case SurfaceTarget::Texture2D:
+ params.depth = 1;
+ break;
+ case SurfaceTarget::Texture3D:
+ case SurfaceTarget::Texture2DArray:
+ params.depth = config.tic.Depth();
+ break;
+ default:
+ LOG_CRITICAL(HW_GPU, "Unknown depth for target={}", static_cast<u32>(params.target));
+ UNREACHABLE();
+ params.depth = 1;
+ break;
+ }
+
+ params.size_in_bytes = params.SizeInBytes();
return params;
}
@@ -72,12 +88,12 @@ static VAddr TryGetCpuAddr(Tegra::GPUVAddr gpu_addr) {
params.type = GetFormatType(params.pixel_format);
params.width = config.width;
params.height = config.height;
- params.depth = 1;
params.unaligned_height = config.height;
- params.size_in_bytes = params.SizeInBytes();
params.cache_width = Common::AlignUp(params.width, 8);
params.cache_height = Common::AlignUp(params.height, 8);
params.target = SurfaceTarget::Texture2D;
+ params.depth = 1;
+ params.size_in_bytes = params.SizeInBytes();
return params;
}
@@ -93,12 +109,12 @@ static VAddr TryGetCpuAddr(Tegra::GPUVAddr gpu_addr) {
params.type = GetFormatType(params.pixel_format);
params.width = zeta_width;
params.height = zeta_height;
- params.depth = 1;
params.unaligned_height = zeta_height;
- params.size_in_bytes = params.SizeInBytes();
params.cache_width = Common::AlignUp(params.width, 8);
params.cache_height = Common::AlignUp(params.height, 8);
params.target = SurfaceTarget::Texture2D;
+ params.depth = 1;
+ params.size_in_bytes = params.SizeInBytes();
return params;
}