mirror of
https://github.com/Ed94/pikuma_ps1.git
synced 2026-08-14 11:38:14 +00:00
pain
This commit is contained in:
+12
-15
@@ -199,11 +199,14 @@ WORD_COUNT(mac_gte_gpf_scale, 13)
|
|||||||
, gte_lw(C2_VXY0, r_vec, 0) \
|
, gte_lw(C2_VXY0, r_vec, 0) \
|
||||||
, load_word(r_t0, r_vec, 4) \
|
, load_word(r_t0, r_vec, 4) \
|
||||||
, nop \
|
, nop \
|
||||||
, gte_lw(C2_VZ0, r_vec, 4) /* RTPS cv=1 (no translation accumulation; BK is zero-initialized), sf=0, v=0, mx=0.
|
, gte_lw(C2_VZ0, r_vec, 4) /* RTPS cv=3 (no translation contribution: TRX/TRY/TRZ are zeroed, BK is zero-initialized),
|
||||||
|
* sf=1 (integer, no shift = full 32-bit R*pos product), v=0 (uses V0 input), mx=0 (rotation matrix).
|
||||||
* MAC1 = RT11*V0.x + RT12*V0.y + RT13*V0.z + 0
|
* MAC1 = RT11*V0.x + RT12*V0.y + RT13*V0.z + 0
|
||||||
* MAC2 = RT21*V0.x + RT22*V0.y + RT23*V0.z + 0
|
* MAC2 = RT21*V0.x + RT22*V0.y + RT23*V0.z + 0
|
||||||
* MAC3 = RT31*V0.x + RT32*V0.y + RT33*V0.z + 0
|
* MAC3 = RT31*V0.x + RT32*V0.y + RT33*V0.z + 0
|
||||||
* Side effect: RTPS also writes SXY0/1/2 and SZ0..SZ3 (perspective projection). Ignored. */ /* gte_cmdw_rtps_no_tr, /* Read MAC1/2/3 → out. */ */ \
|
* Side effect: RTPS also writes SXY0/1/2 and SZ0..SZ3 (perspective projection). Ignored.
|
||||||
|
* Note: gte_cmdw_rtps_no_tr (the cv=3 alias) was removed from gte.h. Use gte_cmdw_rtps_sf1. */ \
|
||||||
|
, gte_cmdw_rtps_sf1 /* Read MAC1/2/3 → out. */ \
|
||||||
, gte_mv_from_data_r(r_t0, C2_MAC1) \
|
, gte_mv_from_data_r(r_t0, C2_MAC1) \
|
||||||
, gte_mv_from_data_r(r_t1, C2_MAC2) \
|
, gte_mv_from_data_r(r_t1, C2_MAC2) \
|
||||||
, gte_mv_from_data_r(r_t2, C2_MAC3) \
|
, gte_mv_from_data_r(r_t2, C2_MAC3) \
|
||||||
@@ -211,22 +214,16 @@ WORD_COUNT(mac_gte_gpf_scale, 13)
|
|||||||
, store_word(r_t0, r_out, 0) \
|
, store_word(r_t0, r_out, 0) \
|
||||||
, store_word(r_t1, r_out, 4) \
|
, store_word(r_t1, r_out, 4) \
|
||||||
, store_word(r_t2, r_out, 8)
|
, store_word(r_t2, r_out, 8)
|
||||||
WORD_COUNT(mac_apply_matrix_lv, 30)
|
WORD_COUNT(mac_apply_matrix_lv, 31)
|
||||||
|
|
||||||
#define mac_trans_matrix(r_mtx, r_off, r_t0, r_t1) \
|
#define mac_trans_matrix(r_mtx, r_off, r_t1) \
|
||||||
load_word(r_t0, r_mtx, O_(MT3_S2S4,t[0])) \
|
load_word(r_t1, r_off, O_(V3_S4,x)) \
|
||||||
, load_word(r_t1, r_off, O_(V3_S4,x)) \
|
, store_word(r_t1, r_mtx, O_(MT3_S2S4,t[0])) \
|
||||||
, add_u(r_t0, r_t0, r_t1) \
|
|
||||||
, store_word(r_t0, r_mtx, O_(MT3_S2S4,t[0])) \
|
|
||||||
, load_word(r_t0, r_mtx, O_(MT3_S2S4,t[1])) \
|
|
||||||
, load_word(r_t1, r_off, O_(V3_S4,y)) \
|
, load_word(r_t1, r_off, O_(V3_S4,y)) \
|
||||||
, add_u(r_t0, r_t0, r_t1) \
|
, store_word(r_t1, r_mtx, O_(MT3_S2S4,t[1])) \
|
||||||
, store_word(r_t0, r_mtx, O_(MT3_S2S4,t[1])) \
|
|
||||||
, load_word(r_t0, r_mtx, O_(MT3_S2S4,t[2])) \
|
|
||||||
, load_word(r_t1, r_off, O_(V3_S4,z)) \
|
, load_word(r_t1, r_off, O_(V3_S4,z)) \
|
||||||
, add_u(r_t0, r_t0, r_t1) \
|
, store_word(r_t1, r_mtx, O_(MT3_S2S4,t[2]))
|
||||||
, store_word(r_t0, r_mtx, O_(MT3_S2S4,t[2]))
|
WORD_COUNT(mac_trans_matrix, 6)
|
||||||
WORD_COUNT(mac_trans_matrix, 12)
|
|
||||||
|
|
||||||
#define mac_gcmd_push(cmd, reg_transfer, reg_base, port) \
|
#define mac_gcmd_push(cmd, reg_transfer, reg_base, port) \
|
||||||
load_upper_i(reg_transfer, u4_hi(cmd)) \
|
load_upper_i(reg_transfer, u4_hi(cmd)) \
|
||||||
|
|||||||
+12
-15
@@ -126,12 +126,14 @@ FI_ Slice_MipsCode ac_apply_matrix_lv(AtomBuilder_R ab
|
|||||||
load_word(r_t0, r_vec, 4), nop,
|
load_word(r_t0, r_vec, 4), nop,
|
||||||
gte_lw(C2_VZ0, r_vec, 4),
|
gte_lw(C2_VZ0, r_vec, 4),
|
||||||
|
|
||||||
/* RTPS cv=1 (no translation accumulation; BK is zero-initialized), sf=0, v=0, mx=0.
|
/* RTPS cv=3 (no translation contribution: TRX/TRY/TRZ are zeroed, BK is zero-initialized),
|
||||||
|
* sf=1 (integer, no shift = full 32-bit R*pos product), v=0 (uses V0 input), mx=0 (rotation matrix).
|
||||||
* MAC1 = RT11*V0.x + RT12*V0.y + RT13*V0.z + 0
|
* MAC1 = RT11*V0.x + RT12*V0.y + RT13*V0.z + 0
|
||||||
* MAC2 = RT21*V0.x + RT22*V0.y + RT23*V0.z + 0
|
* MAC2 = RT21*V0.x + RT22*V0.y + RT23*V0.z + 0
|
||||||
* MAC3 = RT31*V0.x + RT32*V0.y + RT33*V0.z + 0
|
* MAC3 = RT31*V0.x + RT32*V0.y + RT33*V0.z + 0
|
||||||
* Side effect: RTPS also writes SXY0/1/2 and SZ0..SZ3 (perspective projection). Ignored. */
|
* Side effect: RTPS also writes SXY0/1/2 and SZ0..SZ3 (perspective projection). Ignored.
|
||||||
// gte_cmdw_rtps_no_tr,
|
* Note: gte_cmdw_rtps_no_tr (the cv=3 alias) was removed from gte.h. Use gte_cmdw_rtps_sf1. */
|
||||||
|
gte_cmdw_rtps_sf1,
|
||||||
|
|
||||||
/* Read MAC1/2/3 → out. */
|
/* Read MAC1/2/3 → out. */
|
||||||
gte_mv_from_data_r(r_t0, C2_MAC1),
|
gte_mv_from_data_r(r_t0, C2_MAC1),
|
||||||
@@ -145,26 +147,21 @@ FI_ Slice_MipsCode ac_apply_matrix_lv(AtomBuilder_R ab
|
|||||||
|
|
||||||
/* ─── TRANS MATRIX (libgte TransMatrix port) ───
|
/* ─── TRANS MATRIX (libgte TransMatrix port) ───
|
||||||
* Atom component — auto-generates mac_trans_matrix Mac composer macro.
|
* Atom component — auto-generates mac_trans_matrix Mac composer macro.
|
||||||
* m->t += off. Uses 2 GPRs via per-axis load-delay-slot pattern.
|
* m->t = v (struct copy; libgte's TransMatrix at 0x8001a540 is just 3 store_words, no GTE, no add).
|
||||||
* Words: 12. Clobbers: r_t0, r_t1. */
|
* Uses 1 GPR (r_t1 = off value) per axis; per-axis load-delay-slot pattern.
|
||||||
|
* Words: 9. Clobbers: r_t1. */
|
||||||
FI_ Slice_MipsCode ac_trans_matrix(AtomBuilder_R ab
|
FI_ Slice_MipsCode ac_trans_matrix(AtomBuilder_R ab
|
||||||
, U4 r_mtx, U4 r_off
|
, U4 r_mtx, U4 r_off
|
||||||
, U4 r_t0, U4 r_t1
|
, U4 r_t1
|
||||||
) MipsAtomComp_Proc_(ac_trans_matrix, ab, {
|
) MipsAtomComp_Proc_(ac_trans_matrix, ab, {
|
||||||
load_word(r_t0, r_mtx, O_(MT3_S2S4,t[0])),
|
|
||||||
load_word(r_t1, r_off, O_(V3_S4,x)),
|
load_word(r_t1, r_off, O_(V3_S4,x)),
|
||||||
add_u(r_t0, r_t0, r_t1),
|
store_word(r_t1, r_mtx, O_(MT3_S2S4,t[0])),
|
||||||
store_word(r_t0, r_mtx, O_(MT3_S2S4,t[0])),
|
|
||||||
|
|
||||||
load_word(r_t0, r_mtx, O_(MT3_S2S4,t[1])),
|
|
||||||
load_word(r_t1, r_off, O_(V3_S4,y)),
|
load_word(r_t1, r_off, O_(V3_S4,y)),
|
||||||
add_u(r_t0, r_t0, r_t1),
|
store_word(r_t1, r_mtx, O_(MT3_S2S4,t[1])),
|
||||||
store_word(r_t0, r_mtx, O_(MT3_S2S4,t[1])),
|
|
||||||
|
|
||||||
load_word(r_t0, r_mtx, O_(MT3_S2S4,t[2])),
|
|
||||||
load_word(r_t1, r_off, O_(V3_S4,z)),
|
load_word(r_t1, r_off, O_(V3_S4,z)),
|
||||||
add_u(r_t0, r_t0, r_t1),
|
store_word(r_t1, r_mtx, O_(MT3_S2S4,t[2])),
|
||||||
store_word(r_t0, r_mtx, O_(MT3_S2S4,t[2])),
|
|
||||||
})
|
})
|
||||||
|
|
||||||
#pragma endregion MACs (Mips Atom Components)
|
#pragma endregion MACs (Mips Atom Components)
|
||||||
|
|||||||
@@ -360,9 +360,12 @@ void update(PrimitiveArena* pa, U4* ordering_buf)
|
|||||||
uz = scratch->uz;
|
uz = scratch->uz;
|
||||||
right = scratch->right;
|
right = scratch->right;
|
||||||
ux = scratch->ux;
|
ux = scratch->ux;
|
||||||
|
up = scratch->up; // ← atom 4's output (replaces C-side cross_v3s4)
|
||||||
|
uy = scratch->uy; // ← atom 5's output (replaces C-side normalize_v3s4)
|
||||||
|
|
||||||
// cross_v3s4(& uz, & ux, & up); normalize_v3s4(& up, & uy);
|
// cross_v3s4(& uz, & ux, & up); normalize_v3s4(& up, & uy);
|
||||||
|
|
||||||
|
// Atom 6 not yet enabled: populate look_at.m[][] from ux/uy/uz here.
|
||||||
smem.cam.look_at.m[0][0] = ux.x; smem.cam.look_at.m[0][1] = ux.y; smem.cam.look_at.m[0][2] = ux.z;
|
smem.cam.look_at.m[0][0] = ux.x; smem.cam.look_at.m[0][1] = ux.y; smem.cam.look_at.m[0][2] = ux.z;
|
||||||
smem.cam.look_at.m[1][0] = uy.x; smem.cam.look_at.m[1][1] = uy.y; smem.cam.look_at.m[1][2] = uy.z;
|
smem.cam.look_at.m[1][0] = uy.x; smem.cam.look_at.m[1][1] = uy.y; smem.cam.look_at.m[1][2] = uy.z;
|
||||||
smem.cam.look_at.m[2][0] = uz.x; smem.cam.look_at.m[2][1] = uz.y; smem.cam.look_at.m[2][2] = uz.z;
|
smem.cam.look_at.m[2][0] = uz.x; smem.cam.look_at.m[2][1] = uz.y; smem.cam.look_at.m[2][2] = uz.z;
|
||||||
|
|||||||
Reference in New Issue
Block a user