[Glide64] Sync texture code

This commit is contained in:
zilmar 2015-10-21 07:49:29 +11:00
parent 11ebb4e761
commit 57cf720392
3 changed files with 1001 additions and 2668 deletions

View File

@ -37,165 +37,131 @@
// //
//**************************************************************** //****************************************************************
extern "C" void __declspec(naked) asmLoad16bRGBA (wxUIntPtr src, wxUIntPtr dst, int wid_64, int height, int line, int ext) static inline void load16bRGBA(uint8_t *src, uint8_t *dst, int wid_64, int height, int line, int ext)
{ {
_asm { uint32_t *v6;
align 4 uint32_t *v7;
push ebp int v8;
mov ebp,esp int v9;
push ebx uint32_t v10;
push esi uint32_t v11;
push edi uint32_t *v12;
uint32_t *v13;
int v14;
uint32_t v15;
uint32_t v16;
int v17;
int v18;
mov esi,[src] v6 = (uint32_t *)src;
mov edi,[dst] v7 = (uint32_t *)dst;
mov ecx,[height] v8 = height;
y_loop: do
push ecx {
mov ecx,[wid_64] v17 = v8;
x_loop: v9 = wid_64;
mov eax,[esi] // read both pixels do
mov ebx,[esi+4] // read both pixels {
bswap eax v10 = bswap32(*v6);
bswap ebx v11 = bswap32(v6[1]);
ALOWORD(v10) = __ROR__((uint16_t)v10, 1);
ror ax,1 ALOWORD(v11) = __ROR__((uint16_t)v11, 1);
ror bx,1 v10 = __ROR__(v10, 16);
ror eax,16 v11 = __ROR__(v11, 16);
ror ebx,16 ALOWORD(v10) = __ROR__((uint16_t)v10, 1);
ror ax,1 ALOWORD(v11) = __ROR__((uint16_t)v11, 1);
ror bx,1 *v7 = v10;
v7[1] = v11;
mov [edi],eax v6 += 2;
mov [edi+4],ebx v7 += 2;
add esi,8 --v9;
add edi,8 }
while ( v9 );
dec ecx if ( v17 == 1 )
jnz x_loop break;
v18 = v17 - 1;
pop ecx v12 = (uint32_t *)&src[(line + (uintptr_t)v6 - (uintptr_t)src) & 0xFFF];
dec ecx v13 = (uint32_t *)((char *)v7 + ext);
jz end_y_loop v14 = wid_64;
push ecx do
{
mov eax,esi v15 = bswap32(v12[1]);
add eax,[line] v16 = bswap32(*v12);
mov esi,[src] ALOWORD(v15) = __ROR__((uint16_t)v15, 1);
sub eax, esi ALOWORD(v16) = __ROR__((uint16_t)v16, 1);
and eax, 0xFFF v15 = __ROR__(v15, 16);
add esi, eax v16 = __ROR__(v16, 16);
add edi,[ext] ALOWORD(v15) = __ROR__((uint16_t)v15, 1);
ALOWORD(v16) = __ROR__((uint16_t)v16, 1);
mov ecx,[wid_64] *v13 = v15;
x_loop_2: v13[1] = v16;
mov eax,[esi+4] // read both pixels v12 += 2;
mov ebx,[esi] // read both pixels v13 += 2;
bswap eax --v14;
bswap ebx }
while ( v14 );
ror ax,1 v6 = (uint32_t *)&src[(line + (uintptr_t)v12 - (uintptr_t)src) & 0xFFF];
ror bx,1 v7 = (uint32_t *)((char *)v13 + ext);
ror eax,16 v8 = v18 - 1;
ror ebx,16 }
ror ax,1 while ( v18 != 1 );
ror bx,1
mov [edi],eax
mov [edi+4],ebx
add esi,8
add edi,8
dec ecx
jnz x_loop_2
mov eax,esi
add eax,[line]
mov esi,[src]
sub eax, esi
and eax, 0xFFF
add esi, eax
add edi,[ext]
pop ecx
dec ecx
jnz y_loop
end_y_loop:
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
}
} }
extern "C" void __declspec(naked) asmLoad16bIA (wxUIntPtr src, wxUIntPtr dst, int wid_64, int height, int line, int ext) static inline void load16bIA(uint8_t *src, uint8_t *dst, int wid_64, int height, int line, int ext)
{ {
_asm { uint32_t *v6;
ALIGN 4 uint32_t *v7;
int v8;
int v9;
uint32_t v10;
uint32_t *v11;
uint32_t *v12;
int v13;
uint32_t v14;
int v15;
int v16;
push ebp v6 = (uint32_t *)src;
mov ebp, esp v7 = (uint32_t *)dst;
push ebx v8 = height;
push esi do
push edi {
v15 = v8;
mov esi,[src] v9 = wid_64;
mov edi,[dst] do
mov ecx,[height] {
y_loop: v10 = v6[1];
push ecx *v7 = *v6;
mov ecx,[wid_64] v7[1] = v10;
x_loop: v6 += 2;
mov eax,[esi] // read both pixels v7 += 2;
mov ebx,[esi+4] // read both pixels --v9;
mov [edi],eax }
mov [edi+4],ebx while ( v9 );
add esi,8 if ( v15 == 1 )
add edi,8 break;
v16 = v15 - 1;
dec ecx v11 = (uint32_t *)((char *)v6 + line);
jnz x_loop v12 = (uint32_t *)((char *)v7 + ext);
v13 = wid_64;
pop ecx do
dec ecx {
jz end_y_loop v14 = *v11;
push ecx *v12 = v11[1];
v12[1] = v14;
add esi,[line] v11 += 2;
add edi,[ext] v12 += 2;
--v13;
mov ecx,[wid_64] }
x_loop_2: while ( v13 );
mov eax,[esi+4] // read both pixels v6 = (uint32_t *)((char *)v11 + line);
mov ebx,[esi] // read both pixels v7 = (uint32_t *)((char *)v12 + ext);
mov [edi],eax v8 = v16 - 1;
mov [edi+4],ebx }
add esi,8 while ( v16 != 1 );
add edi,8
dec ecx
jnz x_loop_2
add esi,[line]
add edi,[ext]
pop ecx
dec ecx
jnz y_loop
end_y_loop:
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
}
} }
//**************************************************************** //****************************************************************
// Size: 2, Format: 0 // Size: 2, Format: 0
// //
@ -206,7 +172,7 @@ wxUint32 Load16bRGBA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int
if (height < 1) height = 1; if (height < 1) height = 1;
int ext = (real_width - (wid_64 << 2)) << 1; int ext = (real_width - (wid_64 << 2)) << 1;
asmLoad16bRGBA(src, dst, wid_64, height, line, ext); load16bRGBA((uint8_t *)src, (uint8_t *)dst, wid_64, height, line, ext);
return (1 << 16) | GR_TEXFMT_ARGB_1555; return (1 << 16) | GR_TEXFMT_ARGB_1555;
} }
@ -221,7 +187,7 @@ wxUint32 Load16bIA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int li
if (height < 1) height = 1; if (height < 1) height = 1;
int ext = (real_width - (wid_64 << 2)) << 1; int ext = (real_width - (wid_64 << 2)) << 1;
asmLoad16bIA(src, dst, wid_64, height, line, ext); load16bIA((uint8_t *)src, (uint8_t *)dst, wid_64, height, line, ext);
return (1 << 16) | GR_TEXFMT_ALPHA_INTENSITY_88; return (1 << 16) | GR_TEXFMT_ALPHA_INTENSITY_88;
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff