Skip to content

Commit

Permalink
add debug script
Browse files Browse the repository at this point in the history
  • Loading branch information
lingsamuel committed Nov 28, 2024
1 parent 7b36978 commit 7a3b086
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions scripts/autorun/reframework-d2d.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ re.on_config_save(
end
)

re.on_frame(function ()
if not cfg.Debug then return end

imgui.text(string.format("Draw function cost: %.2f us", d2d.detail.get_draw_function_cost()))
imgui.text(string.format("Cache build cost: %.2f", d2d.detail.get_cache_build_cost()))
imgui.text(string.format("Draw calls: %d, cost: %.2f us", d2d.detail.get_draw_calls_count(), d2d.detail.get_draw_calls_cost()))
imgui.text(string.format("Render cost: %.2f us", d2d.detail.get_render_cost()))
local hit, miss = d2d.detail.get_cache_status()
imgui.text(string.format("Cache hit: %d, cache miss: %d", hit, miss))
end)

re.on_draw_ui(
function()
if not imgui.collapsing_header("REFramework D2D") then return end
Expand All @@ -14,6 +25,11 @@ re.on_draw_ui(
if changed then
cfg.max_update_rate = value
end

changed, value = imgui.checkbox("Debug", cfg.Debug)
if changed then
cfg.Debug = value
end

local last_error = d2d.detail.get_last_script_error()
if last_error ~= "" then
Expand Down

0 comments on commit 7a3b086

Please sign in to comment.