tape diag yield works but not color, gte diags. Floor tri asm atom crashes.

This commit is contained in:
ed
2026-06-14 19:19:14 -04:00
parent 1b77d8bae3
commit 2e4912b1e2
3 changed files with 116 additions and 15 deletions
+34 -2
View File
@@ -191,6 +191,7 @@ void update(PrimitiveArena* pa, U4* ordering_buf)
S4 flag; //????
// Draw Cube
if (1)
{
m3s2_rotation (& static_mem.cube.rot, & static_mem.tform_world);
m3s2_translation(& static_mem.tform_world, & static_mem.cube.pos);
@@ -230,7 +231,7 @@ void update(PrimitiveArena* pa, U4* ordering_buf)
static_mem.cube.rot.y += 30;
}
// Draw Floor
if (0)
if (1)
{
m3s2_rotation (& static_mem.floor.rot, & static_mem.tform_world);
m3s2_translation(& static_mem.tform_world, & static_mem.floor.pos);
@@ -285,7 +286,7 @@ void update(PrimitiveArena* pa, U4* ordering_buf)
static_mem.floor.rot.y += 5;
}
// Draw floor tape method
if (1)
if (0)
{
LP_ U4 mem_temp_tape[512]; // Buffer for function addresses
FArena tape_arena;
@@ -318,6 +319,37 @@ void update(PrimitiveArena* pa, U4* ordering_buf)
pa->used = (U4)prim_cursor - (U4)r_(pa->buf)[static_mem.active_buf_id];
static_mem.floor.rot.y += 5;
}
// --- TAPE DIAGNOSTICS ---
if (1)
{
LP_ U4 mem_temp_tape[512];
FArena tape_arena;
farena_init(&tape_arena, slice_ut(mem_temp_tape, S_(mem_temp_tape)));
TapeBuilder tb = tb_begin(&tape_arena); {
// Skip set_gte_world atom for diagnostics to isolate the triangle loop
for (U4 i = 0; i < Floor_num_faces; i++) {
// =======================================================
// SWAP EMIT TO TEST DIFFERENT PARTS OF THE PIPELINE:
// =======================================================
// 1. code_atom_diag_yield -> Tests Tape Engine jump logic
// 2. code_atom_diag_color -> Tests OT and Prim Arena memory
// 3. code_atom_diag_gte -> Tests Vertex arrays and GTE Math
// tb_emit(&tb, code_atom_diag_yield);
// tb_emit(&tb, code_atom_diag_color);
// tb_emit(&tb, code_atom_diag_gte);
}
}
Slice_U4 tape = tb_end(&tb);
// Setup Workspace Registers
B1* prim_cursor = (B1*)r_(pa->buf)[static_mem.active_buf_id] + pa->used;
tape_run(tape, &prim_cursor, static_mem.floor.faces, static_mem.floor.verts, ordering_buf);
pa->used = (U4)prim_cursor - (U4)r_(pa->buf)[static_mem.active_buf_id];
static_mem.floor.rot.y += 5;
}
}
int main(void)