From e747de37cf456f78586eae157ae7ac91fe32dd07 Mon Sep 17 00:00:00 2001 From: PixelyIon Date: Thu, 13 Jan 2022 07:51:06 +0530 Subject: [PATCH] Implement Blocklinear TIC Type --- .../cpp/skyline/gpu/interconnect/graphics_context.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 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 c887f620..3526f0da 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h @@ -1772,17 +1772,21 @@ namespace skyline::gpu::interconnect { size_t size; //!< The size of the texture in bytes if (textureControl.headerType == TextureImageControl::HeaderType::Pitch) { - u32 pitch{static_cast(textureControl.tileConfig.pitchHigh) << TextureImageControl::TileConfig::PitchAlignmentBits}; guest.tileConfig = { .mode = texture::TileMode::Pitch, - .pitch = pitch, + .pitch = static_cast(textureControl.tileConfig.pitchHigh) << TextureImageControl::TileConfig::PitchAlignmentBits, + }; + } else if (textureControl.headerType == TextureImageControl::HeaderType::BlockLinear) { + guest.tileConfig = { + .mode = texture::TileMode::Block, + .blockHeight = static_cast(1U << textureControl.tileConfig.tileHeightGobsLog2), + .blockDepth = static_cast(1U << textureControl.tileConfig.tileDepthGobsLog2), }; - size = pitch * guest.dimensions.height * guest.dimensions.depth * guest.layerCount; } else { throw exception("Unsupported TIC Header Type: {}", static_cast(textureControl.headerType)); } - auto mappings{channelCtx.asCtx->gmmu.TranslateRange(textureControl.Iova(), size)}; + auto mappings{channelCtx.asCtx->gmmu.TranslateRange(textureControl.Iova(), guest.GetLayerSize() * (guest.layerCount - guest.baseArrayLayer))}; guest.mappings.assign(mappings.begin(), mappings.end()); } else if (auto textureView{poolTexture.view.lock()}; textureView != nullptr) { // If the entry already exists and the view is still valid then we return it directly