Skip to content

Commit

Permalink
drivers/softrend/subdiv: move outcode tables to C
Browse files Browse the repository at this point in the history
  • Loading branch information
vs49688 committed Sep 28, 2024
1 parent 98b1923 commit 11ec941
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 30 deletions.
33 changes: 3 additions & 30 deletions drivers/softrend/subdiv.asm
Original file line number Diff line number Diff line change
Expand Up @@ -399,35 +399,8 @@ fp_one_fixed dword 65536.0

dotProduct dword ?

OUTCODE_TABLE macro name,gENameUCase,lNameUCase
name&Table dword OUTCODE_&gENameUCase or OUTCODE_N_&gENameUCase
dword OUTCODE_&gENameUCase or OUTCODE_N_&gENameUCase
dword 0

dword 0

dword OUTCODE_&gENameUCase or OUTCODE_N_&gENameUCase
dword OUTCODE_&gENameUCase or OUTCODE_N_&gENameUCase
dword OUTCODE_&gENameUCase or OUTCODE_N_&gENameUCase or OUTCODE_&lNameUCase or OUTCODE_N_&lNameUCase

dword 0

dword 0
dword OUTCODE_&lNameUCase or OUTCODE_N_&lNameUCase
dword 0

dword 0

dword OUTCODE_&gENameUCase or OUTCODE_N_&gENameUCase or OUTCODE_&lNameUCase or OUTCODE_N_&lNameUCase
dword OUTCODE_&lNameUCase or OUTCODE_N_&lNameUCase
dword OUTCODE_&gENameUCase or OUTCODE_N_&gENameUCase or OUTCODE_&lNameUCase or OUTCODE_N_&lNameUCase

dword 0
endm

OUTCODE_TABLE rightLeft,RIGHT,LEFT
OUTCODE_TABLE topBottom,TOP,BOTTOM
OUTCODE_TABLE hitherYon,HITHER,YON

EXTERN rightLeftTable:ptr dword
EXTERN topBottomTable:ptr dword
EXTERN hitherYonTable:ptr dword

end
31 changes: 31 additions & 0 deletions drivers/softrend/subdiv.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,34 @@ void averageVerticesOnScreen(const br_renderer *renderer, brp_vertex *restrict m
PROJECT_VERTEX_WRITE_Q(m1, m1->comp[C_X], m1->comp[C_Y], m1->comp[C_Z], m1->comp[C_W]);
PROJECT_VERTEX_WRITE_Q(m2, m2->comp[C_X], m2->comp[C_Y], m2->comp[C_Z], m2->comp[C_W]);
}

#define OUTCODE_TABLE(name, gENameUCase, lNameUCase) \
const br_uint_32 name##Table[16] = { \
OUTCODE_##gENameUCase | OUTCODE_N_##gENameUCase, \
OUTCODE_##gENameUCase | OUTCODE_N_##gENameUCase, \
0, \
\
0, \
\
OUTCODE_##gENameUCase | OUTCODE_N_##gENameUCase, \
OUTCODE_##gENameUCase | OUTCODE_N_##gENameUCase, \
OUTCODE_##gENameUCase | OUTCODE_N_##gENameUCase | OUTCODE_##lNameUCase | OUTCODE_N_##lNameUCase, \
\
0, \
\
0, \
OUTCODE_##lNameUCase | OUTCODE_N_##lNameUCase, \
0, \
\
0, \
\
OUTCODE_##gENameUCase | OUTCODE_N_##gENameUCase | OUTCODE_##lNameUCase | OUTCODE_N_##lNameUCase, \
OUTCODE_##lNameUCase | OUTCODE_N_##lNameUCase, \
OUTCODE_##gENameUCase | OUTCODE_N_##gENameUCase | OUTCODE_##lNameUCase | OUTCODE_N_##lNameUCase, \
\
0, \
}

OUTCODE_TABLE(rightLeft, RIGHT, LEFT);
OUTCODE_TABLE(topBottom, TOP, BOTTOM);
OUTCODE_TABLE(hitherYon, HITHER, YON);

0 comments on commit 11ec941

Please sign in to comment.