From 9ea658d0ed3785f2cd8283a69bc0582254fd0fc7 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Sun, 31 Jul 2022 14:20:37 +0100 Subject: [PATCH] Don't throw on unsupported TIC formats These sometimes spuriously occur in games during transitions, to avoid crashing during them just use the null texture if they occur and log an error log --- .../cpp/skyline/gpu/interconnect/graphics_context.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h index a1b02231..dfab923c 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h @@ -2200,7 +2200,8 @@ namespace skyline::gpu::interconnect { TIC_FORMAT_CASE_INT_FLOAT(R32G32B32A32, R32G32B32A32); default: - throw exception("Cannot translate TIC format: 0x{:X}", static_cast(format.Raw())); + Logger::Error("Cannot translate TIC format: 0x{:X}", static_cast(format.Raw())); + return {}; } #undef TIC_FORMAT @@ -2258,14 +2259,15 @@ namespace skyline::gpu::interconnect { auto textureIt{texturePool.textures.insert({textureControl, {}})}; auto &poolTexture{textureIt.first->second}; if (textureIt.second) { - if (textureControl.formatWord.format == TextureImageControl::ImageFormat::Invalid) { + // If the entry didn't exist prior then we need to convert the TIC to a GuestTexture + auto &guest{poolTexture.guest}; + if (auto format{ConvertTicFormat(textureControl.formatWord, textureControl.isSrgb)}) { + guest.format = format; + } else { poolTexture.view = nullTextureView; return nullTextureView; } - // If the entry didn't exist prior then we need to convert the TIC to a GuestTexture - auto &guest{poolTexture.guest}; - guest.format = ConvertTicFormat(textureControl.formatWord, textureControl.isSrgb); guest.aspect = guest.format->Aspect(textureControl.formatWord.swizzleX == TextureImageControl::ImageSwizzle::R); guest.swizzle = ConvertTicSwizzleMapping(textureControl.formatWord, guest.format->swizzleMapping);