Convert BPMemory to BitField and enum class

Additional changes:
- For TevStageCombiner's ColorCombiner and AlphaCombiner, op/comparison and scale/compare_mode have been split as there are different meanings and enums if bias is set to compare.  (Shift has also been renamed to scale)
- In TexMode0, min_filter has been split into min_mip and min_filter.
- In TexImage1, image_type is now cache_manually_managed.
- The unused bit in GenMode is now exposed.
- LPSize's lineaspect is now named adjust_for_aspect_ratio.
This commit is contained in:
Pokechu22
2021-03-06 19:27:19 -08:00
parent db8ced7e4e
commit 70f9fc4e75
33 changed files with 1553 additions and 1236 deletions
@@ -489,13 +489,16 @@ bool CullTest(const OutputVertexData* v0, const OutputVertexData* v1, const Outp
backface = normalZDir <= 0.0f;
if ((bpmem.genMode.cullmode & 1) && !backface) // cull frontfacing
// TODO: Are these tests / the definition of backface above backwards?
if ((bpmem.genMode.cullmode == CullMode::Back || bpmem.genMode.cullmode == CullMode::All) &&
!backface) // cull frontfacing
{
INCSTAT(g_stats.this_frame.num_triangles_culled)
return false;
}
if ((bpmem.genMode.cullmode & 2) && backface) // cull backfacing
if ((bpmem.genMode.cullmode == CullMode::Front || bpmem.genMode.cullmode == CullMode::All) &&
backface) // cull backfacing
{
INCSTAT(g_stats.this_frame.num_triangles_culled)
return false;
@@ -41,12 +41,12 @@ static void SetPixelAlphaOnly(u32 offset, u8 a)
{
switch (bpmem.zcontrol.pixel_format)
{
case PEControl::RGB8_Z24:
case PEControl::Z24:
case PEControl::RGB565_Z16:
case PixelFormat::RGB8_Z24:
case PixelFormat::Z24:
case PixelFormat::RGB565_Z16:
// do nothing
break;
case PEControl::RGBA6_Z24:
case PixelFormat::RGBA6_Z24:
{
u32 a32 = a;
u32* dst = (u32*)&efb[offset];
@@ -56,8 +56,7 @@ static void SetPixelAlphaOnly(u32 offset, u8 a)
}
break;
default:
ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}",
static_cast<int>(bpmem.zcontrol.pixel_format));
ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}", bpmem.zcontrol.pixel_format);
break;
}
}
@@ -66,8 +65,8 @@ static void SetPixelColorOnly(u32 offset, u8* rgb)
{
switch (bpmem.zcontrol.pixel_format)
{
case PEControl::RGB8_Z24:
case PEControl::Z24:
case PixelFormat::RGB8_Z24:
case PixelFormat::Z24:
{
u32 src = *(u32*)rgb;
u32* dst = (u32*)&efb[offset];
@@ -76,7 +75,7 @@ static void SetPixelColorOnly(u32 offset, u8* rgb)
*dst = val;
}
break;
case PEControl::RGBA6_Z24:
case PixelFormat::RGBA6_Z24:
{
u32 src = *(u32*)rgb;
u32* dst = (u32*)&efb[offset];
@@ -87,7 +86,7 @@ static void SetPixelColorOnly(u32 offset, u8* rgb)
*dst = val;
}
break;
case PEControl::RGB565_Z16:
case PixelFormat::RGB565_Z16:
{
INFO_LOG_FMT(VIDEO, "RGB565_Z16 is not supported correctly yet");
u32 src = *(u32*)rgb;
@@ -98,8 +97,7 @@ static void SetPixelColorOnly(u32 offset, u8* rgb)
}
break;
default:
ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}",
static_cast<int>(bpmem.zcontrol.pixel_format));
ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}", bpmem.zcontrol.pixel_format);
break;
}
}
@@ -108,8 +106,8 @@ static void SetPixelAlphaColor(u32 offset, u8* color)
{
switch (bpmem.zcontrol.pixel_format)
{
case PEControl::RGB8_Z24:
case PEControl::Z24:
case PixelFormat::RGB8_Z24:
case PixelFormat::Z24:
{
u32 src = *(u32*)color;
u32* dst = (u32*)&efb[offset];
@@ -118,7 +116,7 @@ static void SetPixelAlphaColor(u32 offset, u8* color)
*dst = val;
}
break;
case PEControl::RGBA6_Z24:
case PixelFormat::RGBA6_Z24:
{
u32 src = *(u32*)color;
u32* dst = (u32*)&efb[offset];
@@ -130,7 +128,7 @@ static void SetPixelAlphaColor(u32 offset, u8* color)
*dst = val;
}
break;
case PEControl::RGB565_Z16:
case PixelFormat::RGB565_Z16:
{
INFO_LOG_FMT(VIDEO, "RGB565_Z16 is not supported correctly yet");
u32 src = *(u32*)color;
@@ -141,8 +139,7 @@ static void SetPixelAlphaColor(u32 offset, u8* color)
}
break;
default:
ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}",
static_cast<int>(bpmem.zcontrol.pixel_format));
ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}", bpmem.zcontrol.pixel_format);
break;
}
}
@@ -154,23 +151,22 @@ static u32 GetPixelColor(u32 offset)
switch (bpmem.zcontrol.pixel_format)
{
case PEControl::RGB8_Z24:
case PEControl::Z24:
case PixelFormat::RGB8_Z24:
case PixelFormat::Z24:
return 0xff | ((src & 0x00ffffff) << 8);
case PEControl::RGBA6_Z24:
case PixelFormat::RGBA6_Z24:
return Convert6To8(src & 0x3f) | // Alpha
Convert6To8((src >> 6) & 0x3f) << 8 | // Blue
Convert6To8((src >> 12) & 0x3f) << 16 | // Green
Convert6To8((src >> 18) & 0x3f) << 24; // Red
case PEControl::RGB565_Z16:
case PixelFormat::RGB565_Z16:
INFO_LOG_FMT(VIDEO, "RGB565_Z16 is not supported correctly yet");
return 0xff | ((src & 0x00ffffff) << 8);
default:
ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}",
static_cast<int>(bpmem.zcontrol.pixel_format));
ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}", bpmem.zcontrol.pixel_format);
return 0;
}
}
@@ -179,9 +175,9 @@ static void SetPixelDepth(u32 offset, u32 depth)
{
switch (bpmem.zcontrol.pixel_format)
{
case PEControl::RGB8_Z24:
case PEControl::RGBA6_Z24:
case PEControl::Z24:
case PixelFormat::RGB8_Z24:
case PixelFormat::RGBA6_Z24:
case PixelFormat::Z24:
{
u32* dst = (u32*)&efb[offset];
u32 val = *dst & 0xff000000;
@@ -189,7 +185,7 @@ static void SetPixelDepth(u32 offset, u32 depth)
*dst = val;
}
break;
case PEControl::RGB565_Z16:
case PixelFormat::RGB565_Z16:
{
INFO_LOG_FMT(VIDEO, "RGB565_Z16 is not supported correctly yet");
u32* dst = (u32*)&efb[offset];
@@ -199,8 +195,7 @@ static void SetPixelDepth(u32 offset, u32 depth)
}
break;
default:
ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}",
static_cast<int>(bpmem.zcontrol.pixel_format));
ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}", bpmem.zcontrol.pixel_format);
break;
}
}
@@ -211,59 +206,58 @@ static u32 GetPixelDepth(u32 offset)
switch (bpmem.zcontrol.pixel_format)
{
case PEControl::RGB8_Z24:
case PEControl::RGBA6_Z24:
case PEControl::Z24:
case PixelFormat::RGB8_Z24:
case PixelFormat::RGBA6_Z24:
case PixelFormat::Z24:
{
depth = (*(u32*)&efb[offset]) & 0x00ffffff;
}
break;
case PEControl::RGB565_Z16:
case PixelFormat::RGB565_Z16:
{
INFO_LOG_FMT(VIDEO, "RGB565_Z16 is not supported correctly yet");
depth = (*(u32*)&efb[offset]) & 0x00ffffff;
}
break;
default:
ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}",
static_cast<int>(bpmem.zcontrol.pixel_format));
ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}", bpmem.zcontrol.pixel_format);
break;
}
return depth;
}
static u32 GetSourceFactor(u8* srcClr, u8* dstClr, BlendMode::BlendFactor mode)
static u32 GetSourceFactor(u8* srcClr, u8* dstClr, SrcBlendFactor mode)
{
switch (mode)
{
case BlendMode::ZERO:
case SrcBlendFactor::Zero:
return 0;
case BlendMode::ONE:
case SrcBlendFactor::One:
return 0xffffffff;
case BlendMode::DSTCLR:
case SrcBlendFactor::DstClr:
return *(u32*)dstClr;
case BlendMode::INVDSTCLR:
case SrcBlendFactor::InvDstClr:
return 0xffffffff - *(u32*)dstClr;
case BlendMode::SRCALPHA:
case SrcBlendFactor::SrcAlpha:
{
u8 alpha = srcClr[ALP_C];
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
return factor;
}
case BlendMode::INVSRCALPHA:
case SrcBlendFactor::InvSrcAlpha:
{
u8 alpha = 0xff - srcClr[ALP_C];
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
return factor;
}
case BlendMode::DSTALPHA:
case SrcBlendFactor::DstAlpha:
{
u8 alpha = dstClr[ALP_C];
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
return factor;
}
case BlendMode::INVDSTALPHA:
case SrcBlendFactor::InvDstAlpha:
{
u8 alpha = 0xff - dstClr[ALP_C];
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
@@ -274,37 +268,37 @@ static u32 GetSourceFactor(u8* srcClr, u8* dstClr, BlendMode::BlendFactor mode)
return 0;
}
static u32 GetDestinationFactor(u8* srcClr, u8* dstClr, BlendMode::BlendFactor mode)
static u32 GetDestinationFactor(u8* srcClr, u8* dstClr, DstBlendFactor mode)
{
switch (mode)
{
case BlendMode::ZERO:
case DstBlendFactor::Zero:
return 0;
case BlendMode::ONE:
case DstBlendFactor::One:
return 0xffffffff;
case BlendMode::SRCCLR:
case DstBlendFactor::SrcClr:
return *(u32*)srcClr;
case BlendMode::INVSRCCLR:
case DstBlendFactor::InvSrcClr:
return 0xffffffff - *(u32*)srcClr;
case BlendMode::SRCALPHA:
case DstBlendFactor::SrcAlpha:
{
u8 alpha = srcClr[ALP_C];
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
return factor;
}
case BlendMode::INVSRCALPHA:
case DstBlendFactor::InvSrcAlpha:
{
u8 alpha = 0xff - srcClr[ALP_C];
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
return factor;
}
case BlendMode::DSTALPHA:
case DstBlendFactor::DstAlpha:
{
u8 alpha = dstClr[ALP_C] & 0xff;
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
return factor;
}
case BlendMode::INVDSTALPHA:
case DstBlendFactor::InvDstAlpha:
{
u8 alpha = 0xff - dstClr[ALP_C];
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
@@ -337,56 +331,56 @@ static void BlendColor(u8* srcClr, u8* dstClr)
}
}
static void LogicBlend(u32 srcClr, u32* dstClr, BlendMode::LogicOp op)
static void LogicBlend(u32 srcClr, u32* dstClr, LogicOp op)
{
switch (op)
{
case BlendMode::CLEAR:
case LogicOp::Clear:
*dstClr = 0;
break;
case BlendMode::AND:
case LogicOp::And:
*dstClr = srcClr & *dstClr;
break;
case BlendMode::AND_REVERSE:
case LogicOp::AndReverse:
*dstClr = srcClr & (~*dstClr);
break;
case BlendMode::COPY:
case LogicOp::Copy:
*dstClr = srcClr;
break;
case BlendMode::AND_INVERTED:
case LogicOp::AndInverted:
*dstClr = (~srcClr) & *dstClr;
break;
case BlendMode::NOOP:
case LogicOp::NoOp:
// Do nothing
break;
case BlendMode::XOR:
case LogicOp::Xor:
*dstClr = srcClr ^ *dstClr;
break;
case BlendMode::OR:
case LogicOp::Or:
*dstClr = srcClr | *dstClr;
break;
case BlendMode::NOR:
case LogicOp::Nor:
*dstClr = ~(srcClr | *dstClr);
break;
case BlendMode::EQUIV:
case LogicOp::Equiv:
*dstClr = ~(srcClr ^ *dstClr);
break;
case BlendMode::INVERT:
case LogicOp::Invert:
*dstClr = ~*dstClr;
break;
case BlendMode::OR_REVERSE:
case LogicOp::OrReverse:
*dstClr = srcClr | (~*dstClr);
break;
case BlendMode::COPY_INVERTED:
case LogicOp::CopyInverted:
*dstClr = ~srcClr;
break;
case BlendMode::OR_INVERTED:
case LogicOp::OrInverted:
*dstClr = (~srcClr) | *dstClr;
break;
case BlendMode::NAND:
case LogicOp::Nand:
*dstClr = ~(srcClr & *dstClr);
break;
case BlendMode::SET:
case LogicOp::Set:
*dstClr = 0xffffffff;
break;
}
@@ -404,7 +398,7 @@ static void SubtractBlend(u8* srcClr, u8* dstClr)
static void Dither(u16 x, u16 y, u8* color)
{
// No blending for RGB8 mode
if (!bpmem.blendmode.dither || bpmem.zcontrol.pixel_format != PEControl::PixelFormat::RGBA6_Z24)
if (!bpmem.blendmode.dither || bpmem.zcontrol.pixel_format != PixelFormat::RGBA6_Z24)
return;
// Flipper uses a standard 2x2 Bayer Matrix for 6 bit dithering
@@ -662,33 +656,33 @@ bool ZCompare(u16 x, u16 y, u32 z)
switch (bpmem.zmode.func)
{
case ZMode::NEVER:
case CompareMode::Never:
pass = false;
break;
case ZMode::LESS:
case CompareMode::Less:
pass = z < depth;
break;
case ZMode::EQUAL:
case CompareMode::Equal:
pass = z == depth;
break;
case ZMode::LEQUAL:
case CompareMode::LEqual:
pass = z <= depth;
break;
case ZMode::GREATER:
case CompareMode::Greater:
pass = z > depth;
break;
case ZMode::NEQUAL:
case CompareMode::NEqual:
pass = z != depth;
break;
case ZMode::GEQUAL:
case CompareMode::GEqual:
pass = z >= depth;
break;
case ZMode::ALWAYS:
case CompareMode::Always:
pass = true;
break;
default:
pass = false;
ERROR_LOG_FMT(VIDEO, "Bad Z compare mode {}", static_cast<int>(bpmem.zmode.func));
ERROR_LOG_FMT(VIDEO, "Bad Z compare mode {}", bpmem.zmode.func);
break;
}
@@ -173,7 +173,7 @@ static inline void CalculateLOD(s32* lodp, bool* linear, u32 texmap, u32 texcoor
const TexMode1& tm1 = texUnit.texMode1[subTexmap];
float sDelta, tDelta;
if (tm0.diag_lod)
if (tm0.diag_lod == LODType::Diagonal)
{
float* uv0 = rasterBlock.Pixel[0][0].Uv[texcoord];
float* uv1 = rasterBlock.Pixel[1][1].Uv[texcoord];
@@ -199,7 +199,8 @@ static inline void CalculateLOD(s32* lodp, bool* linear, u32 texmap, u32 texcoor
bias >>= 1;
lod += bias;
*linear = ((lod > 0 && (tm0.min_filter & 4)) || (lod <= 0 && tm0.mag_filter));
*linear = ((lod > 0 && tm0.min_filter == FilterMode::Linear) ||
(lod <= 0 && tm0.mag_filter == FilterMode::Linear));
// NOTE: The order of comparisons for this clamp check matters.
if (lod > static_cast<s32>(tm1.max_lod))
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -57,7 +57,7 @@ class Tev
INDIRECT = 32
};
void SetRasColor(int colorChan, int swaptable);
void SetRasColor(RasColorChan colorChan, int swaptable);
void DrawColorRegular(const TevStageCombiner::ColorCombiner& cc, const InputRegType inputs[4]);
void DrawColorCompare(const TevStageCombiner::ColorCombiner& cc, const InputRegType inputs[4]);
@@ -504,7 +504,7 @@ static void EncodeRGBA6(u8* dst, const u8* src, EFBCopyFormat format, bool yuv)
break;
default:
PanicAlertFmt("Unknown texture copy format: {:#x}\n", format);
PanicAlertFmt("Unknown texture copy format: {}\n", format);
break;
}
}
@@ -743,7 +743,7 @@ static void EncodeRGBA6halfscale(u8* dst, const u8* src, EFBCopyFormat format, b
break;
default:
PanicAlertFmt("Unknown texture copy format: {:#x}\n", format);
PanicAlertFmt("Unknown texture copy format: {}\n", format);
break;
}
}
@@ -960,7 +960,7 @@ static void EncodeRGB8(u8* dst, const u8* src, EFBCopyFormat format, bool yuv)
break;
default:
PanicAlertFmt("Unknown texture copy format: {:#x}\n", format);
PanicAlertFmt("Unknown texture copy format: {}\n", format);
break;
}
}
@@ -1192,7 +1192,7 @@ static void EncodeRGB8halfscale(u8* dst, const u8* src, EFBCopyFormat format, bo
break;
default:
PanicAlertFmt("Unknown texture copy format: {:#x}\n", format);
PanicAlertFmt("Unknown texture copy format: {}\n", format);
break;
}
}
@@ -1300,7 +1300,7 @@ static void EncodeZ24(u8* dst, const u8* src, EFBCopyFormat format)
break;
default:
PanicAlertFmt("Unknown texture copy format: {:#x}\n", format);
PanicAlertFmt("Unknown texture copy format: {}\n", format);
break;
}
}
@@ -1414,7 +1414,7 @@ static void EncodeZ24halfscale(u8* dst, const u8* src, EFBCopyFormat format)
break;
default:
PanicAlertFmt("Unknown texture copy format: {:#x}\n", format);
PanicAlertFmt("Unknown texture copy format: {}\n", format);
break;
}
}
@@ -1431,16 +1431,16 @@ void EncodeEfbCopy(u8* dst, const EFBCopyParams& params, u32 native_width, u32 b
{
switch (params.efb_format)
{
case PEControl::RGBA6_Z24:
case PixelFormat::RGBA6_Z24:
EncodeRGBA6halfscale(dst, src, params.copy_format, params.yuv);
break;
case PEControl::RGB8_Z24:
case PixelFormat::RGB8_Z24:
EncodeRGB8halfscale(dst, src, params.copy_format, params.yuv);
break;
case PEControl::RGB565_Z16:
case PixelFormat::RGB565_Z16:
EncodeRGB8halfscale(dst, src, params.copy_format, params.yuv);
break;
case PEControl::Z24:
case PixelFormat::Z24:
EncodeZ24halfscale(dst, src, params.copy_format);
break;
default:
@@ -1451,16 +1451,16 @@ void EncodeEfbCopy(u8* dst, const EFBCopyParams& params, u32 native_width, u32 b
{
switch (params.efb_format)
{
case PEControl::RGBA6_Z24:
case PixelFormat::RGBA6_Z24:
EncodeRGBA6(dst, src, params.copy_format, params.yuv);
break;
case PEControl::RGB8_Z24:
case PixelFormat::RGB8_Z24:
EncodeRGB8(dst, src, params.copy_format, params.yuv);
break;
case PEControl::RGB565_Z16:
case PixelFormat::RGB565_Z16:
EncodeRGB8(dst, src, params.copy_format, params.yuv);
break;
case PEControl::Z24:
case PixelFormat::Z24:
EncodeZ24(dst, src, params.copy_format);
break;
default:
@@ -8,6 +8,7 @@
#include <cmath>
#include "Common/CommonTypes.h"
#include "Common/MsgHandler.h"
#include "Core/HW/Memmap.h"
#include "VideoCommon/BPMemory.h"
@@ -18,27 +19,29 @@
namespace TextureSampler
{
static inline void WrapCoord(int* coordp, int wrapMode, int imageSize)
static inline void WrapCoord(int* coordp, WrapMode wrapMode, int imageSize)
{
int coord = *coordp;
switch (wrapMode)
{
case 0: // clamp
case WrapMode::Clamp:
coord = (coord > imageSize) ? imageSize : (coord < 0) ? 0 : coord;
break;
case 1: // wrap
case WrapMode::Repeat:
coord = coord % (imageSize + 1);
coord = (coord < 0) ? imageSize + coord : coord;
break;
case 2: // mirror
case WrapMode::Mirror:
{
const int sizePlus1 = imageSize + 1;
const int div = coord / sizePlus1;
coord = coord - (div * sizePlus1);
coord = (coord < 0) ? -coord : coord;
coord = (div & 1) ? imageSize - coord : coord;
break;
}
break;
default:
PanicAlertFmt("Invalid wrap mode: {}", wrapMode);
}
*coordp = coord;
}
@@ -74,10 +77,11 @@ void Sample(s32 s, s32 t, s32 lod, bool linear, u8 texmap, u8* sample)
{
// use mipmap
baseMip = lod >> 4;
mipLinear = (lodFract && tm0.min_filter & TexMode0::TEXF_LINEAR);
mipLinear = (lodFract && tm0.mipmap_filter == MipMode::Linear);
// if using nearest mip filter and lodFract >= 0.5 round up to next mip
baseMip += (lodFract >> 3) & (tm0.min_filter & TexMode0::TEXF_POINT);
if (tm0.mipmap_filter == MipMode::Point && lodFract >= 8)
baseMip++;
}
if (mipLinear)
@@ -111,12 +115,12 @@ void SampleMip(s32 s, s32 t, s32 mip, bool linear, u8 texmap, u8* sample)
const TexMode0& tm0 = texUnit.texMode0[subTexmap];
const TexImage0& ti0 = texUnit.texImage0[subTexmap];
const TexTLUT& texTlut = texUnit.texTlut[subTexmap];
const TextureFormat texfmt = static_cast<TextureFormat>(ti0.format);
const TLUTFormat tlutfmt = static_cast<TLUTFormat>(texTlut.tlut_format);
const TextureFormat texfmt = ti0.format;
const TLUTFormat tlutfmt = texTlut.tlut_format;
const u8* imageSrc;
const u8* imageSrcOdd = nullptr;
if (texUnit.texImage1[subTexmap].image_type)
if (texUnit.texImage1[subTexmap].cache_manually_managed)
{
imageSrc = &texMem[texUnit.texImage1[subTexmap].tmem_even * TMEM_LINE_SIZE];
if (texfmt == TextureFormat::RGBA8)
@@ -188,7 +192,7 @@ void SampleMip(s32 s, s32 t, s32 mip, bool linear, u8 texmap, u8* sample)
WrapCoord(&imageSPlus1, tm0.wrap_s, imageWidth);
WrapCoord(&imageTPlus1, tm0.wrap_t, imageHeight);
if (!(texfmt == TextureFormat::RGBA8 && texUnit.texImage1[subTexmap].image_type))
if (!(texfmt == TextureFormat::RGBA8 && texUnit.texImage1[subTexmap].cache_manually_managed))
{
TexDecoder_DecodeTexel(sampledTex, imageSrc, imageS, imageT, imageWidth, texfmt, tlut,
tlutfmt);
@@ -240,7 +244,7 @@ void SampleMip(s32 s, s32 t, s32 mip, bool linear, u8 texmap, u8* sample)
WrapCoord(&imageS, tm0.wrap_s, imageWidth);
WrapCoord(&imageT, tm0.wrap_t, imageHeight);
if (!(texfmt == TextureFormat::RGBA8 && texUnit.texImage1[subTexmap].image_type))
if (!(texfmt == TextureFormat::RGBA8 && texUnit.texImage1[subTexmap].cache_manually_managed))
TexDecoder_DecodeTexel(sample, imageSrc, imageS, imageT, imageWidth, texfmt, tlut, tlutfmt);
else
TexDecoder_DecodeTexelRGBA8FromTmem(sample, imageSrc, imageSrcOdd, imageS, imageT,