mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
eliminate further useless sdf sampling in shaders; eliminate useless borders in ui, eliminating more overdraw; eliminate tab bar clipping issue
This commit is contained in:
+9
-9
@@ -5352,11 +5352,11 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D
|
||||
F32 tab_bar_vheight = ui_top_font_size()*2.6f;
|
||||
F32 tab_bar_rv_diff = tab_bar_rheight - tab_bar_vheight;
|
||||
F32 tab_spacing = ui_top_font_size()*0.4f;
|
||||
Rng2F32 tab_bar_rect = r2f32p(panel_rect.x0, panel_rect.y0, panel_rect.x1, panel_rect.y0 + tab_bar_rheight);
|
||||
Rng2F32 tab_bar_rect = r2f32p(panel_rect.x0, panel_rect.y0, panel_rect.x1, panel_rect.y0 + tab_bar_vheight);
|
||||
Rng2F32 content_rect = r2f32p(panel_rect.x0, panel_rect.y0+tab_bar_vheight, panel_rect.x1, panel_rect.y1);
|
||||
if(panel->tab_side == Side_Max)
|
||||
{
|
||||
tab_bar_rect.y0 = panel_rect.y1 - tab_bar_rheight;
|
||||
tab_bar_rect.y0 = panel_rect.y1 - tab_bar_vheight;
|
||||
tab_bar_rect.y1 = panel_rect.y1;
|
||||
content_rect.y0 = panel_rect.y0;
|
||||
content_rect.y1 = panel_rect.y1 - tab_bar_vheight;
|
||||
@@ -6418,7 +6418,7 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D
|
||||
}
|
||||
|
||||
// rjf: draw overlay
|
||||
if(b->flags & UI_BoxFlag_DrawOverlay)
|
||||
if(b->flags & UI_BoxFlag_DrawOverlay && b->overlay_color.w > 0.05f)
|
||||
{
|
||||
R_Rect2DInst *inst = d_rect(b->rect, b->overlay_color, 0, 0, 1);
|
||||
MemoryCopyArray(inst->corner_radii, b->corner_radii);
|
||||
@@ -8730,9 +8730,9 @@ internal UI_BOX_CUSTOM_DRAW(df_thread_box_draw_extensions)
|
||||
// rjf: draw line before next-to-execute line
|
||||
{
|
||||
R_Rect2DInst *inst = d_rect(r2f32p(box->rect.x0,
|
||||
box->parent->rect.y0 - box->font_size*0.25f,
|
||||
box->parent->rect.y0 - box->font_size*0.075f,
|
||||
box->rect.x0 + box->font_size*260*u->alive_t,
|
||||
box->parent->rect.y0 + box->font_size*0.25f),
|
||||
box->parent->rect.y0 + box->font_size*0.075f),
|
||||
v4f32(u->thread_color.x, u->thread_color.y, u->thread_color.z, 0),
|
||||
0, 0, 1);
|
||||
inst->colors[Corner_00] = inst->colors[Corner_01] = u->thread_color;
|
||||
@@ -8797,9 +8797,9 @@ internal UI_BOX_CUSTOM_DRAW(df_bp_box_draw_extensions)
|
||||
// rjf: draw line before next-to-execute line
|
||||
{
|
||||
R_Rect2DInst *inst = d_rect(r2f32p(box->rect.x0,
|
||||
box->parent->rect.y0 - ui_top_font_size()*0.225f,
|
||||
box->parent->rect.y0 - box->font_size*0.075f,
|
||||
box->rect.x0 + ui_top_font_size()*250.f*u->alive_t,
|
||||
box->parent->rect.y0 + ui_top_font_size()*0.225f),
|
||||
box->parent->rect.y0 + box->font_size*0.075f),
|
||||
v4f32(u->color.x, u->color.y, u->color.z, 0),
|
||||
0, 0, 1.f);
|
||||
inst->colors[Corner_00] = inst->colors[Corner_01] = u->color;
|
||||
@@ -8867,7 +8867,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
ui_set_next_child_layout_axis(Axis2_X);
|
||||
ui_set_next_pref_width(ui_px(params->line_text_max_width_px, 1));
|
||||
ui_set_next_pref_height(ui_children_sum(1));
|
||||
top_container_box = ui_build_box_from_string(UI_BoxFlag_DisableFocusViz|UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawDropShadow, string);
|
||||
top_container_box = ui_build_box_from_string(UI_BoxFlag_DisableFocusViz|UI_BoxFlag_DrawBorder, string);
|
||||
clipped_top_container_rect = top_container_box->rect;
|
||||
for(UI_Box *b = top_container_box; !ui_box_is_nil(b); b = b->parent)
|
||||
{
|
||||
@@ -9724,7 +9724,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
// rjf: build line num box
|
||||
ui_set_next_text_color(text_color);
|
||||
ui_set_next_background_color(bg_color);
|
||||
ui_build_box_from_stringf(UI_BoxFlag_DrawText|UI_BoxFlag_DrawBackground, "%I64u##line_num", line_num);
|
||||
ui_build_box_from_stringf(UI_BoxFlag_DrawText, "%I64u##line_num", line_num);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4990,7 +4990,6 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
ui_set_next_child_layout_axis(Axis2_Y);
|
||||
container_box = ui_build_box_from_stringf(UI_BoxFlag_Clip|
|
||||
UI_BoxFlag_Scroll|
|
||||
UI_BoxFlag_DrawBorder|
|
||||
UI_BoxFlag_AllowOverflowX|
|
||||
UI_BoxFlag_AllowOverflowY,
|
||||
"###code_area_%p", view);
|
||||
|
||||
@@ -168,12 +168,6 @@ str8_lit_comp(
|
||||
" // rjf: determine SDF sample position\n"
|
||||
" float2 sdf_sample_pos = vertex2pixel.sdf_sample_pos;\n"
|
||||
" \n"
|
||||
" // rjf: sample for corners\n"
|
||||
" float corner_sdf_s = rect_sdf(sdf_sample_pos,\n"
|
||||
" vertex2pixel.rect_half_size_px - float2(vertex2pixel.softness_px*2.f, vertex2pixel.softness_px*2.f),\n"
|
||||
" vertex2pixel.corner_radius_px);\n"
|
||||
" float corner_sdf_t = 1-smoothstep(0, 2*vertex2pixel.softness_px, corner_sdf_s);\n"
|
||||
" \n"
|
||||
" // rjf: sample for borders\n"
|
||||
" float border_sdf_t = 1;\n"
|
||||
" if(vertex2pixel.border_thickness_px > 0)\n"
|
||||
@@ -188,6 +182,16 @@ str8_lit_comp(
|
||||
" discard;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" // rjf: sample for corners\n"
|
||||
" float corner_sdf_t = 1;\n"
|
||||
" if(vertex2pixel.corner_radius_px > 0)\n"
|
||||
" {\n"
|
||||
" float corner_sdf_s = rect_sdf(sdf_sample_pos,\n"
|
||||
" vertex2pixel.rect_half_size_px - float2(vertex2pixel.softness_px*2.f, vertex2pixel.softness_px*2.f),\n"
|
||||
" vertex2pixel.corner_radius_px);\n"
|
||||
" corner_sdf_t = 1-smoothstep(0, 2*vertex2pixel.softness_px, corner_sdf_s);\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" // rjf: form+return final color\n"
|
||||
" float4 final_color = albedo_sample;\n"
|
||||
" final_color *= tint;\n"
|
||||
|
||||
@@ -167,12 +167,6 @@ ps_main(Vertex2Pixel vertex2pixel) : SV_TARGET
|
||||
// rjf: determine SDF sample position
|
||||
float2 sdf_sample_pos = vertex2pixel.sdf_sample_pos;
|
||||
|
||||
// rjf: sample for corners
|
||||
float corner_sdf_s = rect_sdf(sdf_sample_pos,
|
||||
vertex2pixel.rect_half_size_px - float2(vertex2pixel.softness_px*2.f, vertex2pixel.softness_px*2.f),
|
||||
vertex2pixel.corner_radius_px);
|
||||
float corner_sdf_t = 1-smoothstep(0, 2*vertex2pixel.softness_px, corner_sdf_s);
|
||||
|
||||
// rjf: sample for borders
|
||||
float border_sdf_t = 1;
|
||||
if(vertex2pixel.border_thickness_px > 0)
|
||||
@@ -187,6 +181,16 @@ ps_main(Vertex2Pixel vertex2pixel) : SV_TARGET
|
||||
discard;
|
||||
}
|
||||
|
||||
// rjf: sample for corners
|
||||
float corner_sdf_t = 1;
|
||||
if(vertex2pixel.corner_radius_px > 0)
|
||||
{
|
||||
float corner_sdf_s = rect_sdf(sdf_sample_pos,
|
||||
vertex2pixel.rect_half_size_px - float2(vertex2pixel.softness_px*2.f, vertex2pixel.softness_px*2.f),
|
||||
vertex2pixel.corner_radius_px);
|
||||
corner_sdf_t = 1-smoothstep(0, 2*vertex2pixel.softness_px, corner_sdf_s);
|
||||
}
|
||||
|
||||
// rjf: form+return final color
|
||||
float4 final_color = albedo_sample;
|
||||
final_color *= tint;
|
||||
|
||||
Reference in New Issue
Block a user