1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-13 16:44:50 +02:00

#368 GBA TEX_2PX akill texturing, fix FTA/GTA unaligned VRAM write

This commit is contained in:
XProger
2022-01-21 04:24:52 +03:00
parent 2d6d994590
commit 2c8f55a22b
3 changed files with 27 additions and 17 deletions

View File

@@ -60,6 +60,7 @@ SP_RDX = 8
SP_RDT = 12
.macro PUT_PIXELS
#ifndef TEX_2PX
tex indexA, t
add t, dtdx
@@ -75,6 +76,14 @@ SP_RDT = 12
orrne indexA, indexB, lsl #8
strneh indexA, [tmp]
add tmp, #2
#else
tex indexA, t
add t, dtdx, lsl #1
cmp indexA, #0
ldrneb indexA, [LMAP, indexA]
strneb indexA, [tmp]
add tmp, #2
#endif
.endm
.global rasterizeFTA_asm
@@ -215,12 +224,11 @@ rasterizeFTA_asm:
ldrb indexA, [TILE, indexA]
cmp indexA, #0
ldrneb indexB, [tmp, #-1] // read pal index from VRAM (byte)
ldrneb indexB, [tmp, #-1]! // read pal index from VRAM (byte)
ldrneb indexA, [LMAP, indexA]
orrne indexB, indexA, lsl #8
strneh indexB, [tmp]
add tmp, #1
strneh indexB, [tmp], #2
addeq tmp, #1
add t, dtdx
subs width, #1 // width--
@@ -240,7 +248,8 @@ rasterizeFTA_asm:
ldrneb indexA, [LMAP, indexA]
ldrneb indexB, [tmp, width]
orrne indexB, indexA, indexB, lsl #8
strneh indexB, [tmp, width]
addne indexA, tmp, width
strneh indexB, [indexA, #-1]
subs width, #1 // width--
beq .scanline_end // if (width == 0)

View File

@@ -88,6 +88,7 @@ SP_RDT = 20
bic LMAP, g, #255
add g, dgdx
#ifndef TEX_2PX
tex indexA, t
add t, dtdx
@@ -102,6 +103,14 @@ SP_RDT = 20
ldrneb indexB, [LMAP, indexB, lsr #8]
orrne indexA, indexB, lsl #8
strneh indexA, [ptr]
#else
tex indexA, t
add t, dtdx, lsl #1
cmp indexA, #0
ldrneb indexA, [LMAP, indexA]
strneb indexA, [ptr]
#endif
add ptr, #2
.endm
@@ -270,9 +279,9 @@ rasterizeGTA_asm:
bic LMAP, g, #255
ldrb indexA, [LMAP, indexA]
ldrb indexB, [ptr, #-1] // read pal index from VRAM (byte)
ldrb indexB, [ptr, #-1]! // read pal index from VRAM (byte)
orr indexB, indexA, lsl #8
strh indexB, [ptr]
strh indexB, [ptr], #1
.skip_left:
add ptr, #1

View File

@@ -121,18 +121,10 @@ transformMesh_asm:
add y, y, #(FRAME_HEIGHT >> 1)
// store the result
#if 1
// 2+2+2+2 = 8 ticks
strh x, [res], #2
strh y, [res], #2
strh z, [res], #2
strh vg, [res], #2
#else
// 1+1+3 = 5 ticks SLOWER! WTF?
orr x, x, y, lsl #16
orr z, z, vg, lsl #16
stmia res!, {x, z}
#endif
subs count, #1
bne .loop