From 9fa26624b02562fb8626c93c45acf2015fc06f40 Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Sun, 10 Oct 2021 08:16:15 +1300 Subject: BPMemory: Refactor/consolidate TexUnit Addressing Currently the logic for addressing the individual TexUnits is splattered all across dolphin's codebase, this commit attempts to consolidate it all into a single place and formalise it using our new TexUnitAddress struct. --- Source/Core/VideoBackends/Software/DebugUtil.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'Source/Core/VideoBackends/Software/DebugUtil.cpp') diff --git a/Source/Core/VideoBackends/Software/DebugUtil.cpp b/Source/Core/VideoBackends/Software/DebugUtil.cpp index 397442f8e8..c580461172 100644 --- a/Source/Core/VideoBackends/Software/DebugUtil.cpp +++ b/Source/Core/VideoBackends/Software/DebugUtil.cpp @@ -52,13 +52,8 @@ void Shutdown() static void SaveTexture(const std::string& filename, u32 texmap, s32 mip) { - FourTexUnits& texUnit = bpmem.tex[(texmap >> 2) & 1]; - u8 subTexmap = texmap & 3; - - TexImage0& ti0 = texUnit.texImage0[subTexmap]; - - u32 width = ti0.width + 1; - u32 height = ti0.height + 1; + u32 width = bpmem.tex.GetUnit(texmap).texImage0.width + 1; + u32 height = bpmem.tex.GetUnit(texmap).texImage0.height + 1; auto data = std::make_unique(width * height * 4); @@ -80,10 +75,7 @@ void GetTextureRGBA(u8* dst, u32 texmap, s32 mip, u32 width, u32 height) static s32 GetMaxTextureLod(u32 texmap) { - FourTexUnits& texUnit = bpmem.tex[(texmap >> 2) & 1]; - u8 subTexmap = texmap & 3; - - u8 maxLod = texUnit.texMode1[subTexmap].max_lod; + u8 maxLod = bpmem.tex.GetUnit(texmap).texMode1.max_lod; u8 mip = maxLod >> 4; u8 fract = maxLod & 0xf; -- cgit v1.2.3