mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-12-06 12:43:35 +01:00
Merge pull request #14928 from JosJuice/neon-texture-decoder
VideoCommon: Add TextureDecoder_ARM64.cpp
This commit is contained in:
6 files changed
+852
-24
No files matched your search
@@ -359,7 +359,7 @@ static inline u32 DecodePixel_Paletted(u16 pixel, TLUTFormat tlutfmt)
|
||||
}
|
||||
}
|
||||
|
||||
void TexDecoder_DecodeTexel(u8* dst, std::span<const u8> src, int s, int t, int imageWidth,
|
||||
void TexDecoder_DecodeTexel(u8* dst, std::span<const u8> src, int s, int t, int image_width_minus_1,
|
||||
TextureFormat texformat, std::span<const u8> tlut_, TLUTFormat tlutfmt)
|
||||
{
|
||||
/* General formula for computing texture offset
|
||||
@@ -379,7 +379,7 @@ void TexDecoder_DecodeTexel(u8* dst, std::span<const u8> src, int s, int t, int
|
||||
{
|
||||
u16 sBlk = s >> 3;
|
||||
u16 tBlk = t >> 3;
|
||||
u16 widthBlks = (imageWidth >> 3) + 1;
|
||||
u16 widthBlks = (image_width_minus_1 >> 3) + 1;
|
||||
u32 base = (tBlk * widthBlks + sBlk) << 5;
|
||||
u16 blkS = s & 7;
|
||||
u16 blkT = t & 7;
|
||||
@@ -398,7 +398,7 @@ void TexDecoder_DecodeTexel(u8* dst, std::span<const u8> src, int s, int t, int
|
||||
{
|
||||
u16 sBlk = s >> 3;
|
||||
u16 tBlk = t >> 3;
|
||||
u16 widthBlks = (imageWidth >> 3) + 1;
|
||||
u16 widthBlks = (image_width_minus_1 >> 3) + 1;
|
||||
u32 base = (tBlk * widthBlks + sBlk) << 5;
|
||||
u16 blkS = s & 7;
|
||||
u16 blkT = t & 7;
|
||||
@@ -419,7 +419,7 @@ void TexDecoder_DecodeTexel(u8* dst, std::span<const u8> src, int s, int t, int
|
||||
{
|
||||
u16 sBlk = s >> 3;
|
||||
u16 tBlk = t >> 2;
|
||||
u16 widthBlks = (imageWidth >> 3) + 1;
|
||||
u16 widthBlks = (image_width_minus_1 >> 3) + 1;
|
||||
u32 base = (tBlk * widthBlks + sBlk) << 5;
|
||||
u16 blkS = s & 7;
|
||||
u16 blkT = t & 3;
|
||||
@@ -436,7 +436,7 @@ void TexDecoder_DecodeTexel(u8* dst, std::span<const u8> src, int s, int t, int
|
||||
{
|
||||
u16 sBlk = s >> 3;
|
||||
u16 tBlk = t >> 2;
|
||||
u16 widthBlks = (imageWidth >> 3) + 1;
|
||||
u16 widthBlks = (image_width_minus_1 >> 3) + 1;
|
||||
u32 base = (tBlk * widthBlks + sBlk) << 5;
|
||||
u16 blkS = s & 7;
|
||||
u16 blkT = t & 3;
|
||||
@@ -452,7 +452,7 @@ void TexDecoder_DecodeTexel(u8* dst, std::span<const u8> src, int s, int t, int
|
||||
{
|
||||
u16 sBlk = s >> 3;
|
||||
u16 tBlk = t >> 2;
|
||||
u16 widthBlks = (imageWidth >> 3) + 1;
|
||||
u16 widthBlks = (image_width_minus_1 >> 3) + 1;
|
||||
u32 base = (tBlk * widthBlks + sBlk) << 5;
|
||||
u16 blkS = s & 7;
|
||||
u16 blkT = t & 3;
|
||||
@@ -471,7 +471,7 @@ void TexDecoder_DecodeTexel(u8* dst, std::span<const u8> src, int s, int t, int
|
||||
{
|
||||
u16 sBlk = s >> 2;
|
||||
u16 tBlk = t >> 2;
|
||||
u16 widthBlks = (imageWidth >> 2) + 1;
|
||||
u16 widthBlks = (image_width_minus_1 >> 2) + 1;
|
||||
u32 base = (tBlk * widthBlks + sBlk) << 4;
|
||||
u16 blkS = s & 3;
|
||||
u16 blkT = t & 3;
|
||||
@@ -487,7 +487,7 @@ void TexDecoder_DecodeTexel(u8* dst, std::span<const u8> src, int s, int t, int
|
||||
{
|
||||
u16 sBlk = s >> 2;
|
||||
u16 tBlk = t >> 2;
|
||||
u16 widthBlks = (imageWidth >> 2) + 1;
|
||||
u16 widthBlks = (image_width_minus_1 >> 2) + 1;
|
||||
u32 base = (tBlk * widthBlks + sBlk) << 4;
|
||||
u16 blkS = s & 3;
|
||||
u16 blkT = t & 3;
|
||||
@@ -504,7 +504,7 @@ void TexDecoder_DecodeTexel(u8* dst, std::span<const u8> src, int s, int t, int
|
||||
{
|
||||
u16 sBlk = s >> 2;
|
||||
u16 tBlk = t >> 2;
|
||||
u16 widthBlks = (imageWidth >> 2) + 1;
|
||||
u16 widthBlks = (image_width_minus_1 >> 2) + 1;
|
||||
u32 base = (tBlk * widthBlks + sBlk) << 4;
|
||||
u16 blkS = s & 3;
|
||||
u16 blkT = t & 3;
|
||||
@@ -520,7 +520,7 @@ void TexDecoder_DecodeTexel(u8* dst, std::span<const u8> src, int s, int t, int
|
||||
{
|
||||
u16 sBlk = s >> 2;
|
||||
u16 tBlk = t >> 2;
|
||||
u16 widthBlks = (imageWidth >> 2) + 1;
|
||||
u16 widthBlks = (image_width_minus_1 >> 2) + 1;
|
||||
u32 base = (tBlk * widthBlks + sBlk) << 4;
|
||||
u16 blkS = s & 3;
|
||||
u16 blkT = t & 3;
|
||||
@@ -536,7 +536,7 @@ void TexDecoder_DecodeTexel(u8* dst, std::span<const u8> src, int s, int t, int
|
||||
{
|
||||
u16 sBlk = s >> 2;
|
||||
u16 tBlk = t >> 2;
|
||||
u16 widthBlks = (imageWidth >> 2) + 1;
|
||||
u16 widthBlks = (image_width_minus_1 >> 2) + 1;
|
||||
u32 base = (tBlk * widthBlks + sBlk) << 5; // shift by 5 is correct
|
||||
u16 blkS = s & 3;
|
||||
u16 blkT = t & 3;
|
||||
@@ -557,7 +557,7 @@ void TexDecoder_DecodeTexel(u8* dst, std::span<const u8> src, int s, int t, int
|
||||
|
||||
u16 sBlk = sDxt >> 1;
|
||||
u16 tBlk = tDxt >> 1;
|
||||
u16 widthBlks = (imageWidth >> 3) + 1;
|
||||
u16 widthBlks = (image_width_minus_1 >> 3) + 1;
|
||||
u32 base = (tBlk * widthBlks + sBlk) << 2;
|
||||
u16 blkS = sDxt & 1;
|
||||
u16 blkT = tDxt & 1;
|
||||
@@ -622,7 +622,7 @@ void TexDecoder_DecodeTexel(u8* dst, std::span<const u8> src, int s, int t, int
|
||||
break;
|
||||
case TextureFormat::XFB:
|
||||
{
|
||||
size_t offset = (t * imageWidth + (s & (~1))) * 2;
|
||||
size_t offset = (t * image_width_minus_1 + (s & (~1))) * 2;
|
||||
|
||||
// We do this one color sample (aka 2 RGB pixles) at a time
|
||||
int Y = int((s & 1) == 0 ? src[offset] : src[offset + 2]) - 16;
|
||||
@@ -636,19 +636,19 @@ void TexDecoder_DecodeTexel(u8* dst, std::span<const u8> src, int s, int t, int
|
||||
u8 R = std::clamp(int(1.164f * Y + 1.596f * V), 0, 255);
|
||||
u8 G = std::clamp(int(1.164f * Y - 0.392f * U - 0.813f * V), 0, 255);
|
||||
u8 B = std::clamp(int(1.164f * Y + 2.017f * U), 0, 255);
|
||||
dst[t * imageWidth + s] = 0xff000000 | B << 16 | G << 8 | R;
|
||||
dst[t * image_width_minus_1 + s] = 0xff000000 | B << 16 | G << 8 | R;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void TexDecoder_DecodeTexelRGBA8FromTmem(u8* dst, std::span<const u8> src_ar,
|
||||
std::span<const u8> src_gb, int s, int t, int imageWidth)
|
||||
std::span<const u8> src_gb, int s, int t,
|
||||
int image_width_minus_1)
|
||||
{
|
||||
u16 sBlk = s >> 2;
|
||||
u16 tBlk = t >> 2;
|
||||
u16 widthBlks =
|
||||
(imageWidth >> 2) + 1; // TODO: Looks wrong. Shouldn't this be ((imageWidth-1)>>2)+1 ?
|
||||
u16 widthBlks = (image_width_minus_1 >> 2) + 1;
|
||||
u32 base_ar = (tBlk * widthBlks + sBlk) << 4;
|
||||
u32 base_gb = (tBlk * widthBlks + sBlk) << 4;
|
||||
u16 blkS = s & 3;
|
||||
@@ -665,12 +665,11 @@ void TexDecoder_DecodeTexelRGBA8FromTmem(u8* dst, std::span<const u8> src_ar,
|
||||
}
|
||||
|
||||
void TexDecoder_DecodeTexelRGBA8FromTmem(u8* dst, const u8* src_ar, const u8* src_gb, int s, int t,
|
||||
int imageWidth)
|
||||
int image_width_minus_1)
|
||||
{
|
||||
u16 sBlk = s >> 2;
|
||||
u16 tBlk = t >> 2;
|
||||
u16 widthBlks =
|
||||
(imageWidth >> 2) + 1; // TODO: Looks wrong. Shouldn't this be ((imageWidth-1)>>2)+1 ?
|
||||
u16 widthBlks = (image_width_minus_1 >> 2) + 1;
|
||||
u32 base_ar = (tBlk * widthBlks + sBlk) << 4;
|
||||
u32 base_gb = (tBlk * widthBlks + sBlk) << 4;
|
||||
u16 blkS = s & 3;
|
||||
|
||||
Reference in new issue
Block a user