More tools to figure out why it's so laggy on web build

main
Cameron Murphy Reikes 2 years ago
parent 679322313f
commit 389d17e897

@ -7,8 +7,22 @@ mkdir build_web
set FLAGS=-O0 --source-map-base http://localhost:8000/ -g3 -gdwarf -DDEVTOOLS set FLAGS=-O0 --source-map-base http://localhost:8000/ -g3 -gdwarf -DDEVTOOLS
set OUTPUT_FOLDER=build_web set OUTPUT_FOLDER=build_web
if "%1" == "NO_VALIDATION" (
echo Disabling graphics validation...
set FLAGS=%FLAGS% -DNDEBUG
)
call build_web_common.bat || goto :error call build_web_common.bat || goto :error
@echo off
if "%1" == "NO_VALIDATION" (
echo Validation turned off
) else (
echo If you want to turn graphics validation off to make web debug build faster, provide a command line argument called "NO_VALIDATION" to this build script
)
goto :EOF goto :EOF
:error :error

@ -1,4 +1,4 @@
// you will die someday
#include "tuning.h" #include "tuning.h"
#define SOKOL_IMPL #define SOKOL_IMPL
@ -2574,6 +2574,7 @@ void draw_dialog_panel(Entity *talking_to, float alpha)
double elapsed_time = 0.0; double elapsed_time = 0.0;
double unwarped_elapsed_time = 0.0; double unwarped_elapsed_time = 0.0;
double last_frame_processing_time = 0.0; double last_frame_processing_time = 0.0;
double last_frame_gameplay_processing_time = 0.0;
uint64_t last_frame_time; uint64_t last_frame_time;
typedef struct typedef struct
@ -2856,7 +2857,9 @@ void frame(void)
// restore the pressed state after gameplay loop so pressed input events can be processed in the // restore the pressed state after gameplay loop so pressed input events can be processed in the
// rendering correctly as well // rendering correctly as well
PressedState before_gameplay_loops = pressed; PressedState before_gameplay_loops = pressed;
PROFILE_SCOPE("gameplay processing")
{ {
uint64_t time_start_gameplay_processing = stm_now();
unprocessed_gameplay_time += unwarped_dt; unprocessed_gameplay_time += unwarped_dt;
float timestep = fminf(unwarped_dt, (float)MINIMUM_TIMESTEP); float timestep = fminf(unwarped_dt, (float)MINIMUM_TIMESTEP);
while (unprocessed_gameplay_time >= timestep) while (unprocessed_gameplay_time >= timestep)
@ -3652,6 +3655,8 @@ void frame(void)
pressed = (PressedState) { 0 }; pressed = (PressedState) { 0 };
interact = false; interact = false;
} // while loop } // while loop
last_frame_gameplay_processing_time = stm_sec(stm_diff(stm_now(), time_start_gameplay_processing));
} }
pressed = before_gameplay_loops; pressed = before_gameplay_loops;
@ -4207,7 +4212,7 @@ void frame(void)
Vec2 pos = V2(0.0, screen_size().Y); Vec2 pos = V2(0.0, screen_size().Y);
int num_entities = 0; int num_entities = 0;
ENTITIES_ITER(gs.entities) num_entities++; ENTITIES_ITER(gs.entities) num_entities++;
MD_String8 stats = tprint("Frametime: %.1f ms\nProcessing: %.1f ms\nEntities: %d\nDraw calls: %d\nProfiling: %s\nNumber gameplay processing loops: %d\n", dt*1000.0, last_frame_processing_time*1000.0, num_entities, num_draw_calls, profiling ? "yes" : "no", num_timestep_loops); MD_String8 stats = tprint("Frametime: %.1f ms\nProcessing: %.1f ms\nGameplay processing: %.1f ms\nEntities: %d\nDraw calls: %d\nProfiling: %s\nNumber gameplay processing loops: %d\n", dt*1000.0, last_frame_processing_time*1000.0, last_frame_gameplay_processing_time*1000.0, num_entities, num_draw_calls, profiling ? "yes" : "no", num_timestep_loops);
AABB bounds = draw_text((TextParams) { false, true, stats, pos, BLACK, 1.0f }); AABB bounds = draw_text((TextParams) { false, true, stats, pos, BLACK, 1.0f });
pos.Y -= bounds.upper_left.Y - screen_size().Y; pos.Y -= bounds.upper_left.Y - screen_size().Y;
bounds = draw_text((TextParams) { false, true, stats, pos, BLACK, 1.0f }); bounds = draw_text((TextParams) { false, true, stats, pos, BLACK, 1.0f });

Loading…
Cancel
Save