Dreamcast: Slightly optimise clipping by avoiding colour interpolation unless necessary

This commit is contained in:
UnknownShadow200 2024-08-10 10:08:06 +10:00
parent b491c48cef
commit 1b48ce3fe3
3 changed files with 17 additions and 4 deletions

View File

@ -123,10 +123,15 @@ _ClipLine:
add #-4, OUT ! EX, OUT -= 4
mov.l @IN1,CL1 ! LS, ACOLOR = v1->bgra
mov.l @IN2,CL2 ! LS, BCOLOR = v2->bgra
! Bypass interpolation if unnecessary
cmp/eq CL1,CL2 ! MT, T = ACOLOR == BCOLOR
bt.s 1f ! BR, if (T) goto 1;
mov CL1,CLO ! MT, OUTCOLOR = ACOLOR (branch delay instruction)
extu.b CL1,TM1 ! EX, val = ACOLOR.b
lds TM1,fpul ! CO, FPUL = val
float fpul,fr2 ! EX, fr2 = float(FPUL)
mov.l @IN2,CL2 ! LS, BCOLOR = v2->bgra
extu.b CL2,TM1 ! EX, val = BCOLOR.b
lds TM1,fpul ! CO, FPUL = val
float fpul,fr3 ! EX, fr3 = float(FPUL)
@ -181,8 +186,9 @@ _ClipLine:
shll16 TM2 ! EX, tmp <<= 16
shll8 TM2 ! EX, tmp <<= 8
or TM2,CLO ! EX, OUTCOLOR.a |= tmp
mov.l CLO,@OUT ! LS, OUT->color = OUTCOLOR
1:
mov.l CLO,@OUT ! LS, OUT->color = OUTCOLOR
mov.l @r15+,r5 ! LS, pop(r5)
rts ! CO, return after executing instruction in delay slot
mov.l @r15+,r4 ! LS, pop(r4)

View File

@ -121,10 +121,15 @@ _ClipEdge:
add #-4, OUT ! EX, OUT -= 4
mov.l @IN1,CL1 ! LS, ACOLOR = v1->bgra
mov.l @IN2,CL2 ! LS, BCOLOR = v2->bgra
! Bypass interpolation if unnecessary
cmp/eq CL1,CL2 ! MT, T = ACOLOR == BCOLOR
bt.s 1f ! BR, if (T) goto 1;
mov CL1,CLO ! MT, OUTCOLOR = ACOLOR (branch delay instruction)
extu.b CL1,TM1 ! EX, val = ACOLOR.b
lds TM1,fpul ! CO, FPUL = val
float fpul,fr2 ! EX, fr2 = float(FPUL)
mov.l @IN2,CL2 ! LS, BCOLOR = v2->bgra
extu.b CL2,TM1 ! EX, val = BCOLOR.b
lds TM1,fpul ! CO, FPUL = val
float fpul,fr3 ! EX, fr3 = float(FPUL)
@ -179,5 +184,7 @@ _ClipEdge:
shll16 TM2 ! EX, tmp <<= 16
shll8 TM2 ! EX, tmp <<= 8
or TM2,CLO ! EX, OUTCOLOR.a |= tmp
1:
rts ! CO, return after executing instruction in delay slot
mov.l CLO,@OUT ! LS, OUT->color = OUTCOLOR

View File

@ -34,9 +34,9 @@
const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */
const cc_result ReturnCode_FileNotFound = ENOENT;
const cc_result ReturnCode_DirectoryExists = EEXIST;
const cc_result ReturnCode_SocketInProgess = EINPROGRESS;
const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK;
const cc_result ReturnCode_DirectoryExists = EEXIST;
const char* Platform_AppNameSuffix = " 3DS";
cc_bool Platform_ReadonlyFilesystem;