@@ -1368,12 +1368,10 @@ rdim_vmap_from_markers(RDIM_Arena *arena, RDIM_VMapMarker *markers, RDIM_SortKey
13681368
13691369//- rjf: main baking entry point
13701370
1371- RDI_PROC RDIM_String8List
1372- rdim_bake (RDIM_Arena * arena , RDIM_BakeParams * params )
1371+ RDI_PROC RDIM_BakeSectionList
1372+ rdim_bake_sections_from_params (RDIM_Arena * arena , RDIM_BakeParams * params )
13731373{
13741374 RDIM_Temp scratch = rdim_scratch_begin (& arena , 1 );
1375- RDIM_String8List blobs ;
1376- rdim_memzero_struct (& blobs );
13771375
13781376 //////////////////////////////
13791377 //- NOTE(rjf): On the ordering of baking phases:
@@ -2661,30 +2659,37 @@ rdim_bake(RDIM_Arena *arena, RDIM_BakeParams *params)
26612659 rdim_bake_section_list_push_new (arena , & sections , idx_data , sizeof (RDI_U32 )* idx_runs .idx_count , RDI_DataSectionTag_IndexRuns );
26622660 }
26632661
2664- //////////////////////////////
2665- //- rjf: finalize: build blob strings for header & all sections
2666- //
2667- RDIM_ProfScope ("finalize: build blob strings for header & all sections" )
2662+ rdim_scratch_end (scratch );
2663+ return sections ;
2664+ }
2665+
2666+ //- rjf: sections -> flattened serialized blobs
2667+
2668+ RDI_PROC RDIM_String8List
2669+ rdim_blobs_from_bake_sections (RDIM_Arena * arena , RDIM_BakeSectionList * sections )
2670+ {
2671+ RDIM_String8List blobs ;
2672+ rdim_memzero_struct (& blobs );
26682673 {
26692674 // rjf: push empty header & data section table
26702675 RDI_Header * baked_rdi_header = rdim_push_array (arena , RDI_Header , 1 );
2671- RDI_DataSection * baked_rdi_sections = rdim_push_array (arena , RDI_DataSection , sections . count );
2676+ RDI_DataSection * baked_rdi_sections = rdim_push_array (arena , RDI_DataSection , sections -> count );
26722677 rdim_str8_list_push (arena , & blobs , rdim_str8_struct (baked_rdi_header ));
26732678 rdim_str8_list_push_align (arena , & blobs , 8 );
26742679 U32 data_section_off = (U32 )blobs .total_size ;
2675- rdim_str8_list_push (arena , & blobs , rdim_str8 ((RDI_U8 * )baked_rdi_sections , sizeof (RDI_DataSection )* sections . count ));
2680+ rdim_str8_list_push (arena , & blobs , rdim_str8 ((RDI_U8 * )baked_rdi_sections , sizeof (RDI_DataSection )* sections -> count ));
26762681
26772682 // rjf: fill baked header
26782683 {
26792684 baked_rdi_header -> magic = RDI_MAGIC_CONSTANT ;
26802685 baked_rdi_header -> encoding_version = RDI_ENCODING_VERSION ;
26812686 baked_rdi_header -> data_section_off = data_section_off ;
2682- baked_rdi_header -> data_section_count = sections . count ;
2687+ baked_rdi_header -> data_section_count = sections -> count ;
26832688 }
26842689
26852690 // rjf: fill baked data section table
26862691 U64 dst_idx = 0 ;
2687- for (RDIM_BakeSectionNode * src_n = sections . first ; src_n != 0 ; src_n = src_n -> next , dst_idx += 1 )
2692+ for (RDIM_BakeSectionNode * src_n = sections -> first ; src_n != 0 ; src_n = src_n -> next , dst_idx += 1 )
26882693 {
26892694 RDIM_BakeSection * src = & src_n -> v ;
26902695 RDI_DataSection * dst = baked_rdi_sections + dst_idx ;
@@ -2702,7 +2707,5 @@ rdim_bake(RDIM_Arena *arena, RDIM_BakeParams *params)
27022707 dst -> unpacked_size = src -> size ;
27032708 }
27042709 }
2705-
2706- rdim_scratch_end (scratch );
27072710 return blobs ;
27082711}
0 commit comments