mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-31 19:30:03 +00:00
fix render layer guid linking w/out font provider layer; eliminate generation number on render handles; sketch out tester scratch program for text drawing performance
This commit is contained in:
@@ -109,6 +109,7 @@ if "%rdi_dump%"=="1" set didbuild=1 && %compile% ..\src\rdi_du
|
|||||||
if "%rdi_breakpad_from_pdb%"=="1" set didbuild=1 && %compile% ..\src\rdi_breakpad_from_pdb\rdi_breakpad_from_pdb_main.c %compile_link% %out%rdi_breakpad_from_pdb.exe || exit /b 1
|
if "%rdi_breakpad_from_pdb%"=="1" set didbuild=1 && %compile% ..\src\rdi_breakpad_from_pdb\rdi_breakpad_from_pdb_main.c %compile_link% %out%rdi_breakpad_from_pdb.exe || exit /b 1
|
||||||
if "%tester%"=="1" set didbuild=1 && %compile% ..\src\tester\tester_main.c %compile_link% %out%tester.exe || exit /b 1
|
if "%tester%"=="1" set didbuild=1 && %compile% ..\src\tester\tester_main.c %compile_link% %out%tester.exe || exit /b 1
|
||||||
if "%ryan_scratch%"=="1" set didbuild=1 && %compile% ..\src\scratch\ryan_scratch.c %compile_link% %out%ryan_scratch.exe || exit /b 1
|
if "%ryan_scratch%"=="1" set didbuild=1 && %compile% ..\src\scratch\ryan_scratch.c %compile_link% %out%ryan_scratch.exe || exit /b 1
|
||||||
|
if "%textperf%"=="1" set didbuild=1 && %compile% ..\src\scratch\textperf.c %compile_link% %out%textperf.exe || exit /b 1
|
||||||
if "%parse_inline_sites%"=="1" set didbuild=1 && %compile% ..\src\scratch\parse_inline_sites.c %compile_link% %out%parse_inline_sites.exe || exit /b 1
|
if "%parse_inline_sites%"=="1" set didbuild=1 && %compile% ..\src\scratch\parse_inline_sites.c %compile_link% %out%parse_inline_sites.exe || exit /b 1
|
||||||
if "%mule_main%"=="1" set didbuild=1 && del vc*.pdb mule*.pdb && %compile_release% %only_compile% ..\src\mule\mule_inline.cpp && %compile_release% %only_compile% ..\src\mule\mule_o2.cpp && %compile_debug% %EHsc% ..\src\mule\mule_main.cpp ..\src\mule\mule_c.c mule_inline.obj mule_o2.obj %compile_link% %no_aslr% %out%mule_main.exe || exit /b 1
|
if "%mule_main%"=="1" set didbuild=1 && del vc*.pdb mule*.pdb && %compile_release% %only_compile% ..\src\mule\mule_inline.cpp && %compile_release% %only_compile% ..\src\mule\mule_o2.cpp && %compile_debug% %EHsc% ..\src\mule\mule_main.cpp ..\src\mule\mule_c.c mule_inline.obj mule_o2.obj %compile_link% %no_aslr% %out%mule_main.exe || exit /b 1
|
||||||
if "%mule_module%"=="1" set didbuild=1 && %compile% ..\src\mule\mule_module.cpp %compile_link% %link_dll% %out%mule_module.dll || exit /b 1
|
if "%mule_module%"=="1" set didbuild=1 && %compile% ..\src\mule\mule_module.cpp %compile_link% %link_dll% %out%mule_module.dll || exit /b 1
|
||||||
|
|||||||
+5
-5
@@ -46,11 +46,11 @@ load_paths =
|
|||||||
commands =
|
commands =
|
||||||
{
|
{
|
||||||
//- rjf: fkey command slots (change locally but do not commit)
|
//- rjf: fkey command slots (change locally but do not commit)
|
||||||
// .f1 = { .win = "build raddbg telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
.f1 = { .win = "build raddbg telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||||
// .f2 = { .win = "build rdi_from_pdb", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
.f2 = { .win = "build rdi_from_pdb", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||||
// .f3 = { .win = "pushd build && raddbg.exe --user:local_dev.raddbg_user --project:local_dev.raddbg_project --xuto_run && popd",.linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
.f3 = { .win = "pushd build && raddbg.exe --user:local_dev.raddbg_user --project:local_dev.raddbg_project --xuto_run && popd",.linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||||
.f1 = { .win = "build ryan_scratch release telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
// .f1 = { .win = "build textperf release telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||||
.f3 = { .win = "pushd build && ryan_scratch.exe --capture && popd",.linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
// .f3 = { .win = "pushd build && textperf.exe --capture && popd",.linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||||
|
|
||||||
//- rjf: local target builds
|
//- rjf: local target builds
|
||||||
.build_raddbg = { .win = "build raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
.build_raddbg = { .win = "build raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||||
|
|||||||
@@ -40,6 +40,12 @@
|
|||||||
# define thread_static __thread
|
# define thread_static __thread
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if COMPILER_MSVC
|
||||||
|
# define force_inline __forceinline
|
||||||
|
#elif COMPILER_CLANG || COMPILER_GCC
|
||||||
|
# define force_inline __attribute__((always_inline))
|
||||||
|
#endif
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Linkage Keyword Macros
|
//~ rjf: Linkage Keyword Macros
|
||||||
|
|
||||||
|
|||||||
@@ -609,6 +609,7 @@ dr_truncated_fancy_run_fuzzy_matches(Vec2F32 p, DR_FancyRunList *list, F32 max_x
|
|||||||
internal void
|
internal void
|
||||||
dr_text_run(Vec2F32 p, Vec4F32 color, FNT_Run run)
|
dr_text_run(Vec2F32 p, Vec4F32 color, FNT_Run run)
|
||||||
{
|
{
|
||||||
|
ProfBeginFunction();
|
||||||
F32 advance = 0;
|
F32 advance = 0;
|
||||||
FNT_Piece *piece_first = run.pieces.v;
|
FNT_Piece *piece_first = run.pieces.v;
|
||||||
FNT_Piece *piece_opl = piece_first + run.pieces.count;
|
FNT_Piece *piece_opl = piece_first + run.pieces.count;
|
||||||
@@ -629,6 +630,7 @@ dr_text_run(Vec2F32 p, Vec4F32 color, FNT_Run run)
|
|||||||
}
|
}
|
||||||
advance += piece->advance;
|
advance += piece->advance;
|
||||||
}
|
}
|
||||||
|
ProfEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
|
|||||||
+1
-1
@@ -132,7 +132,7 @@ internal DR_Bucket *dr_bucket_make(void);
|
|||||||
internal void dr_push_bucket(DR_Bucket *bucket);
|
internal void dr_push_bucket(DR_Bucket *bucket);
|
||||||
internal void dr_pop_bucket(void);
|
internal void dr_pop_bucket(void);
|
||||||
internal DR_Bucket *dr_top_bucket(void);
|
internal DR_Bucket *dr_top_bucket(void);
|
||||||
#define D_BucketScope(b) DeferLoop(dr_push_bucket(b), dr_pop_bucket())
|
#define DR_BucketScope(b) DeferLoop(dr_push_bucket(b), dr_pop_bucket())
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Bucket Stacks
|
//~ rjf: Bucket Stacks
|
||||||
|
|||||||
@@ -8214,7 +8214,7 @@ rd_window_frame(RD_Window *ws)
|
|||||||
//- rjf: draw UI
|
//- rjf: draw UI
|
||||||
//
|
//
|
||||||
ws->draw_bucket = dr_bucket_make();
|
ws->draw_bucket = dr_bucket_make();
|
||||||
D_BucketScope(ws->draw_bucket)
|
DR_BucketScope(ws->draw_bucket)
|
||||||
ProfScope("draw UI")
|
ProfScope("draw UI")
|
||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(0, 0);
|
Temp scratch = scratch_begin(0, 0);
|
||||||
|
|||||||
@@ -7074,7 +7074,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(memory)
|
|||||||
{
|
{
|
||||||
Rng1U64 selection_in_row = intersect_1u64(row_range_bytes, selection);
|
Rng1U64 selection_in_row = intersect_1u64(row_range_bytes, selection);
|
||||||
DR_Bucket *bucket = dr_bucket_make();
|
DR_Bucket *bucket = dr_bucket_make();
|
||||||
D_BucketScope(bucket)
|
DR_BucketScope(bucket)
|
||||||
{
|
{
|
||||||
Vec2F32 text_pos = ui_box_text_position(ascii_box);
|
Vec2F32 text_pos = ui_box_text_position(ascii_box);
|
||||||
dr_rect(r2f32p(text_pos.x + fnt_dim_from_tag_size_string(font, font_size, 0, 0, str8_prefix(ascii_text, selection_in_row.min+0-row_range_bytes.min)).x - font_size/8.f,
|
dr_rect(r2f32p(text_pos.x + fnt_dim_from_tag_size_string(font, font_size, 0, 0, str8_prefix(ascii_text, selection_in_row.min+0-row_range_bytes.min)).x - font_size/8.f,
|
||||||
@@ -7089,7 +7089,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(memory)
|
|||||||
if(mouse_hover_byte_num != 0 && contains_1u64(row_range_bytes, mouse_hover_byte_num-1))
|
if(mouse_hover_byte_num != 0 && contains_1u64(row_range_bytes, mouse_hover_byte_num-1))
|
||||||
{
|
{
|
||||||
DR_Bucket *bucket = dr_bucket_make();
|
DR_Bucket *bucket = dr_bucket_make();
|
||||||
D_BucketScope(bucket)
|
DR_BucketScope(bucket)
|
||||||
{
|
{
|
||||||
Vec2F32 text_pos = ui_box_text_position(ascii_box);
|
Vec2F32 text_pos = ui_box_text_position(ascii_box);
|
||||||
Vec4F32 color = rd_rgba_from_theme_color(RD_ThemeColor_HighlightOverlay);
|
Vec4F32 color = rd_rgba_from_theme_color(RD_ThemeColor_HighlightOverlay);
|
||||||
|
|||||||
@@ -2006,7 +2006,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
|||||||
if(line_drag_drop && contains_2f32(clipped_top_container_rect, ui_mouse()))
|
if(line_drag_drop && contains_2f32(clipped_top_container_rect, ui_mouse()))
|
||||||
{
|
{
|
||||||
DR_Bucket *bucket = dr_bucket_make();
|
DR_Bucket *bucket = dr_bucket_make();
|
||||||
D_BucketScope(bucket)
|
DR_BucketScope(bucket)
|
||||||
{
|
{
|
||||||
Vec4F32 color = line_drag_drop_color;
|
Vec4F32 color = line_drag_drop_color;
|
||||||
Rng2F32 drop_line_rect = r2f32p(top_container_box->rect.x0,
|
Rng2F32 drop_line_rect = r2f32p(top_container_box->rect.x0,
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ internal R_D3D11_Window *
|
|||||||
r_d3d11_window_from_handle(R_Handle handle)
|
r_d3d11_window_from_handle(R_Handle handle)
|
||||||
{
|
{
|
||||||
R_D3D11_Window *window = (R_D3D11_Window *)handle.u64[0];
|
R_D3D11_Window *window = (R_D3D11_Window *)handle.u64[0];
|
||||||
if(window->generation != handle.u64[1])
|
if(window == 0)
|
||||||
{
|
{
|
||||||
window = &r_d3d11_window_nil;
|
window = &r_d3d11_window_nil;
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,6 @@ r_d3d11_handle_from_window(R_D3D11_Window *window)
|
|||||||
{
|
{
|
||||||
R_Handle handle = {0};
|
R_Handle handle = {0};
|
||||||
handle.u64[0] = (U64)window;
|
handle.u64[0] = (U64)window;
|
||||||
handle.u64[1] = window->generation;
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +58,7 @@ internal R_D3D11_Tex2D *
|
|||||||
r_d3d11_tex2d_from_handle(R_Handle handle)
|
r_d3d11_tex2d_from_handle(R_Handle handle)
|
||||||
{
|
{
|
||||||
R_D3D11_Tex2D *texture = (R_D3D11_Tex2D *)handle.u64[0];
|
R_D3D11_Tex2D *texture = (R_D3D11_Tex2D *)handle.u64[0];
|
||||||
if(texture == 0 || texture->generation != handle.u64[1])
|
if(texture == 0)
|
||||||
{
|
{
|
||||||
texture = &r_d3d11_tex2d_nil;
|
texture = &r_d3d11_tex2d_nil;
|
||||||
}
|
}
|
||||||
@@ -71,7 +70,6 @@ r_d3d11_handle_from_tex2d(R_D3D11_Tex2D *texture)
|
|||||||
{
|
{
|
||||||
R_Handle handle = {0};
|
R_Handle handle = {0};
|
||||||
handle.u64[0] = (U64)texture;
|
handle.u64[0] = (U64)texture;
|
||||||
handle.u64[1] = texture->generation;
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +77,7 @@ internal R_D3D11_Buffer *
|
|||||||
r_d3d11_buffer_from_handle(R_Handle handle)
|
r_d3d11_buffer_from_handle(R_Handle handle)
|
||||||
{
|
{
|
||||||
R_D3D11_Buffer *buffer = (R_D3D11_Buffer *)handle.u64[0];
|
R_D3D11_Buffer *buffer = (R_D3D11_Buffer *)handle.u64[0];
|
||||||
if(buffer == 0 || buffer->generation != handle.u64[1])
|
if(buffer == 0)
|
||||||
{
|
{
|
||||||
buffer = &r_d3d11_buffer_nil;
|
buffer = &r_d3d11_buffer_nil;
|
||||||
}
|
}
|
||||||
@@ -91,7 +89,6 @@ r_d3d11_handle_from_buffer(R_D3D11_Buffer *buffer)
|
|||||||
{
|
{
|
||||||
R_Handle handle = {0};
|
R_Handle handle = {0};
|
||||||
handle.u64[0] = (U64)buffer;
|
handle.u64[0] = (U64)buffer;
|
||||||
handle.u64[1] = buffer->generation;
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
#ifndef RENDER_D3D11_H
|
#ifndef RENDER_D3D11_H
|
||||||
#define RENDER_D3D11_H
|
#define RENDER_D3D11_H
|
||||||
|
|
||||||
|
#include <combaseapi.h>
|
||||||
|
#include <dcommon.h>
|
||||||
|
#include <initguid.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <d3d11_1.h>
|
#include <d3d11_1.h>
|
||||||
#include <d3dcompiler.h>
|
#include <d3dcompiler.h>
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ enum
|
|||||||
typedef union R_Handle R_Handle;
|
typedef union R_Handle R_Handle;
|
||||||
union R_Handle
|
union R_Handle
|
||||||
{
|
{
|
||||||
U64 u64[2];
|
U64 u64[1];
|
||||||
U32 u32[4];
|
U32 u32[2];
|
||||||
U16 u16[8];
|
U16 u16[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
// Copyright (c) 2024 Epic Games Tools
|
||||||
|
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ rjf: Build Options
|
||||||
|
|
||||||
|
#define BUILD_TITLE "textperf"
|
||||||
|
#define OS_FEATURE_GRAPHICAL 1
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ rjf: Includes
|
||||||
|
|
||||||
|
//- 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"
|
||||||
|
|
||||||
|
//- 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"
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ rjf: Globals
|
||||||
|
|
||||||
|
global OS_Handle os_window = {0};
|
||||||
|
global R_Handle r_window = {0};
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ rjf: Entry Points
|
||||||
|
|
||||||
|
internal B32
|
||||||
|
frame(void)
|
||||||
|
{
|
||||||
|
ProfBeginFunction();
|
||||||
|
B32 quit = 0;
|
||||||
|
Temp scratch = scratch_begin(0, 0);
|
||||||
|
OS_EventList events = os_get_events(scratch.arena, 0);
|
||||||
|
for(OS_Event *evt = events.first; evt != 0; evt = evt->next)
|
||||||
|
{
|
||||||
|
if(evt->kind == OS_EventKind_WindowClose)
|
||||||
|
{
|
||||||
|
quit = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
r_begin_frame();
|
||||||
|
dr_begin_frame();
|
||||||
|
r_window_begin_frame(os_window, r_window);
|
||||||
|
DR_Bucket *bucket = dr_bucket_make();
|
||||||
|
DR_BucketScope(bucket) ProfScope("draw")
|
||||||
|
{
|
||||||
|
Vec2F32 mouse = os_mouse_from_window(os_window);
|
||||||
|
FNT_Tag font = fnt_tag_from_path(str8_lit("C:/devel/raddebugger/data/Inconsolata-Regular.ttf"));
|
||||||
|
for(F32 x = 0; x < 500; x += 5.f)
|
||||||
|
{
|
||||||
|
for(F32 y = 0; y < 500; y += 5.f)
|
||||||
|
{
|
||||||
|
dr_text(font, 16.f, 0, 0, FNT_RasterFlag_Smooth|FNT_RasterFlag_Hinted, v2f32(30 + x + mouse.x, 30 + y + mouse.y), v4f32(1, 1, 1, 1), str8_lit("This is a test."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
r_window_submit(os_window, r_window, &bucket->passes);
|
||||||
|
r_window_end_frame(os_window, r_window);
|
||||||
|
r_end_frame();
|
||||||
|
scratch_end(scratch);
|
||||||
|
ProfEnd();
|
||||||
|
return quit;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
entry_point(CmdLine *cmdline)
|
||||||
|
{
|
||||||
|
os_window = os_window_open(v2f32(1600, 900), 0, str8_lit("textperf"));
|
||||||
|
r_window = r_window_equip(os_window);
|
||||||
|
os_window_first_paint(os_window);
|
||||||
|
for(;!update(););
|
||||||
|
}
|
||||||
+1
-1
@@ -2479,7 +2479,7 @@ ui_box_equip_draw_bucket(UI_Box *box, DR_Bucket *bucket)
|
|||||||
box->flags |= UI_BoxFlag_DrawBucket;
|
box->flags |= UI_BoxFlag_DrawBucket;
|
||||||
if(box->draw_bucket != 0)
|
if(box->draw_bucket != 0)
|
||||||
{
|
{
|
||||||
D_BucketScope(box->draw_bucket) dr_sub_bucket(bucket);
|
DR_BucketScope(box->draw_bucket) dr_sub_bucket(bucket);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user