summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar FernandoS272018-10-13 16:11:11 -0400
committerGravatar FernandoS272018-10-13 16:11:11 -0400
commit1ff20d8538e7ed6a9121882afef4d73503667842 (patch)
tree16fcec0f19cb1bf7b64dd1754108114cc73df98d /src
parentPropagate depth and depth_block on modules using decoders (diff)
downloadyuzu-1ff20d8538e7ed6a9121882afef4d73503667842.tar.gz
yuzu-1ff20d8538e7ed6a9121882afef4d73503667842.tar.xz
yuzu-1ff20d8538e7ed6a9121882afef4d73503667842.zip
Fix a Crash on Zelda BotW and Splatoon 2, and simplified LoadGLBuffer
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp19
-rw-r--r--src/video_core/textures/decoders.cpp2
2 files changed, 2 insertions, 19 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 86cb62dae..8fdb59b5b 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -833,27 +833,10 @@ void CachedSurface::LoadGLBuffer() {
833 ASSERT_MSG(params.block_width == 1, "Block width is defined as {} on texture type {}", 833 ASSERT_MSG(params.block_width == 1, "Block width is defined as {} on texture type {}",
834 params.block_width, static_cast<u32>(params.target)); 834 params.block_width, static_cast<u32>(params.target));
835 835
836 switch (params.target) { 836 if (params.target == SurfaceParams::SurfaceTarget::Texture2D) {
837 case SurfaceParams::SurfaceTarget::Texture2D:
838 // TODO(Blinkhawk): Eliminate this condition once all texture types are implemented. 837 // TODO(Blinkhawk): Eliminate this condition once all texture types are implemented.
839 depth = 1U; 838 depth = 1U;
840 block_depth = 1U; 839 block_depth = 1U;
841 break;
842 case SurfaceParams::SurfaceTarget::Texture2DArray:
843 case SurfaceParams::SurfaceTarget::TextureCubemap:
844 depth = 1U;
845 block_depth = 1U;
846 for (std::size_t index = 0; index < params.depth; ++index) {
847 const std::size_t offset{index * copy_size};
848 morton_to_gl_fns[static_cast<std::size_t>(params.pixel_format)](
849 params.width, params.block_height, params.height, 1U, 1U,
850 gl_buffer.data() + offset, copy_size, params.addr + offset);
851 }
852 break;
853 default:
854 LOG_CRITICAL(HW_GPU, "Unimplemented tiled load for target={}",
855 static_cast<u32>(params.target));
856 UNREACHABLE();
857 } 840 }
858 841
859 const std::size_t size = copy_size * depth; 842 const std::size_t size = copy_size * depth;
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index 6693067f8..5dab47886 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -271,7 +271,7 @@ u32 BytesPerPixel(TextureFormat format) {
271 271
272std::vector<u8> UnswizzleTexture(VAddr address, u32 tile_size, u32 bytes_per_pixel, u32 width, 272std::vector<u8> UnswizzleTexture(VAddr address, u32 tile_size, u32 bytes_per_pixel, u32 width,
273 u32 height, u32 depth, u32 block_height, u32 block_depth) { 273 u32 height, u32 depth, u32 block_height, u32 block_depth) {
274 std::vector<u8> unswizzled_data(width * height * bytes_per_pixel); 274 std::vector<u8> unswizzled_data(width * height * depth * bytes_per_pixel);
275 CopySwizzledData(width / tile_size, height / tile_size, depth, bytes_per_pixel, bytes_per_pixel, 275 CopySwizzledData(width / tile_size, height / tile_size, depth, bytes_per_pixel, bytes_per_pixel,
276 Memory::GetPointer(address), unswizzled_data.data(), true, block_height, 276 Memory::GetPointer(address), unswizzled_data.data(), true, block_height,
277 block_depth); 277 block_depth);