diff --git a/src/radbin/radbin.c b/src/radbin/radbin.c index fd3220dc..5424e039 100644 --- a/src/radbin/radbin.c +++ b/src/radbin/radbin.c @@ -775,7 +775,7 @@ rb_thread_entry_point(void *p) //- rjf: bake RDIM_BakeResults bake_results = {0}; - if(convert_done) ProfScope("bake") + ProfScope("bake") { bake_results = rdim_bake(arena, bake_params); } @@ -789,14 +789,19 @@ rb_thread_entry_point(void *p) case OutputKind_RDI: { // rjf: serialize - RDIM_SerializedSectionBundle serialized_section_bundle = {0}; - ProfScope("serialize") serialized_section_bundle = rdim_serialized_section_bundle_from_bake_results(&bake_results); + RDIM_SerializedSectionBundle *serialized_section_bundle = 0; + ProfScope("serialize") if(lane_idx() == 0) + { + serialized_section_bundle = push_array(arena, RDIM_SerializedSectionBundle, 1); + serialized_section_bundle[0] = rdim_serialized_section_bundle_from_bake_results(&bake_results); + } + lane_sync_u64(&serialized_section_bundle, 0); // rjf: compress - RDIM_SerializedSectionBundle serialized_section_bundle__compressed = serialized_section_bundle; + RDIM_SerializedSectionBundle serialized_section_bundle__compressed = serialized_section_bundle[0]; if(cmd_line_has_flag(cmdline, str8_lit("compress"))) ProfScope("compress") { - serialized_section_bundle__compressed = rdim_compress(arena, &serialized_section_bundle); + serialized_section_bundle__compressed = rdim_compress(arena, serialized_section_bundle); } // rjf: serialize diff --git a/src/rdi_make/rdi_make_local.c b/src/rdi_make/rdi_make_local.c index d6678622..90eebbcc 100644 --- a/src/rdi_make/rdi_make_local.c +++ b/src/rdi_make/rdi_make_local.c @@ -2969,18 +2969,23 @@ rdim_bake(Arena *arena, RDIM_BakeParams *params) internal RDIM_SerializedSectionBundle rdim_compress(Arena *arena, RDIM_SerializedSectionBundle *in) { - RDIM_SerializedSectionBundle out = {0}; + Temp scratch = scratch_begin(&arena, 1); + RDIM_SerializedSectionBundle out_ = {0}; + RDIM_SerializedSectionBundle *out = &out_; + lane_sync_u64(&out, 0); //- rjf: set up compression context rr_lzb_simple_context ctx = {0}; ctx.m_tableSizeBits = 14; - ctx.m_hashTable = push_array(arena, U16, 1<sections[k]; - RDIM_SerializedSection *dst = &out.sections[k]; + RDIM_SerializedSection *dst = &out->sections[k]; MemoryCopyStruct(dst, src); if(src->encoded_size != 0) { @@ -2991,6 +2996,8 @@ rdim_compress(Arena *arena, RDIM_SerializedSectionBundle *in) dst->encoding = RDI_SectionEncoding_LZB; } } + lane_sync(); - return out; + scratch_end(scratch); + return *out; }