artifact cache waitable cache access; debugging / fixes; start plugging in file stream to artifact cache

This commit is contained in:
Ryan Fleury
2025-09-24 11:25:18 -07:00
parent 7e05a60ffe
commit e7368af35c
11 changed files with 260 additions and 179 deletions
+19 -80
View File
@@ -5,7 +5,7 @@
//~ rjf: Build Options
#define BUILD_TITLE "ryan_scratch"
#define OS_FEATURE_GRAPHICAL 1
#define BUILD_CONSOLE_INTERFACE 1
////////////////////////////////
//~ rjf: Includes
@@ -13,93 +13,32 @@
//- rjf: [h]
#include "base/base_inc.h"
#include "os/os_inc.h"
#include "render/render_inc.h"
#include "font_provider/font_provider_inc.h"
#include "font_cache/font_cache.h"
#include "draw/draw.h"
#include "content/content.h"
#include "artifact_cache/artifact_cache.h"
#include "file_stream/file_stream.h"
//- rjf: [c]
#include "base/base_inc.c"
#include "os/os_inc.c"
#include "render/render_inc.c"
#include "font_provider/font_provider_inc.c"
#include "font_cache/font_cache.c"
#include "draw/draw.c"
#include "content/content.c"
#include "artifact_cache/artifact_cache.c"
#include "file_stream/file_stream.c"
////////////////////////////////
//~ rjf: Globals
global OS_Handle window_os = {0};
global R_Handle window_r = {0};
////////////////////////////////
//~ rjf: Entry Points
internal B32
frame(void)
{
B32 quit = 0;
Temp scratch = scratch_begin(0, 0);
//- rjf: events test
OS_EventList events = os_get_events(scratch.arena, 0);
for(OS_Event *ev = events.first; ev != 0; ev = ev->next)
{
if(ev->kind != OS_EventKind_MouseMove)
{
String8 string = push_str8f(scratch.arena, "%S (%S)\n", os_string_from_event_kind(ev->kind), os_g_key_display_string_table[ev->key]);
printf("%.*s", str8_varg(string));
raddbg_log((char *)string.str);
fflush(stdout);
}
if(ev->kind == OS_EventKind_Press && ev->key == OS_Key_X)
{
*(volatile int *)0 = 0;
}
}
for(OS_Event *ev = events.first; ev != 0; ev = ev->next)
{
if(ev->kind == OS_EventKind_WindowClose)
{
quit = 1;
break;
}
}
//- rjf: drawing test
r_begin_frame();
r_window_begin_frame(window_os, window_r);
{
R_PassList passes = {0};
R_Pass *pass = r_pass_from_kind(scratch.arena, &passes, R_PassKind_UI);
R_PassParams_UI *pass_ui = pass->params_ui;
R_BatchGroup2DNode group = {0};
pass_ui->rects.first = pass_ui->rects.last = &group;
pass_ui->rects.count = 1;
group.batches = r_batch_list_make(sizeof(R_Rect2DInst));
group.params.xform = mat_3x3f32(1.f);
group.params.clip = os_client_rect_from_window(window_os);
Vec2F32 mouse = os_mouse_from_window(window_os);
R_Rect2DInst *inst = r_batch_list_push_inst(scratch.arena, &group.batches, 256);
MemoryZeroStruct(inst);
inst->dst = r2f32p(mouse.x+30, mouse.y+30, mouse.x+100, mouse.y+100);
inst->src = r2f32p(0, 0, 1, 1);
inst->colors[Corner_00] = inst->colors[Corner_01] = inst->colors[Corner_10] = inst->colors[Corner_11] = v4f32(1, 0, 0, 1);
inst->corner_radii[Corner_00] = inst->corner_radii[Corner_01] = inst->corner_radii[Corner_10] = inst->corner_radii[Corner_11] = 8.f;
r_window_submit(window_os, window_r, &passes);
}
r_window_end_frame(window_os, window_r);
r_end_frame();
scratch_end(scratch);
return quit;
}
//~ rjf: Entry Point
internal void
entry_point(CmdLine *cmdline)
{
window_os = os_window_open(r2f32p(0, 0, 1280, 720), OS_WindowFlag_UseDefaultPosition, str8_lit("Window"));
os_window_first_paint(window_os);
window_r = r_window_equip(window_os);
for(;!update(););
for(;;)
{
C_Key key = fs_key_from_path(str8_lit("C:/devel/raddebugger/build/x.dump"), os_now_microseconds() + 100000);
U128 hash = c_hash_from_key(key, 0);
printf("hash: 0x%I64x, 0x%I64x\n", hash.u64[0], hash.u64[1]);
fflush(stdout);
if(!u128_match(u128_zero(), hash))
{
break;
}
}
}