diff --git a/res/sprite/tim.ase b/res/sprite/tim.ase index 9d61e25c..fec5c35b 100644 --- a/res/sprite/tim.ase +++ b/res/sprite/tim.ase @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b27ca6fcda7a773805a4b5b0960fa4d5923d6b671c79b5afeec576176f0fa7e5 -size 810 +oid sha256:ec441d678c8163a5fed2ff71d5a88589183791064748fbda0974fa05712e06a2 +size 766 diff --git a/src/playback_wasapi.c b/src/playback_wasapi.c index fe19caba..6f3aa369 100644 --- a/src/playback_wasapi.c +++ b/src/playback_wasapi.c @@ -236,6 +236,7 @@ INTERNAL JOB_DEF(playback_job, _) DWORD task = 0; HANDLE mmc_handle = AvSetMmThreadCharacteristicsW(L"Pro Audio", &task); ASSERT(mmc_handle); + (UNUSED)mmc_handle; /* FIXME: If playback fails at any point and mixer stops advancing, we * need to halt mixer to prevent memory leak when sounds are played. */ diff --git a/src/prof_tracy.h b/src/prof_tracy.h index 366e8f5e..59f27871 100644 --- a/src/prof_tracy.h +++ b/src/prof_tracy.h @@ -7,25 +7,20 @@ #if PROFILING -/* Include tracy client */ -#define TRACY_ENABLE -#if 0 -/* Enable manual lifetime */ -# define TRACY_MANUAL_LIFETIME -# define TRACY_DELAYED_INIT -#endif -#if 1 -/* Disable system tracing (very slow) */ -# define TRACY_NO_CALLSTACK -# define TRACY_NO_SYSTEM_TRACING -#endif -#include STRINGIZE(TRACY_INCLUDE_PATH) - +#define PROFILING_SYSTEM_TRACE 0 #define PROFILING_CAPTURE_FRAME_IMAGE 0 #define PROFILING_LOCKS 0 #define PROFILING_D3D 1 #define PROFILING_CMD_WSTR L"tracy-profiler.exe -a 127.0.0.1" +/* Include tracy client */ +#define TRACY_ENABLE +#if !PROFILING_SYSTEM_TRACE +# define TRACY_NO_CALLSTACK +# define TRACY_NO_SYSTEM_TRACING +#endif +#include STRINGIZE(TRACY_INCLUDE_PATH) + /* Clang/GCC cleanup macros */ #define __prof static const struct ___tracy_source_location_data CAT(__tracy_source_location,__LINE__) = { NULL, __func__, __FILE__, (uint32_t)__LINE__, 0 }; __attribute((cleanup(__prof_zone_cleanup_func))) TracyCZoneCtx __tracy_zone_ctx = ___tracy_emit_zone_begin( &CAT(__tracy_source_location,__LINE__), true ); #define __profscope(name) static const struct ___tracy_source_location_data CAT(__tracy_source_location,__LINE__) = { #name, __func__, __FILE__, (uint32_t)__LINE__, 0 }; __attribute((cleanup(__prof_zone_cleanup_func))) TracyCZoneCtx __tracy_zone_ctx = ___tracy_emit_zone_begin( &CAT(__tracy_source_location,__LINE__), true ); @@ -131,12 +126,4 @@ INLINE void __prof_dx12_zone_cleanup_func(TracyCD3D12ZoneCtx *ctx) { ___tracy_d3 # define __profframeimage(image, width, height, offset, flipped) #endif /* PROFILING_CAPTURE_FRAME_IMAGE */ -#ifdef TRACY_MANUAL_LIFETIME -# define __prof_startup ___tracy_startup_profiler() -# define __prof_shutdown ___tracy_shutdown_profiler() -#else -# define __prof_startup -# define __prof_shutdown -#endif /* TRACY_MANUAL_LIFETIME */ - #endif diff --git a/src/sys_win32.c b/src/sys_win32.c index 9fa25e8a..4bf22dbb 100644 --- a/src/sys_win32.c +++ b/src/sys_win32.c @@ -960,71 +960,74 @@ INTERNAL SYS_THREAD_DEF(window_thread_entry_point, arg) while (!atomic_i32_eval(&window->event_thread_shutdown)) { MSG msg = ZI; - GetMessageW(&msg, 0, 0, 0); - - if (atomic_i32_eval(&window->event_thread_shutdown)) { - break; + { + GetMessageW(&msg, 0, 0, 0); } - - /* Update cursor */ - if (GetFocus() == window->hwnd) { - u32 cursor_flags = window->cursor_set_flags; - - /* Hide cursor */ - if (cursor_flags & WIN32_WINDOW_CURSOR_SET_FLAG_HIDE) { - while(ShowCursor(false) >= 0); + { + __profscope(Process window message); + if (atomic_i32_eval(&window->event_thread_shutdown)) { + break; } - /* Show cursor */ - if (cursor_flags & WIN32_WINDOW_CURSOR_SET_FLAG_SHOW) { - while(ShowCursor(true) < 0); + /* Update cursor */ + if (GetFocus() == window->hwnd) { + u32 cursor_flags = window->cursor_set_flags; + + /* Hide cursor */ + if (cursor_flags & WIN32_WINDOW_CURSOR_SET_FLAG_HIDE) { + while(ShowCursor(false) >= 0); + } + + /* Show cursor */ + if (cursor_flags & WIN32_WINDOW_CURSOR_SET_FLAG_SHOW) { + while(ShowCursor(true) < 0); + } + + /* Update position */ + if (cursor_flags & WIN32_WINDOW_CURSOR_SET_FLAG_POSITION) { + struct v2 window_space_pos = window->cursor_set_position; + POINT p = { window_space_pos.x, window_space_pos.y }; + ClientToScreen(window->hwnd, &p); + SetCursorPos(p.x, p.y); + } + + /* Stop clipping cursor */ + if (cursor_flags & WIN32_WINDOW_CURSOR_SET_FLAG_DISABLE_CLIP) { + ClipCursor(NULL); + } + + /* Clip cursor in window window */ + if (cursor_flags & WIN32_WINDOW_CURSOR_SET_FLAG_ENABLE_CLIP) { + i32 left = window->x + math_round_to_int(window->cursor_clip_bounds.x); + i32 right = left + math_round_to_int(window->cursor_clip_bounds.width); + i32 top = window->y + math_round_to_int(window->cursor_clip_bounds.y); + i32 bottom = top + math_round_to_int(window->cursor_clip_bounds.height); + RECT clip = { + .left = clamp_i32(left, window->x, window->x + window->width), + .right = clamp_i32(right, window->x, window->x + window->width), + .top = clamp_i32(top, window->y, window->y + window->height), + .bottom = clamp_i32(bottom, window->y, window->y + window->height) + }; + ClipCursor(&clip); + } + + window->cursor_set_flags = 0; } - /* Update position */ - if (cursor_flags & WIN32_WINDOW_CURSOR_SET_FLAG_POSITION) { - struct v2 window_space_pos = window->cursor_set_position; - POINT p = { window_space_pos.x, window_space_pos.y }; - ClientToScreen(window->hwnd, &p); - SetCursorPos(p.x, p.y); + /* Process message */ + switch (msg.message) { + case WM_QUIT: { + win32_window_process_event(window, (struct sys_event) { .kind = SYS_EVENT_KIND_QUIT }); + } break; + + default: { + TranslateMessage(&msg); + DispatchMessageW(&msg); + } break; } - - /* Stop clipping cursor */ - if (cursor_flags & WIN32_WINDOW_CURSOR_SET_FLAG_DISABLE_CLIP) { - ClipCursor(NULL); - } - - /* Clip cursor in window window */ - if (cursor_flags & WIN32_WINDOW_CURSOR_SET_FLAG_ENABLE_CLIP) { - i32 left = window->x + math_round_to_int(window->cursor_clip_bounds.x); - i32 right = left + math_round_to_int(window->cursor_clip_bounds.width); - i32 top = window->y + math_round_to_int(window->cursor_clip_bounds.y); - i32 bottom = top + math_round_to_int(window->cursor_clip_bounds.height); - RECT clip = { - .left = clamp_i32(left, window->x, window->x + window->width), - .right = clamp_i32(right, window->x, window->x + window->width), - .top = clamp_i32(top, window->y, window->y + window->height), - .bottom = clamp_i32(bottom, window->y, window->y + window->height) - }; - ClipCursor(&clip); - } - - window->cursor_set_flags = 0; - } - - /* Process message */ - switch (msg.message) { - case WM_QUIT: { - win32_window_process_event(window, (struct sys_event) { .kind = SYS_EVENT_KIND_QUIT }); - } break; - - default: { - TranslateMessage(&msg); - DispatchMessageW(&msg); - } break; } } - /* Destroy window hwnd */ DestroyWindow(window->hwnd); } @@ -1220,6 +1223,7 @@ INTERNAL void win32_window_wake(struct win32_window *window) INTERNAL LRESULT CALLBACK win32_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { + __prof; struct win32_window *window = (struct win32_window *)GetWindowLongPtrW(hwnd, GWLP_USERDATA); if (!window) { @@ -2352,7 +2356,6 @@ int CALLBACK wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev_instance, (UNUSED)prev_instance; (UNUSED)cmdline_wstr; (UNUSED)show_code; - __prof_startup; u64 cmdline_len = wstr_len(cmdline_wstr, ARRAY_COUNT(G.cmdline_args_wstr) - 1); MEMCPY(G.cmdline_args_wstr, cmdline_wstr, cmdline_len * sizeof(*cmdline_wstr)); @@ -2561,7 +2564,6 @@ int CALLBACK wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev_instance, } #endif - __prof_shutdown; return 0; }