This commit is contained in:
2026-07-09 15:38:03 -04:00
parent ccdf1b832b
commit 0ad609e7c2
10 changed files with 638 additions and 93 deletions
@@ -5,20 +5,20 @@
#pragma region hello_gte_tape
// --- atom: cube_g4_face (87 words) ---
// --- atom: cube_g4_face (44 words) ---
#define _atom_offset_cull_cube_g4_face_exit 48
#define _atom_offset_bounds_chk_cube_g4_face_exit 12
#define _atom_offset_cull_cube_g4_face_exit 25
#define _atom_offset_bounds_chk_cube_g4_face_exit 2
enum {
atom_offset_cull_cube_g4_face_exit = _atom_offset_cull_cube_g4_face_exit,
atom_offset_bounds_chk_cube_g4_face_exit = _atom_offset_bounds_chk_cube_g4_face_exit,
};
// --- atom: floor_f3_face (66 words) ---
// --- atom: floor_f3_face (30 words) ---
#define _atom_offset_culling_floor_f3_face_exit 29
#define _atom_offset_bounds_chk_floor_f3_face_exit 13
#define _atom_offset_culling_floor_f3_face_exit 15
#define _atom_offset_bounds_chk_floor_f3_face_exit 3
enum {
atom_offset_culling_floor_f3_face_exit = _atom_offset_culling_floor_f3_face_exit,
+4 -6
View File
@@ -8,17 +8,19 @@
#include "duffle/dsl.h"
#include "duffle/memory.h"
#include "duffle/math.h"
#include "duffle/gcc_asm.h"
#include "duffle/mips.h"
#include "duffle/gp.h"
#include "duffle/gte.h"
# include "duffle/gen/lottes_tape.offsets.h"
# include "duffle/gen/duffle.macs.h"
# include "duffle/gen/duffle.offsets.h"
#include "duffle/atom_dsl.h"
#include "duffle/lottes_tape.h"
# include "tape_atom.metadata.h"
# include "gen/hello_gte_tape.offsets.h"
# include "gen/gte_hello.offsets.h"
#include "hello_gte.h"
#include "hello_gte_tape.c"
@@ -337,9 +339,6 @@ void update(PrimitiveArena* pa, U4* ordering_buf)
m3s2_rotation (& smem.floor.rot, & smem.tform_world);
m3s2_translation(& smem.tform_world, & smem.floor.pos);
m3s2_scale (& smem.tform_world, & smem.floor.scale);
// TODO(Ed): This can either be in the tape or here...
// gte_matrix_set_rotation (& smem.tform_world);
// gte_matrix_set_translation(& smem.tform_world);
U4 prim_base = u4_(pa->buf[smem.active_buf_id]);
U4 prim_cursor = prim_base + pa->used;
@@ -350,7 +349,6 @@ void update(PrimitiveArena* pa, U4* ordering_buf)
// Prepare the tape. (Push protocol to tape)
LP_ U4 mem_temp_tape[512];
TapeBuilder tb = tb_make(slice_ut_arr(mem_temp_tape)); tb_scope(& tb) {
// TODO(Ed): This is bugged.
tb_emit(& tb, code_set_gte_world);
tb_data(& tb, u4_(& smem.tform_world));
+14 -13
View File
@@ -1,9 +1,10 @@
#ifdef INTELLISENSE_DIRECTIVES
# include "duffle/lottes_tape.h"
# include "duffle/gen/duffle.macs.h"
# include "duffle/gen/duffle.offsets.h"
# include "duffle/atom_dsl.h"
# include "hello_gte.h"
# include "duffle/lottes_tape.h"
# include "tape_atom.metadata.h"
# include "gen/hello_gte_tape.offsets.h"
# include "hello_gte.h"
#endif
#pragma region MACs (Mips Atom components)
@@ -17,10 +18,10 @@
#pragma region Baked Atoms
typedef Struct_(Binds_CubeTri) {
U4 PrimCursor;
U4 FaceCursor;
U4 VertBase;
U4 OtBase;
U4 PrimCursor;
V4_S2* FaceCursor;
V3_S2* VertBase;
U4* OtBase;
};
internal MipsAtom_(rbind_cube_g4_face) {
/* Pop 4 arguments from the tape directly into the workspace registers */
@@ -101,7 +102,7 @@ MipsAtom_(cube_g4_face) {
branch_equal(R_AT, R_0, atom_offset(bounds_chk, cube_g4_face_exit)), nop,
/* ── 12. Insert into Ordering Table (length = 8 words for Poly_G4) ──── */
mac_insert_ot_tag(R_T1, Poly_G4),
mac_insert_ot_tag_g4(),
/* ── 13. Advance cursors & yield (both branch targets land here) ────── */
atom_label(cube_g4_face_exit)
@@ -111,10 +112,10 @@ atom_label(cube_g4_face_exit)
};
typedef Struct_(Binds_FloorTri) {
U4 PrimCursor;
U4 FaceCursor;
U4 VertBase;
U4 OtBase;
U4 PrimCursor;
V3_S2* FaceCursor;
V3_S2* VertBase;
U4* OtBase;
};
atom_region(rbind_floor_f3_face, REGION_PRIM_ARENA)
atom_group(rbind_floor_f3_face, GROUP_RENDER_FLOOR)
@@ -163,7 +164,7 @@ MipsAtom_(floor_f3_face) {
set_lt_u( R_AT, R_T1, R_AT),
branch_equal(R_AT, R_0, atom_offset(bounds_chk, floor_f3_face_exit)), nop,
/* Insert into Ordering Table Linked List */
mac_insert_ot_tag(R_T1, Poly_F3),
mac_insert_ot_tag_f3(),
add_ui_self(R_PrimCursor, S_(Poly_F3)), /* Advance Prim Cursor (5 words) */
// Note(Ed): No bounds checking, should be checked before atom runs.
+6 -10
View File
@@ -5,6 +5,12 @@
// Format: WORD_COUNT(MACRO_NAME, COUNT)
// One line per macro that appears in your atom sources.
//
// This file is encoding-macros-only. The auto-generated component
// macros (mac_X) live in duffle/gen/<dir>.macs.h (included separately
// by the unity build). The unity build should include THIS file and
// the .macs.h file in the same TU, with both wrapped (or the
// include guard order handled) to avoid WORD_COUNT redeclaration.
//
// To regenerate: hand-count the instructions in each macro definition.
// (You'll only need to do this once per macro — they don't change often.)
#define WORD_COUNT(name, count) enum { words_##name = (count) };
@@ -47,15 +53,5 @@ WORD_COUNT(gte_cmdw_nclip, 1)
WORD_COUNT(gte_avg_sort_z3, 1)
WORD_COUNT(sub_u, 1)
WORD_COUNT(nop2, 2)
WORD_COUNT(mac_load_tri_indices, 3)
WORD_COUNT(mac_load_tri_verts, 18)
WORD_COUNT(mac_format_f3_color, 3)
WORD_COUNT(mac_gte_store_f3_post_rtpt, 3)
WORD_COUNT(mac_pack_color_word, 3)
WORD_COUNT(mac_format_g4_color, 12)
WORD_COUNT(mac_gte_store_g4_p012_post_rtpt_pre_rtps, 3)
WORD_COUNT(mac_gte_store_g4_p3_post_rtps, 1)
WORD_COUNT(mac_insert_ot_tag, 11)
WORD_COUNT(mac_yield, 4)
#undef WORD_COUNT