mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-30 03:00:01 +00:00
df -> dbg_engine and dbg_gfx layers; df (core) -> d
This commit is contained in:
+95
-95
@@ -4,24 +4,24 @@
|
||||
////////////////////////////////
|
||||
//~ rjf: Generated Code
|
||||
|
||||
#define D_StackPushImpl(name_upper, name_lower, type, val) \
|
||||
D_Bucket *bucket = d_top_bucket();\
|
||||
#define DR_StackPushImpl(name_upper, name_lower, type, val) \
|
||||
DR_Bucket *bucket = dr_top_bucket();\
|
||||
type old_val = bucket->top_##name_lower->v;\
|
||||
D_##name_upper##Node *node = push_array(d_thread_ctx->arena, D_##name_upper##Node, 1);\
|
||||
DR_##name_upper##Node *node = push_array(dr_thread_ctx->arena, DR_##name_upper##Node, 1);\
|
||||
node->v = (val);\
|
||||
SLLStackPush(bucket->top_##name_lower, node);\
|
||||
bucket->stack_gen += 1;\
|
||||
return old_val
|
||||
|
||||
#define D_StackPopImpl(name_upper, name_lower, type) \
|
||||
D_Bucket *bucket = d_top_bucket();\
|
||||
#define DR_StackPopImpl(name_upper, name_lower, type) \
|
||||
DR_Bucket *bucket = dr_top_bucket();\
|
||||
type popped_val = bucket->top_##name_lower->v;\
|
||||
SLLStackPop(bucket->top_##name_lower);\
|
||||
bucket->stack_gen += 1;\
|
||||
return popped_val
|
||||
|
||||
#define D_StackTopImpl(name_upper, name_lower, type) \
|
||||
D_Bucket *bucket = d_top_bucket();\
|
||||
#define DR_StackTopImpl(name_upper, name_lower, type) \
|
||||
DR_Bucket *bucket = dr_top_bucket();\
|
||||
type top_val = bucket->top_##name_lower->v;\
|
||||
return top_val
|
||||
|
||||
@@ -31,7 +31,7 @@ return top_val
|
||||
//~ rjf: Basic Helpers
|
||||
|
||||
internal U64
|
||||
d_hash_from_string(String8 string)
|
||||
dr_hash_from_string(String8 string)
|
||||
{
|
||||
U64 result = 5381;
|
||||
for(U64 i = 0; i < string.size; i += 1)
|
||||
@@ -45,9 +45,9 @@ d_hash_from_string(String8 string)
|
||||
//~ rjf: Fancy String Type Functions
|
||||
|
||||
internal void
|
||||
d_fancy_string_list_push(Arena *arena, D_FancyStringList *list, D_FancyString *str)
|
||||
dr_fancy_string_list_push(Arena *arena, DR_FancyStringList *list, DR_FancyString *str)
|
||||
{
|
||||
D_FancyStringNode *n = push_array_no_zero(arena, D_FancyStringNode, 1);
|
||||
DR_FancyStringNode *n = push_array_no_zero(arena, DR_FancyStringNode, 1);
|
||||
MemoryCopyStruct(&n->v, str);
|
||||
SLLQueuePush(list->first, list->last, n);
|
||||
list->node_count += 1;
|
||||
@@ -55,7 +55,7 @@ d_fancy_string_list_push(Arena *arena, D_FancyStringList *list, D_FancyString *s
|
||||
}
|
||||
|
||||
internal void
|
||||
d_fancy_string_list_concat_in_place(D_FancyStringList *dst, D_FancyStringList *to_push)
|
||||
dr_fancy_string_list_concat_in_place(DR_FancyStringList *dst, DR_FancyStringList *to_push)
|
||||
{
|
||||
if(dst->last != 0 && to_push->first != 0)
|
||||
{
|
||||
@@ -72,13 +72,13 @@ d_fancy_string_list_concat_in_place(D_FancyStringList *dst, D_FancyStringList *t
|
||||
}
|
||||
|
||||
internal String8
|
||||
d_string_from_fancy_string_list(Arena *arena, D_FancyStringList *list)
|
||||
dr_string_from_fancy_string_list(Arena *arena, DR_FancyStringList *list)
|
||||
{
|
||||
String8 result = {0};
|
||||
result.size = list->total_size;
|
||||
result.str = push_array_no_zero(arena, U8, result.size);
|
||||
U64 idx = 0;
|
||||
for(D_FancyStringNode *n = list->first; n != 0; n = n->next)
|
||||
for(DR_FancyStringNode *n = list->first; n != 0; n = n->next)
|
||||
{
|
||||
MemoryCopy(result.str+idx, n->v.string.str, n->v.string.size);
|
||||
idx += n->v.string.size;
|
||||
@@ -86,15 +86,15 @@ d_string_from_fancy_string_list(Arena *arena, D_FancyStringList *list)
|
||||
return result;
|
||||
}
|
||||
|
||||
internal D_FancyRunList
|
||||
d_fancy_run_list_from_fancy_string_list(Arena *arena, F32 tab_size_px, FNT_RasterFlags flags, D_FancyStringList *strs)
|
||||
internal DR_FancyRunList
|
||||
dr_fancy_run_list_from_fancy_string_list(Arena *arena, F32 tab_size_px, FNT_RasterFlags flags, DR_FancyStringList *strs)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
D_FancyRunList run_list = {0};
|
||||
DR_FancyRunList run_list = {0};
|
||||
F32 base_align_px = 0;
|
||||
for(D_FancyStringNode *n = strs->first; n != 0; n = n->next)
|
||||
for(DR_FancyStringNode *n = strs->first; n != 0; n = n->next)
|
||||
{
|
||||
D_FancyRunNode *dst_n = push_array(arena, D_FancyRunNode, 1);
|
||||
DR_FancyRunNode *dst_n = push_array(arena, DR_FancyRunNode, 1);
|
||||
dst_n->v.run = fnt_push_run_from_string(arena, n->v.font, n->v.size, base_align_px, tab_size_px, flags, n->v.string);
|
||||
dst_n->v.color = n->v.color;
|
||||
dst_n->v.underline_thickness = n->v.underline_thickness;
|
||||
@@ -109,13 +109,13 @@ d_fancy_run_list_from_fancy_string_list(Arena *arena, F32 tab_size_px, FNT_Raste
|
||||
return run_list;
|
||||
}
|
||||
|
||||
internal D_FancyRunList
|
||||
d_fancy_run_list_copy(Arena *arena, D_FancyRunList *src)
|
||||
internal DR_FancyRunList
|
||||
dr_fancy_run_list_copy(Arena *arena, DR_FancyRunList *src)
|
||||
{
|
||||
D_FancyRunList dst = {0};
|
||||
for(D_FancyRunNode *src_n = src->first; src_n != 0; src_n = src_n->next)
|
||||
DR_FancyRunList dst = {0};
|
||||
for(DR_FancyRunNode *src_n = src->first; src_n != 0; src_n = src_n->next)
|
||||
{
|
||||
D_FancyRunNode *dst_n = push_array(arena, D_FancyRunNode, 1);
|
||||
DR_FancyRunNode *dst_n = push_array(arena, DR_FancyRunNode, 1);
|
||||
SLLQueuePush(dst.first, dst.last, dst_n);
|
||||
MemoryCopyStruct(&dst_n->v, &src_n->v);
|
||||
dst_n->v.run.pieces = fnt_piece_array_copy(arena, &src_n->v.run.pieces);
|
||||
@@ -131,22 +131,22 @@ d_fancy_run_list_copy(Arena *arena, D_FancyRunList *src)
|
||||
// (Frame boundaries)
|
||||
|
||||
internal void
|
||||
d_begin_frame(void)
|
||||
dr_begin_frame(void)
|
||||
{
|
||||
if(d_thread_ctx == 0)
|
||||
if(dr_thread_ctx == 0)
|
||||
{
|
||||
Arena *arena = arena_alloc(.reserve_size = GB(64), .commit_size = MB(8));
|
||||
d_thread_ctx = push_array(arena, D_ThreadCtx, 1);
|
||||
d_thread_ctx->arena = arena;
|
||||
d_thread_ctx->arena_frame_start_pos = arena_pos(arena);
|
||||
dr_thread_ctx = push_array(arena, DR_ThreadCtx, 1);
|
||||
dr_thread_ctx->arena = arena;
|
||||
dr_thread_ctx->arena_frame_start_pos = arena_pos(arena);
|
||||
}
|
||||
arena_pop_to(d_thread_ctx->arena, d_thread_ctx->arena_frame_start_pos);
|
||||
d_thread_ctx->free_bucket_selection = 0;
|
||||
d_thread_ctx->top_bucket = 0;
|
||||
arena_pop_to(dr_thread_ctx->arena, dr_thread_ctx->arena_frame_start_pos);
|
||||
dr_thread_ctx->free_bucket_selection = 0;
|
||||
dr_thread_ctx->top_bucket = 0;
|
||||
}
|
||||
|
||||
internal void
|
||||
d_submit_bucket(OS_Handle os_window, R_Handle r_window, D_Bucket *bucket)
|
||||
dr_submit_bucket(OS_Handle os_window, R_Handle r_window, DR_Bucket *bucket)
|
||||
{
|
||||
r_window_submit(os_window, r_window, &bucket->passes);
|
||||
}
|
||||
@@ -156,45 +156,45 @@ d_submit_bucket(OS_Handle os_window, R_Handle r_window, D_Bucket *bucket)
|
||||
//
|
||||
// (Bucket: Handle to sequence of many render passes, constructed by this layer)
|
||||
|
||||
internal D_Bucket *
|
||||
d_bucket_make(void)
|
||||
internal DR_Bucket *
|
||||
dr_bucket_make(void)
|
||||
{
|
||||
D_Bucket *bucket = push_array(d_thread_ctx->arena, D_Bucket, 1);
|
||||
D_BucketStackInits(bucket);
|
||||
DR_Bucket *bucket = push_array(dr_thread_ctx->arena, DR_Bucket, 1);
|
||||
DR_BucketStackInits(bucket);
|
||||
return bucket;
|
||||
}
|
||||
|
||||
internal void
|
||||
d_push_bucket(D_Bucket *bucket)
|
||||
dr_push_bucket(DR_Bucket *bucket)
|
||||
{
|
||||
D_BucketSelectionNode *node = d_thread_ctx->free_bucket_selection;
|
||||
DR_BucketSelectionNode *node = dr_thread_ctx->free_bucket_selection;
|
||||
if(node)
|
||||
{
|
||||
SLLStackPop(d_thread_ctx->free_bucket_selection);
|
||||
SLLStackPop(dr_thread_ctx->free_bucket_selection);
|
||||
}
|
||||
else
|
||||
{
|
||||
node = push_array(d_thread_ctx->arena, D_BucketSelectionNode, 1);
|
||||
node = push_array(dr_thread_ctx->arena, DR_BucketSelectionNode, 1);
|
||||
}
|
||||
SLLStackPush(d_thread_ctx->top_bucket, node);
|
||||
SLLStackPush(dr_thread_ctx->top_bucket, node);
|
||||
node->bucket = bucket;
|
||||
}
|
||||
|
||||
internal void
|
||||
d_pop_bucket(void)
|
||||
dr_pop_bucket(void)
|
||||
{
|
||||
D_BucketSelectionNode *node = d_thread_ctx->top_bucket;
|
||||
SLLStackPop(d_thread_ctx->top_bucket);
|
||||
SLLStackPush(d_thread_ctx->free_bucket_selection, node);
|
||||
DR_BucketSelectionNode *node = dr_thread_ctx->top_bucket;
|
||||
SLLStackPop(dr_thread_ctx->top_bucket);
|
||||
SLLStackPush(dr_thread_ctx->free_bucket_selection, node);
|
||||
}
|
||||
|
||||
internal D_Bucket *
|
||||
d_top_bucket(void)
|
||||
internal DR_Bucket *
|
||||
dr_top_bucket(void)
|
||||
{
|
||||
D_Bucket *bucket = 0;
|
||||
if(d_thread_ctx->top_bucket != 0)
|
||||
DR_Bucket *bucket = 0;
|
||||
if(dr_thread_ctx->top_bucket != 0)
|
||||
{
|
||||
bucket = d_thread_ctx->top_bucket->bucket;
|
||||
bucket = dr_thread_ctx->top_bucket->bucket;
|
||||
}
|
||||
return bucket;
|
||||
}
|
||||
@@ -214,10 +214,10 @@ d_top_bucket(void)
|
||||
//- rjf: rectangles
|
||||
|
||||
internal inline R_Rect2DInst *
|
||||
d_rect(Rng2F32 dst, Vec4F32 color, F32 corner_radius, F32 border_thickness, F32 edge_softness)
|
||||
dr_rect(Rng2F32 dst, Vec4F32 color, F32 corner_radius, F32 border_thickness, F32 edge_softness)
|
||||
{
|
||||
Arena *arena = d_thread_ctx->arena;
|
||||
D_Bucket *bucket = d_top_bucket();
|
||||
Arena *arena = dr_thread_ctx->arena;
|
||||
DR_Bucket *bucket = dr_top_bucket();
|
||||
R_Pass *pass = r_pass_from_kind(arena, &bucket->passes, R_PassKind_UI);
|
||||
R_PassParams_UI *params = pass->params_ui;
|
||||
R_BatchGroup2DList *rects = ¶ms->rects;
|
||||
@@ -255,10 +255,10 @@ d_rect(Rng2F32 dst, Vec4F32 color, F32 corner_radius, F32 border_thickness, F32
|
||||
//- rjf: images
|
||||
|
||||
internal inline R_Rect2DInst *
|
||||
d_img(Rng2F32 dst, Rng2F32 src, R_Handle texture, Vec4F32 color, F32 corner_radius, F32 border_thickness, F32 edge_softness)
|
||||
dr_img(Rng2F32 dst, Rng2F32 src, R_Handle texture, Vec4F32 color, F32 corner_radius, F32 border_thickness, F32 edge_softness)
|
||||
{
|
||||
Arena *arena = d_thread_ctx->arena;
|
||||
D_Bucket *bucket = d_top_bucket();
|
||||
Arena *arena = dr_thread_ctx->arena;
|
||||
DR_Bucket *bucket = dr_top_bucket();
|
||||
R_Pass *pass = r_pass_from_kind(arena, &bucket->passes, R_PassKind_UI);
|
||||
R_PassParams_UI *params = pass->params_ui;
|
||||
R_BatchGroup2DList *rects = ¶ms->rects;
|
||||
@@ -300,14 +300,14 @@ d_img(Rng2F32 dst, Rng2F32 src, R_Handle texture, Vec4F32 color, F32 corner_radi
|
||||
//- rjf: blurs
|
||||
|
||||
internal R_PassParams_Blur *
|
||||
d_blur(Rng2F32 rect, F32 blur_size, F32 corner_radius)
|
||||
dr_blur(Rng2F32 rect, F32 blur_size, F32 corner_radius)
|
||||
{
|
||||
Arena *arena = d_thread_ctx->arena;
|
||||
D_Bucket *bucket = d_top_bucket();
|
||||
Arena *arena = dr_thread_ctx->arena;
|
||||
DR_Bucket *bucket = dr_top_bucket();
|
||||
R_Pass *pass = r_pass_from_kind(arena, &bucket->passes, R_PassKind_Blur);
|
||||
R_PassParams_Blur *params = pass->params_blur;
|
||||
params->rect = rect;
|
||||
params->clip = d_top_clip();
|
||||
params->clip = dr_top_clip();
|
||||
params->blur_size = blur_size;
|
||||
params->corner_radii[Corner_00] = corner_radius;
|
||||
params->corner_radii[Corner_01] = corner_radius;
|
||||
@@ -319,10 +319,10 @@ d_blur(Rng2F32 rect, F32 blur_size, F32 corner_radius)
|
||||
//- rjf: 3d rendering pass params
|
||||
|
||||
internal R_PassParams_Geo3D *
|
||||
d_geo3d_begin(Rng2F32 viewport, Mat4x4F32 view, Mat4x4F32 projection)
|
||||
dr_geo3d_begin(Rng2F32 viewport, Mat4x4F32 view, Mat4x4F32 projection)
|
||||
{
|
||||
Arena *arena = d_thread_ctx->arena;
|
||||
D_Bucket *bucket = d_top_bucket();
|
||||
Arena *arena = dr_thread_ctx->arena;
|
||||
DR_Bucket *bucket = dr_top_bucket();
|
||||
R_Pass *pass = r_pass_from_kind(arena, &bucket->passes, R_PassKind_Geo3D);
|
||||
R_PassParams_Geo3D *params = pass->params_geo3d;
|
||||
params->viewport = viewport;
|
||||
@@ -334,10 +334,10 @@ d_geo3d_begin(Rng2F32 viewport, Mat4x4F32 view, Mat4x4F32 projection)
|
||||
//- rjf: meshes
|
||||
|
||||
internal R_Mesh3DInst *
|
||||
d_mesh(R_Handle mesh_vertices, R_Handle mesh_indices, R_GeoTopologyKind mesh_geo_topology, R_GeoVertexFlags mesh_geo_vertex_flags, R_Handle albedo_tex, Mat4x4F32 inst_xform)
|
||||
dr_mesh(R_Handle mesh_vertices, R_Handle mesh_indices, R_GeoTopologyKind mesh_geo_topology, R_GeoVertexFlags mesh_geo_vertex_flags, R_Handle albedo_tex, Mat4x4F32 inst_xform)
|
||||
{
|
||||
Arena *arena = d_thread_ctx->arena;
|
||||
D_Bucket *bucket = d_top_bucket();
|
||||
Arena *arena = dr_thread_ctx->arena;
|
||||
DR_Bucket *bucket = dr_top_bucket();
|
||||
R_Pass *pass = r_pass_from_kind(arena, &bucket->passes, R_PassKind_Geo3D);
|
||||
R_PassParams_Geo3D *params = pass->params_geo3d;
|
||||
|
||||
@@ -362,9 +362,9 @@ d_mesh(R_Handle mesh_vertices, R_Handle mesh_indices, R_GeoTopologyKind mesh_geo
|
||||
(U64)mesh_geo_vertex_flags,
|
||||
albedo_tex.u64[0],
|
||||
albedo_tex.u64[1],
|
||||
(U64)d_top_tex2d_sample_kind(),
|
||||
(U64)dr_top_tex2d_sample_kind(),
|
||||
};
|
||||
hash = d_hash_from_string(str8((U8 *)buffer, sizeof(buffer)));
|
||||
hash = dr_hash_from_string(str8((U8 *)buffer, sizeof(buffer)));
|
||||
slot_idx = hash%params->mesh_batches.slots_count;
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ d_mesh(R_Handle mesh_vertices, R_Handle mesh_indices, R_GeoTopologyKind mesh_geo
|
||||
node->params.mesh_geo_topology = mesh_geo_topology;
|
||||
node->params.mesh_geo_vertex_flags = mesh_geo_vertex_flags;
|
||||
node->params.albedo_tex = albedo_tex;
|
||||
node->params.albedo_tex_sample_kind = d_top_tex2d_sample_kind();
|
||||
node->params.albedo_tex_sample_kind = dr_top_tex2d_sample_kind();
|
||||
node->params.xform = mat_4x4f32(1.f);
|
||||
}
|
||||
|
||||
@@ -406,12 +406,12 @@ d_mesh(R_Handle mesh_vertices, R_Handle mesh_indices, R_GeoTopologyKind mesh_geo
|
||||
//- rjf: collating one pre-prepped bucket into parent bucket
|
||||
|
||||
internal void
|
||||
d_sub_bucket(D_Bucket *bucket)
|
||||
dr_sub_bucket(DR_Bucket *bucket)
|
||||
{
|
||||
Arena *arena = d_thread_ctx->arena;
|
||||
D_Bucket *src = bucket;
|
||||
D_Bucket *dst = d_top_bucket();
|
||||
Rng2F32 dst_clip = d_top_clip();
|
||||
Arena *arena = dr_thread_ctx->arena;
|
||||
DR_Bucket *src = bucket;
|
||||
DR_Bucket *dst = dr_top_bucket();
|
||||
Rng2F32 dst_clip = dr_top_clip();
|
||||
B32 dst_clip_is_set = !(dst_clip.x0 == 0 && dst_clip.x1 == 0 &&
|
||||
dst_clip.y0 == 0 && dst_clip.y1 == 0);
|
||||
for(R_PassNode *n = src->passes.first; n != 0; n = n->next)
|
||||
@@ -434,7 +434,7 @@ d_sub_bucket(D_Bucket *bucket)
|
||||
dst_ui->rects.count += 1;
|
||||
MemoryCopyStruct(&dst_group_n->params, &src_group_n->params);
|
||||
dst_group_n->batches = src_group_n->batches;
|
||||
dst_group_n->params.xform = d_top_xform2d();
|
||||
dst_group_n->params.xform = dr_top_xform2d();
|
||||
if(dst_clip_is_set)
|
||||
{
|
||||
B32 clip_is_set = !(dst_group_n->params.clip.x0 == 0 &&
|
||||
@@ -455,7 +455,7 @@ d_sub_bucket(D_Bucket *bucket)
|
||||
//- rjf: text
|
||||
|
||||
internal void
|
||||
d_truncated_fancy_run_list(Vec2F32 p, D_FancyRunList *list, F32 max_x, FNT_Run trailer_run)
|
||||
dr_truncated_fancy_run_list(Vec2F32 p, DR_FancyRunList *list, F32 max_x, FNT_Run trailer_run)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
|
||||
@@ -467,9 +467,9 @@ d_truncated_fancy_run_list(Vec2F32 p, D_FancyRunList *list, F32 max_x, FNT_Run t
|
||||
B32 trailer_found = 0;
|
||||
Vec4F32 last_color = {0};
|
||||
U64 byte_off = 0;
|
||||
for(D_FancyRunNode *n = list->first; n != 0; n = n->next)
|
||||
for(DR_FancyRunNode *n = list->first; n != 0; n = n->next)
|
||||
{
|
||||
D_FancyRun *fr = &n->v;
|
||||
DR_FancyRun *fr = &n->v;
|
||||
Rng1F32 pixel_range = {0};
|
||||
{
|
||||
pixel_range.min = 100000;
|
||||
@@ -501,8 +501,8 @@ d_truncated_fancy_run_list(Vec2F32 p, D_FancyRunList *list, F32 max_x, FNT_Run t
|
||||
p.y + piece->offset.y + size.y);
|
||||
if(!r_handle_match(texture, r_handle_zero()))
|
||||
{
|
||||
d_img(dst, src, texture, fr->color, 0, 0, 0);
|
||||
//d_rect(dst, v4f32(0, 1, 0, 0.5f), 0, 1.f, 0.f);
|
||||
dr_img(dst, src, texture, fr->color, 0, 0, 0);
|
||||
//dr_rect(dst, v4f32(0, 1, 0, 0.5f), 0, 1.f, 0.f);
|
||||
}
|
||||
advance += piece->advance;
|
||||
pixel_range.min = Min(pre_advance, pixel_range.min);
|
||||
@@ -510,15 +510,15 @@ d_truncated_fancy_run_list(Vec2F32 p, D_FancyRunList *list, F32 max_x, FNT_Run t
|
||||
}
|
||||
if(fr->underline_thickness > 0)
|
||||
{
|
||||
d_rect(r2f32p(p.x + pixel_range.min,
|
||||
p.y+fr->run.descent+fr->run.descent/8,
|
||||
p.x + pixel_range.max,
|
||||
p.y+fr->run.descent+fr->run.descent/8+fr->underline_thickness),
|
||||
fr->color, 0, 0, 0.8f);
|
||||
dr_rect(r2f32p(p.x + pixel_range.min,
|
||||
p.y+fr->run.descent+fr->run.descent/8,
|
||||
p.x + pixel_range.max,
|
||||
p.y+fr->run.descent+fr->run.descent/8+fr->underline_thickness),
|
||||
fr->color, 0, 0, 0.8f);
|
||||
}
|
||||
if(fr->strikethrough_thickness > 0)
|
||||
{
|
||||
d_rect(r2f32p(p.x+pre_advance, p.y+fr->run.descent - fr->run.ascent/2, p.x+advance, p.y+fr->run.descent - fr->run.ascent/2 + fr->strikethrough_thickness), fr->color, 0, 0, 1.f);
|
||||
dr_rect(r2f32p(p.x+pre_advance, p.y+fr->run.descent - fr->run.ascent/2, p.x+advance, p.y+fr->run.descent - fr->run.ascent/2 + fr->strikethrough_thickness), fr->color, 0, 0, 1.f);
|
||||
}
|
||||
if(trailer_found)
|
||||
{
|
||||
@@ -547,7 +547,7 @@ d_truncated_fancy_run_list(Vec2F32 p, D_FancyRunList *list, F32 max_x, FNT_Run t
|
||||
p.y + piece->offset.y + size.y);
|
||||
if(!r_handle_match(texture, r_handle_zero()))
|
||||
{
|
||||
d_img(dst, src, texture, trailer_piece_color, 0, 0, 0);
|
||||
dr_img(dst, src, texture, trailer_piece_color, 0, 0, 0);
|
||||
trailer_piece_color.w *= 0.5f;
|
||||
}
|
||||
advance += piece->advance;
|
||||
@@ -558,7 +558,7 @@ d_truncated_fancy_run_list(Vec2F32 p, D_FancyRunList *list, F32 max_x, FNT_Run t
|
||||
}
|
||||
|
||||
internal void
|
||||
d_truncated_fancy_run_fuzzy_matches(Vec2F32 p, D_FancyRunList *list, F32 max_x, FuzzyMatchRangeList *ranges, Vec4F32 color)
|
||||
dr_truncated_fancy_run_fuzzy_matches(Vec2F32 p, DR_FancyRunList *list, F32 max_x, FuzzyMatchRangeList *ranges, Vec4F32 color)
|
||||
{
|
||||
for(FuzzyMatchRangeNode *match_n = ranges->first; match_n != 0; match_n = match_n->next)
|
||||
{
|
||||
@@ -573,9 +573,9 @@ d_truncated_fancy_run_fuzzy_matches(Vec2F32 p, D_FancyRunList *list, F32 max_x,
|
||||
F32 advance = 0;
|
||||
F32 ascent = 0;
|
||||
F32 descent = 0;
|
||||
for(D_FancyRunNode *fr_n = list->first; fr_n != 0; fr_n = fr_n->next)
|
||||
for(DR_FancyRunNode *fr_n = list->first; fr_n != 0; fr_n = fr_n->next)
|
||||
{
|
||||
D_FancyRun *fr = &fr_n->v;
|
||||
DR_FancyRun *fr = &fr_n->v;
|
||||
FNT_Run *run = &fr->run;
|
||||
ascent = run->ascent;
|
||||
descent = run->descent;
|
||||
@@ -601,13 +601,13 @@ d_truncated_fancy_run_fuzzy_matches(Vec2F32 p, D_FancyRunList *list, F32 max_x,
|
||||
p.y - descent - ascent + ascent/8.f + list->dim.y);
|
||||
rect.x0 = Min(rect.x0, p.x+max_x);
|
||||
rect.x1 = Min(rect.x1, p.x+max_x);
|
||||
d_rect(rect, color, (descent+ascent)/4.f, 0, 1.f);
|
||||
dr_rect(rect, color, (descent+ascent)/4.f, 0, 1.f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void
|
||||
d_text_run(Vec2F32 p, Vec4F32 color, FNT_Run run)
|
||||
dr_text_run(Vec2F32 p, Vec4F32 color, FNT_Run run)
|
||||
{
|
||||
F32 advance = 0;
|
||||
FNT_Piece *piece_first = run.pieces.v;
|
||||
@@ -625,17 +625,17 @@ d_text_run(Vec2F32 p, Vec4F32 color, FNT_Run run)
|
||||
p.y + piece->offset.y + size.y);
|
||||
if(size.x != 0 && size.y != 0 && !r_handle_match(texture, r_handle_zero()))
|
||||
{
|
||||
d_img(dst, src, texture, color, 0, 0, 0);
|
||||
dr_img(dst, src, texture, color, 0, 0, 0);
|
||||
}
|
||||
advance += piece->advance;
|
||||
}
|
||||
}
|
||||
|
||||
internal void
|
||||
d_text(FNT_Tag font, F32 size, F32 base_align_px, F32 tab_size_px, FNT_RasterFlags flags, Vec2F32 p, Vec4F32 color, String8 string)
|
||||
dr_text(FNT_Tag font, F32 size, F32 base_align_px, F32 tab_size_px, FNT_RasterFlags flags, Vec2F32 p, Vec4F32 color, String8 string)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
FNT_Run run = fnt_push_run_from_string(scratch.arena, font, size, base_align_px, tab_size_px, flags, string);
|
||||
d_text_run(p, color, run);
|
||||
dr_text_run(p, color, run);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
+71
-71
@@ -7,8 +7,8 @@
|
||||
////////////////////////////////
|
||||
//~ rjf: Fancy String Types
|
||||
|
||||
typedef struct D_FancyString D_FancyString;
|
||||
struct D_FancyString
|
||||
typedef struct DR_FancyString DR_FancyString;
|
||||
struct DR_FancyString
|
||||
{
|
||||
FNT_Tag font;
|
||||
String8 string;
|
||||
@@ -18,24 +18,24 @@ struct D_FancyString
|
||||
F32 strikethrough_thickness;
|
||||
};
|
||||
|
||||
typedef struct D_FancyStringNode D_FancyStringNode;
|
||||
struct D_FancyStringNode
|
||||
typedef struct DR_FancyStringNode DR_FancyStringNode;
|
||||
struct DR_FancyStringNode
|
||||
{
|
||||
D_FancyStringNode *next;
|
||||
D_FancyString v;
|
||||
DR_FancyStringNode *next;
|
||||
DR_FancyString v;
|
||||
};
|
||||
|
||||
typedef struct D_FancyStringList D_FancyStringList;
|
||||
struct D_FancyStringList
|
||||
typedef struct DR_FancyStringList DR_FancyStringList;
|
||||
struct DR_FancyStringList
|
||||
{
|
||||
D_FancyStringNode *first;
|
||||
D_FancyStringNode *last;
|
||||
DR_FancyStringNode *first;
|
||||
DR_FancyStringNode *last;
|
||||
U64 node_count;
|
||||
U64 total_size;
|
||||
};
|
||||
|
||||
typedef struct D_FancyRun D_FancyRun;
|
||||
struct D_FancyRun
|
||||
typedef struct DR_FancyRun DR_FancyRun;
|
||||
struct DR_FancyRun
|
||||
{
|
||||
FNT_Run run;
|
||||
Vec4F32 color;
|
||||
@@ -43,18 +43,18 @@ struct D_FancyRun
|
||||
F32 strikethrough_thickness;
|
||||
};
|
||||
|
||||
typedef struct D_FancyRunNode D_FancyRunNode;
|
||||
struct D_FancyRunNode
|
||||
typedef struct DR_FancyRunNode DR_FancyRunNode;
|
||||
struct DR_FancyRunNode
|
||||
{
|
||||
D_FancyRunNode *next;
|
||||
D_FancyRun v;
|
||||
DR_FancyRunNode *next;
|
||||
DR_FancyRun v;
|
||||
};
|
||||
|
||||
typedef struct D_FancyRunList D_FancyRunList;
|
||||
struct D_FancyRunList
|
||||
typedef struct DR_FancyRunList DR_FancyRunList;
|
||||
struct DR_FancyRunList
|
||||
{
|
||||
D_FancyRunNode *first;
|
||||
D_FancyRunNode *last;
|
||||
DR_FancyRunNode *first;
|
||||
DR_FancyRunNode *last;
|
||||
U64 node_count;
|
||||
Vec2F32 dim;
|
||||
};
|
||||
@@ -67,94 +67,94 @@ struct D_FancyRunList
|
||||
////////////////////////////////
|
||||
//~ rjf: Draw Bucket Types
|
||||
|
||||
typedef struct D_Bucket D_Bucket;
|
||||
struct D_Bucket
|
||||
typedef struct DR_Bucket DR_Bucket;
|
||||
struct DR_Bucket
|
||||
{
|
||||
R_PassList passes;
|
||||
U64 stack_gen;
|
||||
U64 last_cmd_stack_gen;
|
||||
D_BucketStackDecls;
|
||||
DR_BucketStackDecls;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Thread Context
|
||||
|
||||
typedef struct D_BucketSelectionNode D_BucketSelectionNode;
|
||||
struct D_BucketSelectionNode
|
||||
typedef struct DR_BucketSelectionNode DR_BucketSelectionNode;
|
||||
struct DR_BucketSelectionNode
|
||||
{
|
||||
D_BucketSelectionNode *next;
|
||||
D_Bucket *bucket;
|
||||
DR_BucketSelectionNode *next;
|
||||
DR_Bucket *bucket;
|
||||
};
|
||||
|
||||
typedef struct D_ThreadCtx D_ThreadCtx;
|
||||
struct D_ThreadCtx
|
||||
typedef struct DR_ThreadCtx DR_ThreadCtx;
|
||||
struct DR_ThreadCtx
|
||||
{
|
||||
Arena *arena;
|
||||
U64 arena_frame_start_pos;
|
||||
D_BucketSelectionNode *top_bucket;
|
||||
D_BucketSelectionNode *free_bucket_selection;
|
||||
DR_BucketSelectionNode *top_bucket;
|
||||
DR_BucketSelectionNode *free_bucket_selection;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Globals
|
||||
|
||||
thread_static D_ThreadCtx *d_thread_ctx = 0;
|
||||
thread_static DR_ThreadCtx *dr_thread_ctx = 0;
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Basic Helpers
|
||||
|
||||
internal U64 d_hash_from_string(String8 string);
|
||||
internal U64 dr_hash_from_string(String8 string);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Fancy String Type Functions
|
||||
|
||||
internal void d_fancy_string_list_push(Arena *arena, D_FancyStringList *list, D_FancyString *str);
|
||||
internal void d_fancy_string_list_concat_in_place(D_FancyStringList *dst, D_FancyStringList *to_push);
|
||||
internal String8 d_string_from_fancy_string_list(Arena *arena, D_FancyStringList *list);
|
||||
internal D_FancyRunList d_fancy_run_list_from_fancy_string_list(Arena *arena, F32 tab_size_px, FNT_RasterFlags flags, D_FancyStringList *strs);
|
||||
internal D_FancyRunList d_fancy_run_list_copy(Arena *arena, D_FancyRunList *src);
|
||||
internal void dr_fancy_string_list_push(Arena *arena, DR_FancyStringList *list, DR_FancyString *str);
|
||||
internal void dr_fancy_string_list_concat_in_place(DR_FancyStringList *dst, DR_FancyStringList *to_push);
|
||||
internal String8 dr_string_from_fancy_string_list(Arena *arena, DR_FancyStringList *list);
|
||||
internal DR_FancyRunList dr_fancy_run_list_from_fancy_string_list(Arena *arena, F32 tab_size_px, FNT_RasterFlags flags, DR_FancyStringList *strs);
|
||||
internal DR_FancyRunList dr_fancy_run_list_copy(Arena *arena, DR_FancyRunList *src);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Top-Level API
|
||||
//
|
||||
// (Frame boundaries & bucket submission)
|
||||
|
||||
internal void d_begin_frame(void);
|
||||
internal void d_submit_bucket(OS_Handle os_window, R_Handle r_window, D_Bucket *bucket);
|
||||
internal void dr_begin_frame(void);
|
||||
internal void dr_submit_bucket(OS_Handle os_window, R_Handle r_window, DR_Bucket *bucket);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Bucket Construction & Selection API
|
||||
//
|
||||
// (Bucket: Handle to sequence of many render passes, constructed by this layer)
|
||||
|
||||
internal D_Bucket *d_bucket_make(void);
|
||||
internal void d_push_bucket(D_Bucket *bucket);
|
||||
internal void d_pop_bucket(void);
|
||||
internal D_Bucket *d_top_bucket(void);
|
||||
#define D_BucketScope(b) DeferLoop(d_push_bucket(b), d_pop_bucket())
|
||||
internal DR_Bucket *dr_bucket_make(void);
|
||||
internal void dr_push_bucket(DR_Bucket *bucket);
|
||||
internal void dr_pop_bucket(void);
|
||||
internal DR_Bucket *dr_top_bucket(void);
|
||||
#define D_BucketScope(b) DeferLoop(dr_push_bucket(b), dr_pop_bucket())
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Bucket Stacks
|
||||
//
|
||||
// (Pushing/popping implicit draw parameters)
|
||||
|
||||
internal R_Tex2DSampleKind d_push_tex2d_sample_kind(R_Tex2DSampleKind v);
|
||||
internal Mat3x3F32 d_push_xform2d(Mat3x3F32 v);
|
||||
internal Rng2F32 d_push_clip(Rng2F32 v);
|
||||
internal F32 d_push_transparency(F32 v);
|
||||
internal R_Tex2DSampleKind d_pop_tex2d_sample_kind(void);
|
||||
internal Mat3x3F32 d_pop_xform2d(void);
|
||||
internal Rng2F32 d_pop_clip(void);
|
||||
internal F32 d_pop_transparency(void);
|
||||
internal R_Tex2DSampleKind d_top_tex2d_sample_kind(void);
|
||||
internal Mat3x3F32 d_top_xform2d(void);
|
||||
internal Rng2F32 d_top_clip(void);
|
||||
internal F32 d_top_transparency(void);
|
||||
internal R_Tex2DSampleKind dr_push_tex2d_sample_kind(R_Tex2DSampleKind v);
|
||||
internal Mat3x3F32 dr_push_xform2d(Mat3x3F32 v);
|
||||
internal Rng2F32 dr_push_clip(Rng2F32 v);
|
||||
internal F32 dr_push_transparency(F32 v);
|
||||
internal R_Tex2DSampleKind dr_pop_tex2d_sample_kind(void);
|
||||
internal Mat3x3F32 dr_pop_xform2d(void);
|
||||
internal Rng2F32 dr_pop_clip(void);
|
||||
internal F32 dr_pop_transparency(void);
|
||||
internal R_Tex2DSampleKind dr_top_tex2d_sample_kind(void);
|
||||
internal Mat3x3F32 dr_top_xform2d(void);
|
||||
internal Rng2F32 dr_top_clip(void);
|
||||
internal F32 dr_top_transparency(void);
|
||||
|
||||
#define D_Tex2DSampleKindScope(v) DeferLoop(d_push_tex2d_sample_kind(v), d_pop_tex2d_sample_kind())
|
||||
#define D_XForm2DScope(v) DeferLoop(d_push_xform2d(v), d_pop_xform2d())
|
||||
#define D_ClipScope(v) DeferLoop(d_push_clip(v), d_pop_clip())
|
||||
#define D_TransparencyScope(v) DeferLoop(d_push_transparency(v), d_pop_transparency())
|
||||
#define DR_Tex2DSampleKindScope(v) DeferLoop(dr_push_tex2d_sample_kind(v), dr_pop_tex2d_sample_kind())
|
||||
#define DR_XForm2DScope(v) DeferLoop(dr_push_xform2d(v), dr_pop_xform2d())
|
||||
#define DR_ClipScope(v) DeferLoop(dr_push_clip(v), dr_pop_clip())
|
||||
#define DR_TransparencyScope(v) DeferLoop(dr_push_transparency(v), dr_pop_transparency())
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Core Draw Calls
|
||||
@@ -162,30 +162,30 @@ internal F32 d_top_transparency(void);
|
||||
// (Apply to the calling thread's currently selected bucket)
|
||||
|
||||
//- rjf: rectangles
|
||||
internal inline R_Rect2DInst *d_rect(Rng2F32 dst, Vec4F32 color, F32 corner_radius, F32 border_thickness, F32 edge_softness);
|
||||
internal inline R_Rect2DInst *dr_rect(Rng2F32 dst, Vec4F32 color, F32 corner_radius, F32 border_thickness, F32 edge_softness);
|
||||
|
||||
//- rjf: images
|
||||
internal inline R_Rect2DInst *d_img(Rng2F32 dst, Rng2F32 src, R_Handle texture, Vec4F32 color, F32 corner_radius, F32 border_thickness, F32 edge_softness);
|
||||
internal inline R_Rect2DInst *dr_img(Rng2F32 dst, Rng2F32 src, R_Handle texture, Vec4F32 color, F32 corner_radius, F32 border_thickness, F32 edge_softness);
|
||||
|
||||
//- rjf: blurs
|
||||
internal R_PassParams_Blur *d_blur(Rng2F32 rect, F32 blur_size, F32 corner_radius);
|
||||
internal R_PassParams_Blur *dr_blur(Rng2F32 rect, F32 blur_size, F32 corner_radius);
|
||||
|
||||
//- rjf: 3d rendering pass params
|
||||
internal R_PassParams_Geo3D *d_geo3d_begin(Rng2F32 viewport, Mat4x4F32 view, Mat4x4F32 projection);
|
||||
internal R_PassParams_Geo3D *dr_geo3d_begin(Rng2F32 viewport, Mat4x4F32 view, Mat4x4F32 projection);
|
||||
|
||||
//- rjf: meshes
|
||||
internal R_Mesh3DInst *d_mesh(R_Handle mesh_vertices, R_Handle mesh_indices, R_GeoTopologyKind mesh_geo_topology, R_GeoVertexFlags mesh_geo_vertex_flags, R_Handle albedo_tex, Mat4x4F32 inst_xform);
|
||||
internal R_Mesh3DInst *dr_mesh(R_Handle mesh_vertices, R_Handle mesh_indices, R_GeoTopologyKind mesh_geo_topology, R_GeoVertexFlags mesh_geo_vertex_flags, R_Handle albedo_tex, Mat4x4F32 inst_xform);
|
||||
|
||||
//- rjf: collating one pre-prepped bucket into parent bucket
|
||||
internal void d_sub_bucket(D_Bucket *bucket);
|
||||
internal void dr_sub_bucket(DR_Bucket *bucket);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Draw Call Helpers
|
||||
|
||||
//- rjf: text
|
||||
internal void d_truncated_fancy_run_list(Vec2F32 p, D_FancyRunList *list, F32 max_x, FNT_Run trailer_run);
|
||||
internal void d_truncated_fancy_run_fuzzy_matches(Vec2F32 p, D_FancyRunList *list, F32 max_x, FuzzyMatchRangeList *ranges, Vec4F32 color);
|
||||
internal void d_text_run(Vec2F32 p, Vec4F32 color, FNT_Run run);
|
||||
internal void d_text(FNT_Tag font, F32 size, F32 base_align_px, F32 tab_size_px, FNT_RasterFlags flags, Vec2F32 p, Vec4F32 color, String8 string);
|
||||
internal void dr_truncated_fancy_run_list(Vec2F32 p, DR_FancyRunList *list, F32 max_x, FNT_Run trailer_run);
|
||||
internal void dr_truncated_fancy_run_fuzzy_matches(Vec2F32 p, DR_FancyRunList *list, F32 max_x, FuzzyMatchRangeList *ranges, Vec4F32 color);
|
||||
internal void dr_text_run(Vec2F32 p, Vec4F32 color, FNT_Run run);
|
||||
internal void dr_text(FNT_Tag font, F32 size, F32 base_align_px, F32 tab_size_px, FNT_RasterFlags flags, Vec2F32 p, Vec4F32 color, String8 string);
|
||||
|
||||
#endif // DRAW_H
|
||||
|
||||
+14
-14
@@ -2,7 +2,7 @@
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
@table(name, name_lower, type, default_init)
|
||||
D_StackTable:
|
||||
DR_StackTable:
|
||||
{
|
||||
{Tex2DSampleKind tex2d_sample_kind R_Tex2DSampleKind `R_Tex2DSampleKind_Nearest` }
|
||||
{XForm2D xform2d Mat3x3F32 `{1, 0, 0, 0, 1, 0, 0, 0, 1}` }
|
||||
@@ -12,47 +12,47 @@ D_StackTable:
|
||||
|
||||
@gen
|
||||
{
|
||||
@expand(D_StackTable a) `typedef struct D_$(a.name)Node D_$(a.name)Node; struct D_$(a.name)Node {D_$(a.name)Node *next; $(a.type) v;};`;
|
||||
@expand(DR_StackTable a) `typedef struct DR_$(a.name)Node DR_$(a.name)Node; struct DR_$(a.name)Node {DR_$(a.name)Node *next; $(a.type) v;};`;
|
||||
}
|
||||
|
||||
@gen
|
||||
{
|
||||
`#define D_BucketStackDecls struct{\\`;
|
||||
@expand(D_StackTable a) `D_$(a.name)Node *top_$(a.name_lower);\\`;
|
||||
`#define DR_BucketStackDecls struct{\\`;
|
||||
@expand(DR_StackTable a) `DR_$(a.name)Node *top_$(a.name_lower);\\`;
|
||||
`}`;
|
||||
}
|
||||
|
||||
@gen
|
||||
{
|
||||
@expand(D_StackTable a) `read_only global D_$(a.name)Node d_nil_$(a.name_lower) = {0, $(a.default_init)};`;
|
||||
@expand(DR_StackTable a) `read_only global DR_$(a.name)Node dr_nil_$(a.name_lower) = {0, $(a.default_init)};`;
|
||||
}
|
||||
|
||||
@gen
|
||||
{
|
||||
`#define D_BucketStackInits(b) do{\\`;
|
||||
@expand(D_StackTable a) `(b)->top_$(a.name_lower) = &d_nil_$(a.name_lower);\\`;
|
||||
`#define DR_BucketStackInits(b) do{\\`;
|
||||
@expand(DR_StackTable a) `(b)->top_$(a.name_lower) = &dr_nil_$(a.name_lower);\\`;
|
||||
`}while(0)`;
|
||||
}
|
||||
|
||||
@gen
|
||||
{
|
||||
`#if 0`;
|
||||
@expand(D_StackTable a) `internal $(a.type) $(=>35) d_push_$(a.name_lower)($(a.type) v);`;
|
||||
@expand(D_StackTable a) `internal $(a.type) $(=>35) d_pop_$(a.name_lower)(void);`;
|
||||
@expand(D_StackTable a) `internal $(a.type) $(=>35) d_top_$(a.name_lower)(void);`;
|
||||
@expand(DR_StackTable a) `internal $(a.type) $(=>35) dr_push_$(a.name_lower)($(a.type) v);`;
|
||||
@expand(DR_StackTable a) `internal $(a.type) $(=>35) dr_pop_$(a.name_lower)(void);`;
|
||||
@expand(DR_StackTable a) `internal $(a.type) $(=>35) dr_top_$(a.name_lower)(void);`;
|
||||
`#endif`;
|
||||
}
|
||||
|
||||
@gen @c_file
|
||||
{
|
||||
@expand(D_StackTable a) `internal $(a.type) $(=>35) d_push_$(a.name_lower)($(a.type) v) {D_StackPushImpl($(a.name), $(a.name_lower), $(a.type), v);}`;
|
||||
@expand(D_StackTable a) `internal $(a.type) $(=>35) d_pop_$(a.name_lower)(void) {D_StackPopImpl($(a.name), $(a.name_lower), $(a.type));}`;
|
||||
@expand(D_StackTable a) `internal $(a.type) $(=>35) d_top_$(a.name_lower)(void) {D_StackTopImpl($(a.name), $(a.name_lower), $(a.type));}`;
|
||||
@expand(DR_StackTable a) `internal $(a.type) $(=>35) dr_push_$(a.name_lower)($(a.type) v) {DR_StackPushImpl($(a.name), $(a.name_lower), $(a.type), v);}`;
|
||||
@expand(DR_StackTable a) `internal $(a.type) $(=>35) dr_pop_$(a.name_lower)(void) {DR_StackPopImpl($(a.name), $(a.name_lower), $(a.type));}`;
|
||||
@expand(DR_StackTable a) `internal $(a.type) $(=>35) dr_top_$(a.name_lower)(void) {DR_StackTopImpl($(a.name), $(a.name_lower), $(a.type));}`;
|
||||
}
|
||||
|
||||
@gen
|
||||
{
|
||||
`#if 0`;
|
||||
@expand(D_StackTable a) `#define D_$(a.name)Scope(v) $(=>35) DeferLoop(d_push_$(a.name_lower)(v), d_pop_$(a.name_lower)())`;
|
||||
@expand(DR_StackTable a) `#define DR_$(a.name)Scope(v) $(=>35) DeferLoop(dr_push_$(a.name_lower)(v), dr_pop_$(a.name_lower)())`;
|
||||
`#endif`;
|
||||
}
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
|
||||
//- GENERATED CODE
|
||||
|
||||
internal R_Tex2DSampleKind d_push_tex2d_sample_kind(R_Tex2DSampleKind v) {D_StackPushImpl(Tex2DSampleKind, tex2d_sample_kind, R_Tex2DSampleKind, v);}
|
||||
internal Mat3x3F32 d_push_xform2d(Mat3x3F32 v) {D_StackPushImpl(XForm2D, xform2d, Mat3x3F32, v);}
|
||||
internal Rng2F32 d_push_clip(Rng2F32 v) {D_StackPushImpl(Clip, clip, Rng2F32, v);}
|
||||
internal F32 d_push_transparency(F32 v) {D_StackPushImpl(Transparency, transparency, F32, v);}
|
||||
internal R_Tex2DSampleKind d_pop_tex2d_sample_kind(void) {D_StackPopImpl(Tex2DSampleKind, tex2d_sample_kind, R_Tex2DSampleKind);}
|
||||
internal Mat3x3F32 d_pop_xform2d(void) {D_StackPopImpl(XForm2D, xform2d, Mat3x3F32);}
|
||||
internal Rng2F32 d_pop_clip(void) {D_StackPopImpl(Clip, clip, Rng2F32);}
|
||||
internal F32 d_pop_transparency(void) {D_StackPopImpl(Transparency, transparency, F32);}
|
||||
internal R_Tex2DSampleKind d_top_tex2d_sample_kind(void) {D_StackTopImpl(Tex2DSampleKind, tex2d_sample_kind, R_Tex2DSampleKind);}
|
||||
internal Mat3x3F32 d_top_xform2d(void) {D_StackTopImpl(XForm2D, xform2d, Mat3x3F32);}
|
||||
internal Rng2F32 d_top_clip(void) {D_StackTopImpl(Clip, clip, Rng2F32);}
|
||||
internal F32 d_top_transparency(void) {D_StackTopImpl(Transparency, transparency, F32);}
|
||||
internal R_Tex2DSampleKind dr_push_tex2d_sample_kind(R_Tex2DSampleKind v) {DR_StackPushImpl(Tex2DSampleKind, tex2d_sample_kind, R_Tex2DSampleKind, v);}
|
||||
internal Mat3x3F32 dr_push_xform2d(Mat3x3F32 v) {DR_StackPushImpl(XForm2D, xform2d, Mat3x3F32, v);}
|
||||
internal Rng2F32 dr_push_clip(Rng2F32 v) {DR_StackPushImpl(Clip, clip, Rng2F32, v);}
|
||||
internal F32 dr_push_transparency(F32 v) {DR_StackPushImpl(Transparency, transparency, F32, v);}
|
||||
internal R_Tex2DSampleKind dr_pop_tex2d_sample_kind(void) {DR_StackPopImpl(Tex2DSampleKind, tex2d_sample_kind, R_Tex2DSampleKind);}
|
||||
internal Mat3x3F32 dr_pop_xform2d(void) {DR_StackPopImpl(XForm2D, xform2d, Mat3x3F32);}
|
||||
internal Rng2F32 dr_pop_clip(void) {DR_StackPopImpl(Clip, clip, Rng2F32);}
|
||||
internal F32 dr_pop_transparency(void) {DR_StackPopImpl(Transparency, transparency, F32);}
|
||||
internal R_Tex2DSampleKind dr_top_tex2d_sample_kind(void) {DR_StackTopImpl(Tex2DSampleKind, tex2d_sample_kind, R_Tex2DSampleKind);}
|
||||
internal Mat3x3F32 dr_top_xform2d(void) {DR_StackTopImpl(XForm2D, xform2d, Mat3x3F32);}
|
||||
internal Rng2F32 dr_top_clip(void) {DR_StackTopImpl(Clip, clip, Rng2F32);}
|
||||
internal F32 dr_top_transparency(void) {DR_StackTopImpl(Transparency, transparency, F32);}
|
||||
|
||||
@@ -6,44 +6,44 @@
|
||||
#ifndef DRAW_META_H
|
||||
#define DRAW_META_H
|
||||
|
||||
typedef struct D_Tex2DSampleKindNode D_Tex2DSampleKindNode; struct D_Tex2DSampleKindNode {D_Tex2DSampleKindNode *next; R_Tex2DSampleKind v;};
|
||||
typedef struct D_XForm2DNode D_XForm2DNode; struct D_XForm2DNode {D_XForm2DNode *next; Mat3x3F32 v;};
|
||||
typedef struct D_ClipNode D_ClipNode; struct D_ClipNode {D_ClipNode *next; Rng2F32 v;};
|
||||
typedef struct D_TransparencyNode D_TransparencyNode; struct D_TransparencyNode {D_TransparencyNode *next; F32 v;};
|
||||
#define D_BucketStackDecls struct{\
|
||||
D_Tex2DSampleKindNode *top_tex2d_sample_kind;\
|
||||
D_XForm2DNode *top_xform2d;\
|
||||
D_ClipNode *top_clip;\
|
||||
D_TransparencyNode *top_transparency;\
|
||||
typedef struct DR_Tex2DSampleKindNode DR_Tex2DSampleKindNode; struct DR_Tex2DSampleKindNode {DR_Tex2DSampleKindNode *next; R_Tex2DSampleKind v;};
|
||||
typedef struct DR_XForm2DNode DR_XForm2DNode; struct DR_XForm2DNode {DR_XForm2DNode *next; Mat3x3F32 v;};
|
||||
typedef struct DR_ClipNode DR_ClipNode; struct DR_ClipNode {DR_ClipNode *next; Rng2F32 v;};
|
||||
typedef struct DR_TransparencyNode DR_TransparencyNode; struct DR_TransparencyNode {DR_TransparencyNode *next; F32 v;};
|
||||
#define DR_BucketStackDecls struct{\
|
||||
DR_Tex2DSampleKindNode *top_tex2d_sample_kind;\
|
||||
DR_XForm2DNode *top_xform2d;\
|
||||
DR_ClipNode *top_clip;\
|
||||
DR_TransparencyNode *top_transparency;\
|
||||
}
|
||||
read_only global D_Tex2DSampleKindNode d_nil_tex2d_sample_kind = {0, R_Tex2DSampleKind_Nearest};
|
||||
read_only global D_XForm2DNode d_nil_xform2d = {0, {1, 0, 0, 0, 1, 0, 0, 0, 1}};
|
||||
read_only global D_ClipNode d_nil_clip = {0, {0}};
|
||||
read_only global D_TransparencyNode d_nil_transparency = {0, 0};
|
||||
#define D_BucketStackInits(b) do{\
|
||||
(b)->top_tex2d_sample_kind = &d_nil_tex2d_sample_kind;\
|
||||
(b)->top_xform2d = &d_nil_xform2d;\
|
||||
(b)->top_clip = &d_nil_clip;\
|
||||
(b)->top_transparency = &d_nil_transparency;\
|
||||
read_only global DR_Tex2DSampleKindNode dr_nil_tex2d_sample_kind = {0, R_Tex2DSampleKind_Nearest};
|
||||
read_only global DR_XForm2DNode dr_nil_xform2d = {0, {1, 0, 0, 0, 1, 0, 0, 0, 1}};
|
||||
read_only global DR_ClipNode dr_nil_clip = {0, {0}};
|
||||
read_only global DR_TransparencyNode dr_nil_transparency = {0, 0};
|
||||
#define DR_BucketStackInits(b) do{\
|
||||
(b)->top_tex2d_sample_kind = &dr_nil_tex2d_sample_kind;\
|
||||
(b)->top_xform2d = &dr_nil_xform2d;\
|
||||
(b)->top_clip = &dr_nil_clip;\
|
||||
(b)->top_transparency = &dr_nil_transparency;\
|
||||
}while(0)
|
||||
#if 0
|
||||
internal R_Tex2DSampleKind d_push_tex2d_sample_kind(R_Tex2DSampleKind v);
|
||||
internal Mat3x3F32 d_push_xform2d(Mat3x3F32 v);
|
||||
internal Rng2F32 d_push_clip(Rng2F32 v);
|
||||
internal F32 d_push_transparency(F32 v);
|
||||
internal R_Tex2DSampleKind d_pop_tex2d_sample_kind(void);
|
||||
internal Mat3x3F32 d_pop_xform2d(void);
|
||||
internal Rng2F32 d_pop_clip(void);
|
||||
internal F32 d_pop_transparency(void);
|
||||
internal R_Tex2DSampleKind d_top_tex2d_sample_kind(void);
|
||||
internal Mat3x3F32 d_top_xform2d(void);
|
||||
internal Rng2F32 d_top_clip(void);
|
||||
internal F32 d_top_transparency(void);
|
||||
internal R_Tex2DSampleKind dr_push_tex2d_sample_kind(R_Tex2DSampleKind v);
|
||||
internal Mat3x3F32 dr_push_xform2d(Mat3x3F32 v);
|
||||
internal Rng2F32 dr_push_clip(Rng2F32 v);
|
||||
internal F32 dr_push_transparency(F32 v);
|
||||
internal R_Tex2DSampleKind dr_pop_tex2d_sample_kind(void);
|
||||
internal Mat3x3F32 dr_pop_xform2d(void);
|
||||
internal Rng2F32 dr_pop_clip(void);
|
||||
internal F32 dr_pop_transparency(void);
|
||||
internal R_Tex2DSampleKind dr_top_tex2d_sample_kind(void);
|
||||
internal Mat3x3F32 dr_top_xform2d(void);
|
||||
internal Rng2F32 dr_top_clip(void);
|
||||
internal F32 dr_top_transparency(void);
|
||||
#endif
|
||||
#if 0
|
||||
#define D_Tex2DSampleKindScope(v) DeferLoop(d_push_tex2d_sample_kind(v), d_pop_tex2d_sample_kind())
|
||||
#define D_XForm2DScope(v) DeferLoop(d_push_xform2d(v), d_pop_xform2d())
|
||||
#define D_ClipScope(v) DeferLoop(d_push_clip(v), d_pop_clip())
|
||||
#define D_TransparencyScope(v) DeferLoop(d_push_transparency(v), d_pop_transparency())
|
||||
#define DR_Tex2DSampleKindScope(v) DeferLoop(dr_push_tex2d_sample_kind(v), dr_pop_tex2d_sample_kind())
|
||||
#define DR_XForm2DScope(v) DeferLoop(dr_push_xform2d(v), dr_pop_xform2d())
|
||||
#define DR_ClipScope(v) DeferLoop(dr_push_clip(v), dr_pop_clip())
|
||||
#define DR_TransparencyScope(v) DeferLoop(dr_push_transparency(v), dr_pop_transparency())
|
||||
#endif
|
||||
#endif // DRAW_META_H
|
||||
|
||||
Reference in New Issue
Block a user