mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 09:35:23 -04:00
Add right version of last commit
This commit is contained in:
parent
f1fdc2a177
commit
0b8f07f307
@ -1,128 +1,126 @@
|
|||||||
!r0 = prefetch address
|
!r0 = prefetch address
|
||||||
!r1 = GPU VERT command
|
!r1 = GPU VERT command
|
||||||
!r2 = GPU EOS command
|
!r2 = GPU EOS command
|
||||||
!r3 = colour
|
!r3 = colour
|
||||||
!r4 = src pointer ARG
|
!r4 = src pointer ARG
|
||||||
!r5 = dst pointer ARG
|
!r5 = dst pointer ARG
|
||||||
!r6 = quads count ARG
|
!r6 = quads count ARG
|
||||||
|
|
||||||
!fr4 = x
|
!fr4 = x
|
||||||
!fr5 = y
|
!fr5 = y
|
||||||
!fr6 = z
|
!fr6 = z
|
||||||
!fr7 = w
|
!fr7 = w
|
||||||
!fr9 = 0
|
!fr9 = 0
|
||||||
!fr10 = ?
|
!fr10 = ?
|
||||||
!fr11 = ?
|
!fr11 = ?
|
||||||
|
|
||||||
!fv4 = XYZW
|
!fv4 = XYZW
|
||||||
|
|
||||||
.globl DrawColouredQuads
|
.globl _DrawColouredQuads
|
||||||
.align 4
|
.align 4
|
||||||
.type DrawColouredQuads,%function
|
.type _DrawColouredQuads,%function
|
||||||
|
|
||||||
! See https://shared-ptr.com/sh_insns.html
|
! See https://shared-ptr.com/sh_insns.html
|
||||||
! Although there is fmov.s @Rm+,FRn, there isn't fmov.s FRn,@Rm+
|
! Although there is fmov.s @Rm+,FRn, there isn't fmov.s FRn,@Rm+
|
||||||
! So have to use fmov.s FRn,@-Rm instead
|
! So have to use fmov.s FRn,@-Rm instead
|
||||||
|
|
||||||
DrawColouredQuads:
|
_DrawColouredQuads:
|
||||||
.fnstart
|
! Setup
|
||||||
! Setup
|
mov.l CMD_COL_VERT, r1 ! r1 = GPU VERT command
|
||||||
mov.l CMD_COL_VERT, r1 ! r1 = GPU VERT command
|
mov.l CMD_COL_EOS, r2 ! r2 = GPU EOS command
|
||||||
mov.l CMD_COL_EOS, r2 ! r2 = GPU EOS command
|
fldi0 fr9 ! fr9 = 0
|
||||||
fldi0 fr9 ! fr9 = 0
|
mov r4,r0 ! r0 = src
|
||||||
mov r4,r0 ! r0 = src
|
add #-32, r5 ! r5 -= sizeof(VERTEX)
|
||||||
add #-32, r5 ! r5 -= sizeof(VERTEX)
|
nop ! align loop
|
||||||
nop ! align loop
|
|
||||||
|
.TRANSFORM_QUAD:
|
||||||
.TRANSFORM_QUAD:
|
! TRANSFORM VERTEX 1
|
||||||
! TRANSFORM VERTEX 1
|
add #16, r0 ! r0 += VERTEX_STRIDE
|
||||||
add #16, r0 ! r0 += VERTEX_STRIDE
|
add #64, r5 ! r5 += 2 * sizeof(VERTEX)
|
||||||
add #64, r5 ! r5 += 2 * sizeof(VERTEX)
|
pref @r0 ! PREFETCH r0 (next vertex)
|
||||||
pref @r0 ! PREFETCH r0 (next vertex)
|
fmov @r4+, fr4 ! fr4 = src->x
|
||||||
fmov @r4+, fr4 ! fr4 = src->x
|
fmov @r4+, fr5 ! fr5 = src->y
|
||||||
fmov @r4+, fr5 ! fr5 = src->y
|
fmov @r4+, fr6 ! fr6 = src->z
|
||||||
fmov @r4+, fr6 ! fr6 = src->z
|
fldi1 fr7 ! fr7 = 1.0
|
||||||
fldi1 fr7 ! fr7 = 1.0
|
ftrv xmtrx, fv4 ! TRANSFORM(fr4..fr7)
|
||||||
ftrv xmtrx, fv4 ! TRANSFORM(fr4..fr7)
|
|
||||||
|
mov.l @r4+,r3 ! r3 = src->color
|
||||||
mov.l @r4+,r3 ! r3 = src->color
|
fmov.s fr7,@-r5 ! dst->w = fr7
|
||||||
fmov.s fr7,@-r5 ! dst->w = fr7
|
mov.l r3,@-r5 ! dst->bgra = r3
|
||||||
mov.l r3,@-r5 ! dst->bgra = r3
|
fmov.s fr9,@-r5 ! dst->v = 0.0
|
||||||
fmov.s fr9,@-r5 ! dst->v = 0.0
|
fmov.s fr9,@-r5 ! dst->u = 0.0
|
||||||
fmov.s fr9,@-r5 ! dst->u = 0.0
|
fmov.s fr6,@-r5 ! dst->z = fr6
|
||||||
fmov.s fr6,@-r5 ! dst->z = fr6
|
fmov.s fr5,@-r5 ! dst->y = fr5
|
||||||
fmov.s fr5,@-r5 ! dst->y = fr5
|
fmov.s fr4,@-r5 ! dst->x = fr4
|
||||||
fmov.s fr4,@-r5 ! dst->x = fr4
|
mov.l r1,@-r5 ! dst->flags = CMD_VERT
|
||||||
mov.l r1,@-r5 ! dst->flags = CMD_VERT
|
|
||||||
|
! TRANSFORM VERTEX 2
|
||||||
! TRANSFORM VERTEX 2
|
add #16, r0 ! r0 += VERTEX_STRIDE
|
||||||
add #16, r0 ! r0 += VERTEX_STRIDE
|
add #64, r5 ! r5 += 2 * sizeof(VERTEX)
|
||||||
add #64, r5 ! r5 += 2 * sizeof(VERTEX)
|
pref @r0 ! PREFETCH r0 (next vertex)
|
||||||
pref @r0 ! PREFETCH r0 (next vertex)
|
fmov @r4+, fr4 ! fr4 = src->x
|
||||||
fmov @r4+, fr4 ! fr4 = src->x
|
fmov @r4+, fr5 ! fr5 = src->y
|
||||||
fmov @r4+, fr5 ! fr5 = src->y
|
fmov @r4+, fr6 ! fr6 = src->z
|
||||||
fmov @r4+, fr6 ! fr6 = src->z
|
fldi1 fr7 ! fr7 = 1.0
|
||||||
fldi1 fr7 ! fr7 = 1.0
|
ftrv xmtrx, fv4 ! TRANSFORM(fr4..fr7)
|
||||||
ftrv xmtrx, fv4 ! TRANSFORM(fr4..fr7)
|
|
||||||
|
mov.l @r4+,r3 ! r3 = src->color
|
||||||
mov.l @r4+,r3 ! r3 = src->color
|
fmov.s fr7,@-r5 ! dst->w = fr7
|
||||||
fmov.s fr7,@-r5 ! dst->w = fr7
|
mov.l r3,@-r5 ! dst->bgra = r3
|
||||||
mov.l r3,@-r5 ! dst->bgra = r3
|
fmov.s fr9,@-r5 ! dst->v = 0.0
|
||||||
fmov.s fr9,@-r5 ! dst->v = 0.0
|
fmov.s fr9,@-r5 ! dst->u = 0.0
|
||||||
fmov.s fr9,@-r5 ! dst->u = 0.0
|
fmov.s fr6,@-r5 ! dst->z = fr6
|
||||||
fmov.s fr6,@-r5 ! dst->z = fr6
|
fmov.s fr5,@-r5 ! dst->y = fr5
|
||||||
fmov.s fr5,@-r5 ! dst->y = fr5
|
fmov.s fr4,@-r5 ! dst->x = fr4
|
||||||
fmov.s fr4,@-r5 ! dst->x = fr4
|
mov.l r1,@-r5 ! dst->flags = CMD_VERT
|
||||||
mov.l r1,@-r5 ! dst->flags = CMD_VERT
|
|
||||||
|
! TRANSFORM VERTEX 3
|
||||||
! TRANSFORM VERTEX 3
|
add #16, r0 ! r0 += VERTEX_STRIDE
|
||||||
add #16, r0 ! r0 += VERTEX_STRIDE
|
add #64, r5 ! r5 += 2 * sizeof(VERTEX)
|
||||||
add #64, r5 ! r5 += 2 * sizeof(VERTEX)
|
pref @r0 ! PREFETCH r0 (next vertex)
|
||||||
pref @r0 ! PREFETCH r0 (next vertex)
|
fmov @r4+, fr4 ! fr4 = src->x
|
||||||
fmov @r4+, fr4 ! fr4 = src->x
|
fmov @r4+, fr5 ! fr5 = src->y
|
||||||
fmov @r4+, fr5 ! fr5 = src->y
|
fmov @r4+, fr6 ! fr6 = src->z
|
||||||
fmov @r4+, fr6 ! fr6 = src->z
|
fldi1 fr7 ! fr7 = 1.0
|
||||||
fldi1 fr7 ! fr7 = 1.0
|
ftrv xmtrx, fv4 ! TRANSFORM(fr4..fr7)
|
||||||
ftrv xmtrx, fv4 ! TRANSFORM(fr4..fr7)
|
|
||||||
|
mov.l @r4+,r3 ! r3 = src->color
|
||||||
mov.l @r4+,r3 ! r3 = src->color
|
fmov.s fr7,@-r5 ! dst->w = fr7
|
||||||
fmov.s fr7,@-r5 ! dst->w = fr7
|
mov.l r3,@-r5 ! dst->bgra = r3
|
||||||
mov.l r3,@-r5 ! dst->bgra = r3
|
fmov.s fr9,@-r5 ! dst->v = 0.0
|
||||||
fmov.s fr9,@-r5 ! dst->v = 0.0
|
fmov.s fr9,@-r5 ! dst->u = 0.0
|
||||||
fmov.s fr9,@-r5 ! dst->u = 0.0
|
fmov.s fr6,@-r5 ! dst->z = fr6
|
||||||
fmov.s fr6,@-r5 ! dst->z = fr6
|
fmov.s fr5,@-r5 ! dst->y = fr5
|
||||||
fmov.s fr5,@-r5 ! dst->y = fr5
|
fmov.s fr4,@-r5 ! dst->x = fr4
|
||||||
fmov.s fr4,@-r5 ! dst->x = fr4
|
mov.l r1,@-r5 ! dst->flags = CMD_VERT
|
||||||
mov.l r1,@-r5 ! dst->flags = CMD_VERT
|
|
||||||
|
! TRANSFORM VERTEX 4
|
||||||
! TRANSFORM VERTEX 4
|
add #16, r0 ! r0 += VERTEX_STRIDE
|
||||||
add #16, r0 ! r0 += VERTEX_STRIDE
|
add #64, r5 ! r5 += 2 * sizeof(VERTEX)
|
||||||
add #64, r5 ! r5 += 2 * sizeof(VERTEX)
|
pref @r0 ! PREFETCH r0 (next vertex)
|
||||||
pref @r0 ! PREFETCH r0 (next vertex)
|
fmov @r4+, fr4 ! fr4 = src->x
|
||||||
fmov @r4+, fr4 ! fr4 = src->x
|
fmov @r4+, fr5 ! fr5 = src->y
|
||||||
fmov @r4+, fr5 ! fr5 = src->y
|
fmov @r4+, fr6 ! fr6 = src->z
|
||||||
fmov @r4+, fr6 ! fr6 = src->z
|
fldi1 fr7 ! fr7 = 1.0
|
||||||
fldi1 fr7 ! fr7 = 1.0
|
ftrv xmtrx, fv4 ! TRANSFORM(fr4..fr7)
|
||||||
ftrv xmtrx, fv4 ! TRANSFORM(fr4..fr7)
|
|
||||||
|
mov.l @r4+,r3 ! r3 = src->color
|
||||||
mov.l @r4+,r3 ! r3 = src->color
|
fmov.s fr7,@-r5 ! dst->w = fr7
|
||||||
fmov.s fr7,@-r5 ! dst->w = fr7
|
mov.l r3,@-r5 ! dst->bgra = r3
|
||||||
mov.l r3,@-r5 ! dst->bgra = r3
|
fmov.s fr9,@-r5 ! dst->v = 0.0
|
||||||
fmov.s fr9,@-r5 ! dst->v = 0.0
|
fmov.s fr9,@-r5 ! dst->u = 0.0
|
||||||
fmov.s fr9,@-r5 ! dst->u = 0.0
|
fmov.s fr6,@-r5 ! dst->z = fr6
|
||||||
fmov.s fr6,@-r5 ! dst->z = fr6
|
fmov.s fr5,@-r5 ! dst->y = fr5
|
||||||
fmov.s fr5,@-r5 ! dst->y = fr5
|
fmov.s fr4,@-r5 ! dst->x = fr4
|
||||||
fmov.s fr4,@-r5 ! dst->x = fr4
|
mov.l r2,@-r5 ! dst->flags = CMD_EOS
|
||||||
mov.l r2,@-r5 ! dst->flags = CMD_EOS
|
|
||||||
|
dt r6 ! r6--; T = 1 if r6 == 0, else 0
|
||||||
dt r6 ! r6--; T = 1 if r6 == 0, else 0
|
bf .TRANSFORM_QUAD ! if T == 0 then goto TRANSFORM_QUAD
|
||||||
bf .TRANSFORM_QUAD ! if T == 0 then goto TRANSFORM_QUAD
|
nop
|
||||||
nop
|
|
||||||
|
rts ! return
|
||||||
rts ! return
|
nop
|
||||||
nop
|
|
||||||
.fnend
|
.align 2
|
||||||
|
CMD_COL_VERT: .long 0xe0000000
|
||||||
.align 2
|
CMD_COL_EOS: .long 0xf0000000
|
||||||
CMD_COL_VERT: .long 0xe0000000
|
|
||||||
CMD_COL_EOS: .long 0xf0000000
|
|
@ -1,130 +1,128 @@
|
|||||||
!r0 = prefetch address
|
!r0 = prefetch address
|
||||||
!r1 = GPU VERT command
|
!r1 = GPU VERT command
|
||||||
!r2 = GPU EOS command
|
!r2 = GPU EOS command
|
||||||
!r3 = colour
|
!r3 = colour
|
||||||
!r4 = src pointer ARG
|
!r4 = src pointer ARG
|
||||||
!r5 = dst pointer ARG
|
!r5 = dst pointer ARG
|
||||||
!r6 = quads count ARG
|
!r6 = quads count ARG
|
||||||
|
|
||||||
!fr4 = x
|
!fr4 = x
|
||||||
!fr5 = y
|
!fr5 = y
|
||||||
!fr6 = z
|
!fr6 = z
|
||||||
!fr7 = w
|
!fr7 = w
|
||||||
!fr9 = ?
|
!fr9 = ?
|
||||||
!fr10 = u
|
!fr10 = u
|
||||||
!fr11 = v
|
!fr11 = v
|
||||||
|
|
||||||
!fv4 = XYZW
|
!fv4 = XYZW
|
||||||
|
|
||||||
.globl DrawTexturedQuads
|
.globl _DrawTexturedQuads
|
||||||
.align 4
|
.align 4
|
||||||
.type DrawTexturedQuads,%function
|
.type _DrawTexturedQuads,%function
|
||||||
|
|
||||||
DrawTexturedQuads:
|
_DrawTexturedQuads:
|
||||||
.fnstart
|
! Setup
|
||||||
! Setup
|
mov.l CMD_TEX_VERT, r1 ! r1 = GPU VERT command
|
||||||
mov.l CMD_TEX_VERT, r1 ! r1 = GPU VERT command
|
mov.l CMD_TEX_EOS, r2 ! r2 = GPU EOS command
|
||||||
mov.l CMD_TEX_EOS, r2 ! r2 = GPU EOS command
|
mov r4,r0 ! r0 = src
|
||||||
mov r4,r0 ! r0 = src
|
add #-32, r5 ! r5 -= sizeof(VERTEX)
|
||||||
add #-32, r5 ! r5 -= sizeof(VERTEX)
|
|
||||||
|
.TRANSFORM_QUAD:
|
||||||
.TRANSFORM_QUAD:
|
! TRANSFORM VERTEX 1
|
||||||
! TRANSFORM VERTEX 1
|
add #24, r0 ! r0 += VERTEX_STRIDE
|
||||||
add #24, r0 ! r0 += VERTEX_STRIDE
|
add #64, r5 ! r5 += 2 * sizeof(VERTEX)
|
||||||
add #64, r5 ! r5 += 2 * sizeof(VERTEX)
|
pref @r0 ! PREFETCH r0 (next vertex)
|
||||||
pref @r0 ! PREFETCH r0 (next vertex)
|
fmov @r4+, fr4 ! fr4 = src->x
|
||||||
fmov @r4+, fr4 ! fr4 = src->x
|
fmov @r4+, fr5 ! fr5 = src->y
|
||||||
fmov @r4+, fr5 ! fr5 = src->y
|
fmov @r4+, fr6 ! fr6 = src->z
|
||||||
fmov @r4+, fr6 ! fr6 = src->z
|
fldi1 fr7 ! fr7 = 1.0
|
||||||
fldi1 fr7 ! fr7 = 1.0
|
ftrv xmtrx, fv4 ! TRANSFORM(fr4..fr7)
|
||||||
ftrv xmtrx, fv4 ! TRANSFORM(fr4..fr7)
|
|
||||||
|
mov.l @r4+,r3 ! r3 = src->color
|
||||||
mov.l @r4+,r3 ! r3 = src->color
|
fmov @r4+,fr10! fr10 = src->u
|
||||||
fmov @r4+,fr10! fr10 = src->u
|
fmov @r4+,fr11! fr11 = src->v
|
||||||
fmov @r4+,fr11! fr11 = src->v
|
fmov.s fr7,@-r5 ! dst->w = fr7
|
||||||
fmov.s fr7,@-r5 ! dst->w = fr7
|
mov.l r3,@-r5 ! dst->bgra = r3
|
||||||
mov.l r3,@-r5 ! dst->bgra = r3
|
fmov.s fr11,@-r5 ! dst->v = fr11
|
||||||
fmov.s fr11,@-r5 ! dst->v = fr11
|
fmov.s fr10,@-r5 ! dst->u = fr10
|
||||||
fmov.s fr10,@-r5 ! dst->u = fr10
|
fmov.s fr6,@-r5 ! dst->z = fr6
|
||||||
fmov.s fr6,@-r5 ! dst->z = fr6
|
fmov.s fr5,@-r5 ! dst->y = fr5
|
||||||
fmov.s fr5,@-r5 ! dst->y = fr5
|
fmov.s fr4,@-r5 ! dst->x = fr4
|
||||||
fmov.s fr4,@-r5 ! dst->x = fr4
|
mov.l r1,@-r5 ! dst->flags = CMD_VERT
|
||||||
mov.l r1,@-r5 ! dst->flags = CMD_VERT
|
|
||||||
|
! TRANSFORM VERTEX 2
|
||||||
! TRANSFORM VERTEX 2
|
add #24, r0 ! r0 += VERTEX_STRIDE
|
||||||
add #24, r0 ! r0 += VERTEX_STRIDE
|
add #64, r5 ! r5 += 2 * sizeof(VERTEX)
|
||||||
add #64, r5 ! r5 += 2 * sizeof(VERTEX)
|
pref @r0 ! PREFETCH r0 (next vertex)
|
||||||
pref @r0 ! PREFETCH r0 (next vertex)
|
fmov @r4+, fr4 ! fr4 = src->x
|
||||||
fmov @r4+, fr4 ! fr4 = src->x
|
fmov @r4+, fr5 ! fr5 = src->y
|
||||||
fmov @r4+, fr5 ! fr5 = src->y
|
fmov @r4+, fr6 ! fr6 = src->z
|
||||||
fmov @r4+, fr6 ! fr6 = src->z
|
fldi1 fr7 ! fr7 = 1.0
|
||||||
fldi1 fr7 ! fr7 = 1.0
|
ftrv xmtrx, fv4 ! TRANSFORM(fr4..fr7)
|
||||||
ftrv xmtrx, fv4 ! TRANSFORM(fr4..fr7)
|
|
||||||
|
mov.l @r4+,r3 ! r3 = src->color
|
||||||
mov.l @r4+,r3 ! r3 = src->color
|
fmov @r4+,fr10! fr10 = src->u
|
||||||
fmov @r4+,fr10! fr10 = src->u
|
fmov @r4+,fr11! fr11 = src->v
|
||||||
fmov @r4+,fr11! fr11 = src->v
|
fmov.s fr7,@-r5 ! dst->w = fr7
|
||||||
fmov.s fr7,@-r5 ! dst->w = fr7
|
mov.l r3,@-r5 ! dst->bgra = r3
|
||||||
mov.l r3,@-r5 ! dst->bgra = r3
|
fmov.s fr11,@-r5 ! dst->v = fr11
|
||||||
fmov.s fr11,@-r5 ! dst->v = fr11
|
fmov.s fr10,@-r5 ! dst->u = fr10
|
||||||
fmov.s fr10,@-r5 ! dst->u = fr10
|
fmov.s fr6,@-r5 ! dst->z = fr6
|
||||||
fmov.s fr6,@-r5 ! dst->z = fr6
|
fmov.s fr5,@-r5 ! dst->y = fr5
|
||||||
fmov.s fr5,@-r5 ! dst->y = fr5
|
fmov.s fr4,@-r5 ! dst->x = fr4
|
||||||
fmov.s fr4,@-r5 ! dst->x = fr4
|
mov.l r1,@-r5 ! dst->flags = CMD_VERT
|
||||||
mov.l r1,@-r5 ! dst->flags = CMD_VERT
|
|
||||||
|
! TRANSFORM VERTEX 3
|
||||||
! TRANSFORM VERTEX 3
|
add #24, r0 ! r0 += VERTEX_STRIDE
|
||||||
add #24, r0 ! r0 += VERTEX_STRIDE
|
add #64, r5 ! r5 += 2 * sizeof(VERTEX)
|
||||||
add #64, r5 ! r5 += 2 * sizeof(VERTEX)
|
pref @r0 ! PREFETCH r0 (next vertex)
|
||||||
pref @r0 ! PREFETCH r0 (next vertex)
|
fmov @r4+, fr4 ! fr4 = src->x
|
||||||
fmov @r4+, fr4 ! fr4 = src->x
|
fmov @r4+, fr5 ! fr5 = src->y
|
||||||
fmov @r4+, fr5 ! fr5 = src->y
|
fmov @r4+, fr6 ! fr6 = src->z
|
||||||
fmov @r4+, fr6 ! fr6 = src->z
|
fldi1 fr7 ! fr7 = 1.0
|
||||||
fldi1 fr7 ! fr7 = 1.0
|
ftrv xmtrx, fv4 ! TRANSFORM(fr4..fr7)
|
||||||
ftrv xmtrx, fv4 ! TRANSFORM(fr4..fr7)
|
|
||||||
|
mov.l @r4+,r3 ! r3 = src->color
|
||||||
mov.l @r4+,r3 ! r3 = src->color
|
fmov @r4+,fr10! fr10 = src->u
|
||||||
fmov @r4+,fr10! fr10 = src->u
|
fmov @r4+,fr11! fr11 = src->v
|
||||||
fmov @r4+,fr11! fr11 = src->v
|
fmov.s fr7,@-r5 ! dst->w = fr7
|
||||||
fmov.s fr7,@-r5 ! dst->w = fr7
|
mov.l r3,@-r5 ! dst->bgra = r3
|
||||||
mov.l r3,@-r5 ! dst->bgra = r3
|
fmov.s fr11,@-r5 ! dst->v = fr11
|
||||||
fmov.s fr11,@-r5 ! dst->v = fr11
|
fmov.s fr10,@-r5 ! dst->u = fr10
|
||||||
fmov.s fr10,@-r5 ! dst->u = fr10
|
fmov.s fr6,@-r5 ! dst->z = fr6
|
||||||
fmov.s fr6,@-r5 ! dst->z = fr6
|
fmov.s fr5,@-r5 ! dst->y = fr5
|
||||||
fmov.s fr5,@-r5 ! dst->y = fr5
|
fmov.s fr4,@-r5 ! dst->x = fr4
|
||||||
fmov.s fr4,@-r5 ! dst->x = fr4
|
mov.l r1,@-r5 ! dst->flags = CMD_VERT
|
||||||
mov.l r1,@-r5 ! dst->flags = CMD_VERT
|
|
||||||
|
! TRANSFORM VERTEX 4
|
||||||
! TRANSFORM VERTEX 4
|
add #24, r0 ! r0 += VERTEX_STRIDE
|
||||||
add #24, r0 ! r0 += VERTEX_STRIDE
|
add #64, r5 ! r5 += 2 * sizeof(VERTEX)
|
||||||
add #64, r5 ! r5 += 2 * sizeof(VERTEX)
|
pref @r0 ! PREFETCH r0 (next vertex)
|
||||||
pref @r0 ! PREFETCH r0 (next vertex)
|
fmov @r4+, fr4 ! fr4 = src->x
|
||||||
fmov @r4+, fr4 ! fr4 = src->x
|
fmov @r4+, fr5 ! fr5 = src->y
|
||||||
fmov @r4+, fr5 ! fr5 = src->y
|
fmov @r4+, fr6 ! fr6 = src->z
|
||||||
fmov @r4+, fr6 ! fr6 = src->z
|
fldi1 fr7 ! fr7 = 1.0
|
||||||
fldi1 fr7 ! fr7 = 1.0
|
ftrv xmtrx, fv4 ! TRANSFORM(fr4..fr7)
|
||||||
ftrv xmtrx, fv4 ! TRANSFORM(fr4..fr7)
|
|
||||||
|
mov.l @r4+,r3 ! r3 = src->color
|
||||||
mov.l @r4+,r3 ! r3 = src->color
|
fmov @r4+,fr10! fr10 = src->u
|
||||||
fmov @r4+,fr10! fr10 = src->u
|
fmov @r4+,fr11! fr11 = src->v
|
||||||
fmov @r4+,fr11! fr11 = src->v
|
fmov.s fr7,@-r5 ! dst->w = fr7
|
||||||
fmov.s fr7,@-r5 ! dst->w = fr7
|
mov.l r3,@-r5 ! dst->bgra = r3
|
||||||
mov.l r3,@-r5 ! dst->bgra = r3
|
fmov.s fr11,@-r5 ! dst->v = fr11
|
||||||
fmov.s fr11,@-r5 ! dst->v = fr11
|
fmov.s fr10,@-r5 ! dst->u = fr10
|
||||||
fmov.s fr10,@-r5 ! dst->u = fr10
|
fmov.s fr6,@-r5 ! dst->z = fr6
|
||||||
fmov.s fr6,@-r5 ! dst->z = fr6
|
fmov.s fr5,@-r5 ! dst->y = fr5
|
||||||
fmov.s fr5,@-r5 ! dst->y = fr5
|
fmov.s fr4,@-r5 ! dst->x = fr4
|
||||||
fmov.s fr4,@-r5 ! dst->x = fr4
|
mov.l r2,@-r5 ! dst->flags = CMD_EOS
|
||||||
mov.l r2,@-r5 ! dst->flags = CMD_EOS
|
|
||||||
|
dt r6 ! r6--; T = 1 if r6 == 0, else 0
|
||||||
dt r6 ! r6--; T = 1 if r6 == 0, else 0
|
bf .TRANSFORM_QUAD ! if T == 0 then goto TRANSFORM_QUAD
|
||||||
bf .TRANSFORM_QUAD ! if T == 0 then goto TRANSFORM_QUAD
|
nop
|
||||||
nop
|
|
||||||
|
rts ! return
|
||||||
rts ! return
|
nop
|
||||||
nop
|
|
||||||
.fnend
|
.align 2
|
||||||
|
CMD_TEX_VERT: .long 0xe0000000
|
||||||
.align 2
|
CMD_TEX_EOS: .long 0xf0000000
|
||||||
CMD_TEX_VERT: .long 0xe0000000
|
|
||||||
CMD_TEX_EOS: .long 0xf0000000
|
|
@ -1,8 +1,9 @@
|
|||||||
BUILD_DIR := build-dc
|
BUILD_DIR := build-dc
|
||||||
SOURCE_DIRS := src third_party/bearssl/src
|
SOURCE_DIRS := src third_party/bearssl/src misc/dreamcast
|
||||||
|
|
||||||
|
S_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S))
|
||||||
C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
|
C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
|
||||||
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o)))
|
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.o)))
|
||||||
CFLAGS :=-g -O1 -pipe -fno-math-errno -Ithird_party/bearssl/inc
|
CFLAGS :=-g -O1 -pipe -fno-math-errno -Ithird_party/bearssl/inc
|
||||||
|
|
||||||
GLDC_LIB=third_party/gldc/libGLdc.a
|
GLDC_LIB=third_party/gldc/libGLdc.a
|
||||||
@ -31,6 +32,9 @@ $(CC_TEXTURES):
|
|||||||
$(BUILD_DIR)/%.o: src/%.c
|
$(BUILD_DIR)/%.o: src/%.c
|
||||||
kos-cc $(CFLAGS) -c $< -o $@
|
kos-cc $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(BUILD_DIR)/%.o: misc/dreamcast/%.S
|
||||||
|
kos-cc -c $< -o $@
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o: third_party/bearssl/src/%.c
|
$(BUILD_DIR)/%.o: third_party/bearssl/src/%.c
|
||||||
kos-cc $(CFLAGS) -c $< -o $@
|
kos-cc $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
@ -58,4 +62,4 @@ $(TARGET).iso: $(TARGET)-scr.bin
|
|||||||
# genisoimage -V ClassiCube -G IP.BIN -joliet -rock -l -o $(TARGET).iso ISO_FILES
|
# genisoimage -V ClassiCube -G IP.BIN -joliet -rock -l -o $(TARGET).iso ISO_FILES
|
||||||
|
|
||||||
$(TARGET).cdi: $(TARGET).iso
|
$(TARGET).cdi: $(TARGET).iso
|
||||||
cdi4dc $(TARGET).iso $(TARGET).cdi
|
cdi4dc $(TARGET).iso $(TARGET).cdi
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "Window.h"
|
#include "Window.h"
|
||||||
#include "../third_party/gldc/gldc.h"
|
#include "../third_party/gldc/gldc.h"
|
||||||
|
#include "../third_party/gldc/src/draw.c"
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <kos.h>
|
#include <kos.h>
|
||||||
#include <dc/matrix.h>
|
#include <dc/matrix.h>
|
||||||
@ -465,6 +466,22 @@ cc_bool Gfx_WarnIfNecessary(void) {
|
|||||||
*----------------------------------------------------------Drawing--------------------------------------------------------*
|
*----------------------------------------------------------Drawing--------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
#define VB_PTR gfx_vertices
|
#define VB_PTR gfx_vertices
|
||||||
|
static const void* VERTEX_PTR;
|
||||||
|
|
||||||
|
extern void DrawColouredQuads(const void* src, Vertex* dst, int numQuads);
|
||||||
|
extern void DrawTexturedQuads(const void* src, Vertex* dst, int numQuads);
|
||||||
|
|
||||||
|
void DrawQuads(int count) {
|
||||||
|
if (!count) return;
|
||||||
|
Vertex* start = submitVertices(count);
|
||||||
|
|
||||||
|
if (TEXTURES_ENABLED) {
|
||||||
|
DrawTexturedQuads(VERTEX_PTR, start, count >> 2);
|
||||||
|
} else {
|
||||||
|
DrawColouredQuads(VERTEX_PTR, start, count >> 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void SetupVertices(int startVertex) {
|
static void SetupVertices(int startVertex) {
|
||||||
if (gfx_format == VERTEX_FORMAT_TEXTURED) {
|
if (gfx_format == VERTEX_FORMAT_TEXTURED) {
|
||||||
@ -489,29 +506,33 @@ void Gfx_SetVertexFormat(VertexFormat fmt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_DrawVb_Lines(int verticesCount) {
|
void Gfx_DrawVb_Lines(int verticesCount) {
|
||||||
SetupVertices(0);
|
//SetupVertices(0);
|
||||||
//glDrawArrays(GL_LINES, 0, verticesCount);
|
//glDrawArrays(GL_LINES, 0, verticesCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||||
SetupVertices(startVertex);
|
if (gfx_format == VERTEX_FORMAT_TEXTURED) {
|
||||||
glDrawArrays(GL_QUADS, 0, verticesCount);
|
VERTEX_PTR = gfx_vertices + startVertex * SIZEOF_VERTEX_TEXTURED;
|
||||||
|
} else {
|
||||||
|
VERTEX_PTR = gfx_vertices + startVertex * SIZEOF_VERTEX_COLOURED;
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawQuads(verticesCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_DrawVb_IndexedTris(int verticesCount) {
|
void Gfx_DrawVb_IndexedTris(int verticesCount) {
|
||||||
SetupVertices(0);
|
VERTEX_PTR = gfx_vertices;
|
||||||
|
|
||||||
if (textureOffset) ShiftTextureCoords(verticesCount);
|
if (textureOffset) ShiftTextureCoords(verticesCount);
|
||||||
glDrawArrays(GL_QUADS, 0, verticesCount);
|
DrawQuads(verticesCount);
|
||||||
if (textureOffset) UnshiftTextureCoords(verticesCount);
|
if (textureOffset) UnshiftTextureCoords(verticesCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_DrawIndexedTris_T2fC4b(int verticesCount, int startVertex) {
|
void Gfx_DrawIndexedTris_T2fC4b(int verticesCount, int startVertex) {
|
||||||
if (renderingDisabled) return;
|
if (renderingDisabled) return;
|
||||||
|
|
||||||
cc_uint32 offset = startVertex * SIZEOF_VERTEX_TEXTURED;
|
VERTEX_PTR = gfx_vertices + startVertex * SIZEOF_VERTEX_TEXTURED;
|
||||||
gldcVertexPointer(SIZEOF_VERTEX_TEXTURED, (void*)(VB_PTR + offset));
|
DrawQuads(verticesCount);
|
||||||
glDrawArrays(GL_QUADS, 0, verticesCount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
21
third_party/gldc/src/draw.c
vendored
21
third_party/gldc/src/draw.c
vendored
@ -2,8 +2,6 @@
|
|||||||
#include "private.h"
|
#include "private.h"
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
static const GLubyte* VERTEX_PTR;
|
|
||||||
|
|
||||||
extern void apply_poly_header(PolyHeader* header, PolyList* activePolyList);
|
extern void apply_poly_header(PolyHeader* header, PolyList* activePolyList);
|
||||||
|
|
||||||
GL_FORCE_INLINE Vertex* submitVertices(GLuint vertexCount) {
|
GL_FORCE_INLINE Vertex* submitVertices(GLuint vertexCount) {
|
||||||
@ -28,22 +26,3 @@ GL_FORCE_INLINE Vertex* submitVertices(GLuint vertexCount) {
|
|||||||
}
|
}
|
||||||
return aligned_vector_at(&output->vector, start_offset);
|
return aligned_vector_at(&output->vector, start_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void DrawColouredQuads(Vertex* dst, const GLubyte* src, const GLuint numQuads);
|
|
||||||
extern void DrawTexturedQuads(Vertex* dst, const GLubyte* src, const GLuint numQuads);
|
|
||||||
|
|
||||||
void APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count) {
|
|
||||||
TRACE();
|
|
||||||
if (!count) return;
|
|
||||||
Vertex* start = submitVertices(count);
|
|
||||||
|
|
||||||
if (TEXTURES_ENABLED) {
|
|
||||||
DrawTexturedQuads(start, VERTEX_PTR + (first * 24), count >> 2);
|
|
||||||
} else {
|
|
||||||
DrawColouredQuads(start, VERTEX_PTR + (first * 16), count >> 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void APIENTRY gldcVertexPointer(GLsizei stride, const GLvoid * pointer) {
|
|
||||||
VERTEX_PTR = pointer;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user