mirror of
https://github.com/Ed94/pikuma_ps1.git
synced 2026-08-25 02:20:33 +00:00
more reviewing, thinking about atom bundles...
This commit is contained in:
+19
-4
@@ -130,12 +130,27 @@ WORD_COUNT(mac_store_p3s4, 3)
|
||||
WORD_COUNT(mac_add_si_v3s4, 3)
|
||||
|
||||
/* atom_dbg_skip */
|
||||
#define mac_sub_v3s4(rds_x, rds_y, rds_z, rt_x, rt_y, rt_z) \
|
||||
sub_s(rds_x, rds_x, rt_x) \
|
||||
, sub_s(rds_y, rds_y, rt_y) \
|
||||
, sub_s(rds_z, rds_z, rt_z)
|
||||
#define mac_sub_s_v3(dx, dy, dz, sx, sy, sz, tx, ty, tz) \
|
||||
sub_s(dx, sx, tx) \
|
||||
, sub_s(dy, sy, ty) \
|
||||
, sub_s(dz, sz, tz)
|
||||
WORD_COUNT(mac_sub_s_v3, 3)
|
||||
|
||||
#define mac_sub_v3s4(d, s, t) \
|
||||
mac_sub_s_v3(d.x, d.y, d.z, s.x, s.y, s.z, t.x, t.y, t.z)
|
||||
WORD_COUNT(mac_sub_v3s4, 3)
|
||||
|
||||
/* atom_dbg_skip */
|
||||
#define mac_sub_s_v3_self(ds_x, ds_y, ds_z, tx, ty, tz) \
|
||||
sub_s(ds_x, ds_x, tx) \
|
||||
, sub_s(ds_y, ds_y, ty) \
|
||||
, sub_s(ds_z, ds_z, tz)
|
||||
WORD_COUNT(mac_sub_s_v3_self, 3)
|
||||
|
||||
#define mac_sub_v3s4_self(ds, t) \
|
||||
mac_sub_s_v3_self(ds.x, ds.y, ds.z, t.x, t.y, t.z)
|
||||
WORD_COUNT(mac_sub_v3s4_self, 3)
|
||||
|
||||
/* atom_dbg_skip */
|
||||
#define mac_store_rects2(rt_x, rt_y, rt_width, rt_height, base, offset) \
|
||||
store_half(rt_x, base, offset + O_(Rect_S2,x)) \
|
||||
|
||||
@@ -33,7 +33,7 @@ enum {
|
||||
atom_offset_example_atom_proc_skip = _atom_offset_example_atom_proc_skip,
|
||||
};
|
||||
|
||||
// --- atom: normalize_v3s4_proc (61 words) ---
|
||||
// --- atom: build_normalize_v3s4 (61 words) ---
|
||||
|
||||
#define _atom_offset_aligned_done_srav_path 3
|
||||
#define _atom_offset_srav_path_aligned_done 4
|
||||
|
||||
+12
-4
@@ -236,8 +236,13 @@ internal S2 const gte_normalize_sqr_tbl[192] align_(2) = {
|
||||
0x0820, 0x081c, 0x0818, 0x0814, 0x0810, 0x080c, 0x0808, 0x0804,
|
||||
};
|
||||
|
||||
typedef Struct_(RegUse_normalize_v3s4_proc) {
|
||||
Reg const scratch; // Scratch base carrier.
|
||||
typedef Struct_(Binds_build_normalize_v3s4) {
|
||||
U4 scratch;
|
||||
U2 src_offset;
|
||||
U2 dst_offset;
|
||||
};
|
||||
typedef Struct_(RegUse_build_normalize_v3s4) {
|
||||
Reg scratch;
|
||||
Reg src_ptr;
|
||||
Reg dst_ptr;
|
||||
Reg recip_est; // |v|² sum + shift-input + sqrtbl[index]
|
||||
@@ -278,9 +283,12 @@ typedef Struct_(RegUse_normalize_v3s4_proc) {
|
||||
* Sqrtbl: hardcoded to 0x800185B4 (libgte msc02.rel.data). Note: swapped to local.
|
||||
* Pipeline: clobbers IR0..3, MAC1..3, LZCS, LZCR.
|
||||
*/
|
||||
internal MipsAtom* normalize_v3s4_proc(AtomArena_R aa, U2 src_offset, U2 dst_offset, RegUse_normalize_v3s4_proc r)
|
||||
internal MipsAtom* build_normalize_v3s4(AtomArena_R aa, U2 src_offset, U2 dst_offset, RegUse_build_normalize_v3s4 r)
|
||||
MipsAtom_Proc_(aa, {
|
||||
add_si(r.src_ptr, r.scratch, src_offset), /* r_src_ptr = &src */
|
||||
// load_word(r.scratch, R_TapePtr, O_(Binds_build_normalize_v3s4,scratch)),
|
||||
// add_ui_self(R_TapePtr, S_(Binds_build_normalize_v3s4)),
|
||||
|
||||
add_si(r.src_ptr, r.scratch, src_offset), /* r_src_ptr = &src */
|
||||
|
||||
/* Load src.x/y/z from r_src_ptr (caller-determined address) into r_tmp/r_recip_est/r_branch_tmp.
|
||||
* r.rt1_src_x holds src.x throughout stages 1-2 — r_mac2_scratch is clobbered to MAC2 in stage 1.5 (line below). */
|
||||
|
||||
+18
-4
@@ -66,12 +66,26 @@ atom_dbg_skip MipsAtomComp_Proc_(ab, {
|
||||
add_si(rt_z, base, O_(V3_S4,z)),
|
||||
})
|
||||
|
||||
FI_ Slice_MipsCode ac_sub_v3s4(AtomBuilder_R ab, U4 rds_x, U4 rds_y, U4 rds_z, U4 rt_x, U4 rt_y, U4 rt_z) atom_dbg_skip MipsAtomComp_Proc_(ab, {
|
||||
sub_s(rds_x, rds_x, rt_x),
|
||||
sub_s(rds_y, rds_y, rt_y),
|
||||
sub_s(rds_z, rds_z, rt_z),
|
||||
FI_ Slice_MipsCode ac_sub_s_v3(AtomBuilder_R ab
|
||||
, Reg dx, Reg dy, Reg dz
|
||||
, Reg sx, Reg sy, Reg sz
|
||||
, Reg tx, Reg ty, Reg tz
|
||||
) atom_dbg_skip MipsAtomComp_Proc_(ab, {
|
||||
sub_s(dx, sx, tx),
|
||||
sub_s(dy, sy, ty),
|
||||
sub_s(dz, sz, tz),
|
||||
})
|
||||
|
||||
FI_ Slice_MipsCode ac_sub_v3s4(AtomBuilder_R ab, Reg_(V3_S4) d, Reg_(V3_S4) s, Reg_(V3_S4) t) MipsAtomComp_ProcMap_(ab, mac_sub_s_v3(d.x, d.y, d.z, s.x, s.y, s.z, t.x, t.y, t.z))
|
||||
|
||||
FI_ Slice_MipsCode ac_sub_s_v3_self(AtomBuilder_R ab, Reg ds_x, Reg ds_y, Reg ds_z, Reg tx, Reg ty, Reg tz) atom_dbg_skip MipsAtomComp_Proc_(ab, {
|
||||
sub_s(ds_x, ds_x, tx),
|
||||
sub_s(ds_y, ds_y, ty),
|
||||
sub_s(ds_z, ds_z, tz),
|
||||
})
|
||||
|
||||
FI_ Slice_MipsCode ac_sub_v3s4_self(AtomBuilder_R ab, Reg_(V3_S4) ds, Reg_(V3_S4) t) MipsAtomComp_ProcMap_(ab, mac_sub_s_v3_self(ds.x, ds.y, ds.z, t.x, t.y, t.z))
|
||||
|
||||
FI_ Slice_MipsCode ac_store_rects2(AtomBuilder_R ab, U4 rt_x, U4 rt_y, U4 rt_width, U4 rt_height, U4 base, U4 offset) atom_dbg_skip MipsAtomComp_Proc_(ab, {
|
||||
store_half(rt_x, base, offset + O_(Rect_S2,x)),
|
||||
store_half(rt_y, base, offset + O_(Rect_S2,y)),
|
||||
|
||||
Reference in New Issue
Block a user