mirror of
https://github.com/Ed94/pikuma_ps1.git
synced 2026-08-14 11:38:14 +00:00
FINALLY?
This commit is contained in:
@@ -214,12 +214,15 @@ WORD_COUNT(mac_apply_matrix_lv, 31)
|
||||
|
||||
#define mac_trans_matrix(r_mtx, r_off, r_t1) \
|
||||
load_word(r_t1, r_off, O_(V3_S4,x)) \
|
||||
, nop \
|
||||
, store_word(r_t1, r_mtx, O_(MT3_S2S4,t[0])) \
|
||||
, load_word(r_t1, r_off, O_(V3_S4,y)) \
|
||||
, nop \
|
||||
, store_word(r_t1, r_mtx, O_(MT3_S2S4,t[1])) \
|
||||
, load_word(r_t1, r_off, O_(V3_S4,z)) \
|
||||
, nop \
|
||||
, store_word(r_t1, r_mtx, O_(MT3_S2S4,t[2]))
|
||||
WORD_COUNT(mac_trans_matrix, 6)
|
||||
WORD_COUNT(mac_trans_matrix, 9)
|
||||
|
||||
#define mac_gcmd_push(cmd, reg_transfer, reg_base, port) \
|
||||
load_upper_i(reg_transfer, u4_hi(cmd)) \
|
||||
|
||||
@@ -151,12 +151,15 @@ FI_ Slice_MipsCode ac_trans_matrix(AtomBuilder_R ab
|
||||
, U4 r_t1
|
||||
) MipsAtomComp_Proc_(ac_trans_matrix, ab, {
|
||||
load_word(r_t1, r_off, O_(V3_S4,x)),
|
||||
nop,
|
||||
store_word(r_t1, r_mtx, O_(MT3_S2S4,t[0])),
|
||||
|
||||
load_word(r_t1, r_off, O_(V3_S4,y)),
|
||||
nop,
|
||||
store_word(r_t1, r_mtx, O_(MT3_S2S4,t[1])),
|
||||
|
||||
load_word(r_t1, r_off, O_(V3_S4,z)),
|
||||
nop,
|
||||
store_word(r_t1, r_mtx, O_(MT3_S2S4,t[2])),
|
||||
})
|
||||
|
||||
|
||||
@@ -123,6 +123,7 @@ enum {
|
||||
/* Wave-context GPR carrier for the resolve_look_at bundle: the scratch base.
|
||||
* Set by atom 0 (popped from tape), read by atoms 1-6 (used as pointer base). */
|
||||
R_ResolveScratch = R_T4 atom_reg atom_type(U4*),
|
||||
#define R_ResolveScratch_Code R_T4_Code
|
||||
};
|
||||
typedef Struct_(Binds_ResolveLookAt) {
|
||||
MT3_S2S4* look_at;
|
||||
@@ -561,15 +562,6 @@ internal MipsAtom* resolve_look_at__matrix_vector_proc(AtomArena_R aa
|
||||
add_si(r_peye, r_scratch, O_(ResolveLookAtScratch,eye)),
|
||||
nop,
|
||||
|
||||
/* Load pos = -eye from scratch. */
|
||||
load_word(r_tmp0, r_peye, O_(P3_S4,x)),
|
||||
load_word(r_tmp1, r_peye, O_(P3_S4,y)),
|
||||
load_word(r_tmp2, r_peye, O_(P3_S4,z)),
|
||||
nop,
|
||||
sub_u(r_tmp0, R_0, r_tmp0), /* pos.x = -eye.x */
|
||||
sub_u(r_tmp1, R_0, r_tmp1),
|
||||
sub_u(r_tmp2, R_0, r_tmp2),
|
||||
|
||||
/* === Load RT matrix from look_at into C2[0..4] via ctc2 ===
|
||||
* Exact same sequence as set_gte_mt3s2s4 / C11's ApplyMatrixLV. */
|
||||
load_word(r_tmp0, r_look_at, 0), nop,
|
||||
@@ -584,6 +576,15 @@ internal MipsAtom* resolve_look_at__matrix_vector_proc(AtomArena_R aa
|
||||
gte_mv_to_ctrl_r(r_tmp0, gte_cr_RT22),
|
||||
nop2, /* CTC2 retirement (2 slots × 5 ctc2s) */
|
||||
|
||||
/* Load pos = -eye after the matrix load releases r_tmp0. */
|
||||
load_word(r_tmp0, r_peye, O_(P3_S4,x)),
|
||||
load_word(r_tmp1, r_peye, O_(P3_S4,y)),
|
||||
load_word(r_tmp2, r_peye, O_(P3_S4,z)),
|
||||
nop,
|
||||
sub_u(r_tmp0, R_0, r_tmp0), /* pos.x = -eye.x */
|
||||
sub_u(r_tmp1, R_0, r_tmp1),
|
||||
sub_u(r_tmp2, R_0, r_tmp2),
|
||||
|
||||
/* === mtc2 pos (as S16) to IR1/2/3 ===
|
||||
* The GTE takes low 16 bits. pos fits in S16. For negative pos, the
|
||||
* 32-bit sign-extended value's low 16 bits = correct S16. */
|
||||
|
||||
@@ -241,7 +241,6 @@ internal void resolve_look_at_init(void) {
|
||||
r_tmp0_0, r_tmp1_0, r_tmp2_0, r_tmp3_0);
|
||||
|
||||
/* === ATOM 1: normalize fwd→uz === */
|
||||
ab.start = ab.start + ab.used;
|
||||
U4 const r_src_offset_1 = O_(ResolveLookAtScratch, fwd);
|
||||
U4 const r_dst_offset_1 = O_(ResolveLookAtScratch, uz);
|
||||
U4 const r_src_ptr_1 = R_T0;
|
||||
|
||||
Reference in New Issue
Block a user