summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Software/TextureSampler.cpp
diff options
context:
space:
mode:
authorshuffle2 <godisgovernment@gmail.com>2014-09-04 19:37:49 -0700
committershuffle2 <godisgovernment@gmail.com>2014-09-04 19:37:49 -0700
commita9a62709825c7b9dac7d7cf2f1a3fb9ee6678aa5 (patch)
tree3b9e6783cc95b0f49d2956ff21c5097db0840721 /Source/Core/VideoBackends/Software/TextureSampler.cpp
parentfb3a668767b37724dede9e5f7eb60b5d0f2b6455 (diff)
parent76b4dbdf2895e36e7bc993728b01f20711d5b111 (diff)
Merge pull request #774 from magcius/texdecode-cleanup
Clean up the TextureDecoder and some related things
Diffstat (limited to 'Source/Core/VideoBackends/Software/TextureSampler.cpp')
-rw-r--r--Source/Core/VideoBackends/Software/TextureSampler.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/Source/Core/VideoBackends/Software/TextureSampler.cpp b/Source/Core/VideoBackends/Software/TextureSampler.cpp
index 60cd2da972..cc90f11ae2 100644
--- a/Source/Core/VideoBackends/Software/TextureSampler.cpp
+++ b/Source/Core/VideoBackends/Software/TextureSampler.cpp
@@ -106,6 +106,7 @@ void SampleMip(s32 s, s32 t, s32 mip, bool linear, u8 texmap, u8 *sample)
TexMode0& tm0 = texUnit.texMode0[subTexmap];
TexImage0& ti0 = texUnit.texImage0[subTexmap];
TexTLUT& texTlut = texUnit.texTlut[subTexmap];
+ TlutFormat tlutfmt = (TlutFormat) texTlut.tlut_format;
u8 *imageSrc, *imageSrcOdd = nullptr;
if (texUnit.texImage1[subTexmap].image_type)
@@ -124,6 +125,7 @@ void SampleMip(s32 s, s32 t, s32 mip, bool linear, u8 texmap, u8 *sample)
int imageHeight = ti0.height;
int tlutAddress = texTlut.tmem_offset << 9;
+ const u8* tlut = &texMem[tlutAddress];
// reduce sample location and texture size to mip level
// move texture pointer to mip location
@@ -181,16 +183,16 @@ void SampleMip(s32 s, s32 t, s32 mip, bool linear, u8 texmap, u8 *sample)
if (!(ti0.format == GX_TF_RGBA8 && texUnit.texImage1[subTexmap].image_type))
{
- TexDecoder_DecodeTexel(sampledTex, imageSrc, imageS, imageT, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format);
+ TexDecoder_DecodeTexel(sampledTex, imageSrc, imageS, imageT, imageWidth, ti0.format, tlut, tlutfmt);
SetTexel(sampledTex, texel, (128 - fractS) * (128 - fractT));
- TexDecoder_DecodeTexel(sampledTex, imageSrc, imageSPlus1, imageT, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format);
+ TexDecoder_DecodeTexel(sampledTex, imageSrc, imageSPlus1, imageT, imageWidth, ti0.format, tlut, tlutfmt);
AddTexel(sampledTex, texel, (fractS) * (128 - fractT));
- TexDecoder_DecodeTexel(sampledTex, imageSrc, imageS, imageTPlus1, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format);
+ TexDecoder_DecodeTexel(sampledTex, imageSrc, imageS, imageTPlus1, imageWidth, ti0.format, tlut, tlutfmt);
AddTexel(sampledTex, texel, (128 - fractS) * (fractT));
- TexDecoder_DecodeTexel(sampledTex, imageSrc, imageSPlus1, imageTPlus1, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format);
+ TexDecoder_DecodeTexel(sampledTex, imageSrc, imageSPlus1, imageTPlus1, imageWidth, ti0.format, tlut, tlutfmt);
AddTexel(sampledTex, texel, (fractS) * (fractT));
}
else
@@ -224,7 +226,7 @@ void SampleMip(s32 s, s32 t, s32 mip, bool linear, u8 texmap, u8 *sample)
WrapCoord(imageT, tm0.wrap_t, imageHeight);
if (!(ti0.format == GX_TF_RGBA8 && texUnit.texImage1[subTexmap].image_type))
- TexDecoder_DecodeTexel(sample, imageSrc, imageS, imageT, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format);
+ TexDecoder_DecodeTexel(sample, imageSrc, imageS, imageT, imageWidth, ti0.format, tlut, tlutfmt);
else
TexDecoder_DecodeTexelRGBA8FromTmem(sample, imageSrc, imageSrcOdd, imageS, imageT, imageWidth);
}