Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 642736fdcb |
@ -52,7 +52,7 @@ APP_NAME :: "mcap";
|
|||||||
APP_FOLDER_NAME :: "mcap";
|
APP_FOLDER_NAME :: "mcap";
|
||||||
GIT_BRANCH :: "check";
|
GIT_BRANCH :: "check";
|
||||||
GIT_HASH :: "-";
|
GIT_HASH :: "-";
|
||||||
VERSION :: "0.1.40";
|
VERSION :: "0.1.38";
|
||||||
BUILD_DATE :: "-";
|
BUILD_DATE :: "-";
|
||||||
DEBUG :: true;
|
DEBUG :: true;
|
||||||
COMPILE_TESTS :: true;
|
COMPILE_TESTS :: true;
|
||||||
|
|||||||
@ -8,7 +8,7 @@ APP_NAME :: "mcap";
|
|||||||
APP_FOLDER_NAME :: "mcap";
|
APP_FOLDER_NAME :: "mcap";
|
||||||
APP_BUNDLE_IDENTIFIER :: "com.example.mcap";
|
APP_BUNDLE_IDENTIFIER :: "com.example.mcap";
|
||||||
|
|
||||||
VERSION :: "0.1.40";
|
VERSION :: "0.1.38";
|
||||||
// Where everything goes: bin/, or bin-headless/ for builds made with no_crash_dialog, so automated
|
// Where everything goes: bin/, or bin-headless/ for builds made with no_crash_dialog, so automated
|
||||||
// builds never write over the ones you run by hand.
|
// builds never write over the ones you run by hand.
|
||||||
build_directory := "bin";
|
build_directory := "bin";
|
||||||
@ -71,7 +71,7 @@ build_project :: () {
|
|||||||
// jai first.jai - record_probe: also bin/record-probe, a screen recorded with modules/Screen_Record (video-capture-plan.html, phase 1).
|
// jai first.jai - record_probe: also bin/record-probe, a screen recorded with modules/Screen_Record (video-capture-plan.html, phase 1).
|
||||||
if array_find(args, "record_probe") array_add(*pending, start_tool_build("record-probe", "tools/record_probe.jai", optimized = build_release));
|
if array_find(args, "record_probe") array_add(*pending, start_tool_build("record-probe", "tools/record_probe.jai", optimized = build_release));
|
||||||
|
|
||||||
// bin/gpu-bench: every GPU model timed over a fixed corpus (tools/gpu_bench),
|
// The gpu-bench branch: bin/gpu-bench, every GPU model timed over a fixed corpus (tools/gpu_bench),
|
||||||
// always built, as the GPU Benchmark window runs it.
|
// always built, as the GPU Benchmark window runs it.
|
||||||
array_add(*pending, start_tool_build("gpu-bench", "tools/gpu_bench/gpu_bench.jai", optimized = build_release));
|
array_add(*pending, start_tool_build("gpu-bench", "tools/gpu_bench/gpu_bench.jai", optimized = build_release));
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
// The GPU Benchmark window: runs gpu-bench (tools/gpu_bench) in a process of
|
// The GPU Benchmark window (the gpu-bench branch): runs gpu-bench (tools/gpu_bench) in a process of
|
||||||
// its own, so the app's engines and memory do not touch its numbers, shows how far it has got, and
|
// its own, so the app's engines and memory do not touch its numbers, shows how far it has got, and
|
||||||
// lays the results files in gpu-bench-results side by side. To compare with another machine, copy
|
// lays the results files in gpu-bench-results side by side. To compare with another machine, copy
|
||||||
// its results file into that folder (Open folder).
|
// its results file into that folder (Open folder).
|
||||||
|
|||||||
@ -274,16 +274,11 @@ main :: () {
|
|||||||
#if OS == .LINUX {
|
#if OS == .LINUX {
|
||||||
linux_platform_setup();
|
linux_platform_setup();
|
||||||
}
|
}
|
||||||
// The tray icon stays for as long as the app runs, not only while the window is hidden. View
|
|
||||||
// mode has no tray: closing its window ends it.
|
|
||||||
if !app.view_mode platform_show_tray_icon();
|
|
||||||
defer platform_hide_tray_icon();
|
|
||||||
}
|
}
|
||||||
#if USING_WINDOWS { // :Win32_Initialize_Extended
|
#if USING_WINDOWS { // :Win32_Initialize_Extended
|
||||||
// The tray icon stays for as long as the app runs, not only while the window is hidden. View
|
// View mode has no tray: closing its window ends it.
|
||||||
// mode has no tray: closing its window ends it.
|
if !app.view_mode { Win32_Set_Tray_Icon(); Win32_Hide_Tray_Icon(); }
|
||||||
if !app.view_mode Win32_Set_Tray_Icon();
|
defer if !app.view_mode Win32_Hide_Tray_Icon(); // exiting from the tray would otherwise leave the icon behind
|
||||||
defer Win32_Hide_Tray_Icon(); // Windows would otherwise leave the icon behind until hovered
|
|
||||||
}
|
}
|
||||||
// [global_hotkeys] was read with the settings, before there was a window to register them for.
|
// [global_hotkeys] was read with the settings, before there was a window to register them for.
|
||||||
// The running instance has them; view mode leaves them alone.
|
// The running instance has them; view mode leaves them alone.
|
||||||
|
|||||||
@ -17,7 +17,6 @@ Platform :: struct { // Windows
|
|||||||
global_hotkeys_failed: string; // the combinations that could not be registered, for the main window; heap
|
global_hotkeys_failed: string; // the combinations that could not be registered, for the main window; heap
|
||||||
tray_icon_configured: bool; // nid and its icon are ready; adding it can still fail while Explorer is not
|
tray_icon_configured: bool; // nid and its icon are ready; adding it can still fail while Explorer is not
|
||||||
tray_icon_failed: bool; // minimizing then goes to the taskbar; the main window says so
|
tray_icon_failed: bool; // minimizing then goes to the taskbar; the main window says so
|
||||||
tray_icon_added: bool; // the icon is in the notification area now
|
|
||||||
|
|
||||||
hwnd: HWND;
|
hwnd: HWND;
|
||||||
|
|
||||||
@ -174,10 +173,8 @@ WndProc :: (hWnd: HWND, message: u32, wParam: WPARAM, lParam: LPARAM) -> LRESULT
|
|||||||
if swallow_hotkey_character && (message == WM_KEYDOWN || message == WM_SYSKEYDOWN) return 0;
|
if swallow_hotkey_character && (message == WM_KEYDOWN || message == WM_SYSKEYDOWN) return 0;
|
||||||
|
|
||||||
if taskbar_created_message && message == taskbar_created_message {
|
if taskbar_created_message && message == taskbar_created_message {
|
||||||
// The icon stays for as long as the app runs, so it goes back. Without it, a window hidden
|
// Without the icon, a window hidden in the tray could only come back by hotkey.
|
||||||
// in the tray could only come back by hotkey.
|
if app.minimized_to_tray && !Win32_Show_Tray_Icon() {
|
||||||
tray_icon_added = false;
|
|
||||||
if !Win32_Show_Tray_Icon() && app.minimized_to_tray {
|
|
||||||
ShowWindow(hwnd, SW_MINIMIZE);
|
ShowWindow(hwnd, SW_MINIMIZE);
|
||||||
app.minimized_to_tray = false;
|
app.minimized_to_tray = false;
|
||||||
}
|
}
|
||||||
@ -349,11 +346,9 @@ win32_virtual_key :: (key: ImGui.Key) -> u32 {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adds the icon unless it is already there. Fails while Explorer is not running, so a failed add
|
// Also fails while Explorer is not running, so it is checked on every call.
|
||||||
// is tried again on the next call.
|
|
||||||
Win32_Show_Tray_Icon :: () -> bool { using platform;
|
Win32_Show_Tray_Icon :: () -> bool { using platform;
|
||||||
if !tray_icon_configured return false;
|
if !tray_icon_configured return false;
|
||||||
if tray_icon_added return true;
|
|
||||||
if !cast(bool) Shell_NotifyIconW(NIM_ADD, *nid) {
|
if !cast(bool) Shell_NotifyIconW(NIM_ADD, *nid) {
|
||||||
log_error("Shell_NotifyIconW(NIM_ADD) failed; minimizing to the taskbar instead of the tray.");
|
log_error("Shell_NotifyIconW(NIM_ADD) failed; minimizing to the taskbar instead of the tray.");
|
||||||
os_log_error();
|
os_log_error();
|
||||||
@ -361,13 +356,11 @@ Win32_Show_Tray_Icon :: () -> bool { using platform;
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
tray_icon_failed = false; // an earlier failure while Explorer was down has passed
|
tray_icon_failed = false; // an earlier failure while Explorer was down has passed
|
||||||
tray_icon_added = true;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Win32_Hide_Tray_Icon :: () { using platform;
|
Win32_Hide_Tray_Icon :: () { using platform;
|
||||||
if tray_icon_added Shell_NotifyIconW(NIM_DELETE, *nid);
|
if tray_icon_configured Shell_NotifyIconW(NIM_DELETE, *nid);
|
||||||
tray_icon_added = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Win32_Set_Tray_Icon :: () { using platform;
|
Win32_Set_Tray_Icon :: () { using platform;
|
||||||
@ -393,9 +386,13 @@ Win32_Set_Tray_Icon :: () { using platform;
|
|||||||
nid.hIcon = tray_icon;
|
nid.hIcon = tray_icon;
|
||||||
memcpy(nid.szTip.data, Tooltip_Text_u16, Tooltip_Text.count * size_of(u16));
|
memcpy(nid.szTip.data, Tooltip_Text_u16, Tooltip_Text.count * size_of(u16));
|
||||||
// Configured even if this first add fails: at autostart Explorer's notification area may not be
|
// Configured even if this first add fails: at autostart Explorer's notification area may not be
|
||||||
// ready yet, and Win32_Show_Tray_Icon tries again on every minimize and when Explorer starts.
|
// ready yet, and Win32_Show_Tray_Icon adds the icon again on every minimize.
|
||||||
tray_icon_configured = true;
|
tray_icon_configured = true;
|
||||||
Win32_Show_Tray_Icon();
|
if !cast(bool) Shell_NotifyIconW(NIM_ADD, *nid) {
|
||||||
|
log_error("Shell_NotifyIconW(NIM_ADD) failed; minimizing to the taskbar until it succeeds.");
|
||||||
|
os_log_error();
|
||||||
|
tray_icon_failed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImGui rescales the fonts per monitor by itself, but the theme's sizes are baked at one scale, so
|
// ImGui rescales the fonts per monitor by itself, but the theme's sizes are baked at one scale, so
|
||||||
@ -434,6 +431,7 @@ Win32_Restore_Window_From_Tray :: () {
|
|||||||
if app.minimized_to_tray {
|
if app.minimized_to_tray {
|
||||||
ShowWindow(hwnd, SW_SHOW);
|
ShowWindow(hwnd, SW_SHOW);
|
||||||
app.minimized_to_tray = false;
|
app.minimized_to_tray = false;
|
||||||
|
Win32_Hide_Tray_Icon();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -49,6 +49,13 @@ platform_restore_window :: () {
|
|||||||
// A global hotkey arrives while another app is active, and raising the window alone does not
|
// A global hotkey arrives while another app is active, and raising the window alone does not
|
||||||
// make this the active app.
|
// make this the active app.
|
||||||
NSApplication.activateIgnoringOtherApps(NSApplication.sharedApplication(), YES);
|
NSApplication.activateIgnoringOtherApps(NSApplication.sharedApplication(), YES);
|
||||||
|
platform_hide_tray_icon();
|
||||||
|
}
|
||||||
|
#if OS == .LINUX {
|
||||||
|
// Right now, this doesn't work on my XFCE Arch Desktop, so I'm just going to leave the icon in the tray. Sad.
|
||||||
|
if platform.desktop_environment == .XFCE {
|
||||||
|
log("platform_hide_tray_icon is broken on XFCE, so it is currently disabled!");
|
||||||
|
} else platform_hide_tray_icon();
|
||||||
}
|
}
|
||||||
|
|
||||||
app.minimized_to_tray = false;
|
app.minimized_to_tray = false;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
# gpu-bench
|
# gpu-bench (the `gpu-bench` branch, not for master)
|
||||||
|
|
||||||
Times every model mcap runs on the GPU over a fixed corpus, so machines can be compared like for
|
Times every model mcap runs on the GPU over a fixed corpus, so machines can be compared like for
|
||||||
like:
|
like:
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
// -ocr-workers N OCR's worker threads on the GPU, in place of Ocr_Options' (for investigating memory)
|
// -ocr-workers N OCR's worker threads on the GPU, in place of Ocr_Options' (for investigating memory)
|
||||||
// -ort-log LEVEL onnxruntime's console log: verbose, info (each GPU arena extension), warning (default)
|
// -ort-log LEVEL onnxruntime's console log: verbose, info (each GPU arena extension), warning (default)
|
||||||
//
|
//
|
||||||
// Build: jai first.jai - release (it is built with mcap).
|
// Build: jai first.jai - release (it is built with mcap on the gpu-bench branch).
|
||||||
|
|
||||||
USAGE :: "Usage: gpu-bench [-only ocr,labels,segment] [-models a,b] [-repeats N] [-warmup N] [-cpu | -cpu-only] [-corpus FOLDER] [-out FOLDER] [-note TEXT] [-progress] [-ocr-workers N] [-ort-log LEVEL]\n";
|
USAGE :: "Usage: gpu-bench [-only ocr,labels,segment] [-models a,b] [-repeats N] [-warmup N] [-cpu | -cpu-only] [-corpus FOLDER] [-out FOLDER] [-note TEXT] [-progress] [-ocr-workers N] [-ort-log LEVEL]\n";
|
||||||
|
|
||||||
@ -359,7 +359,7 @@ run_task :: (task: *Task, prefer_gpu: bool, corpus: *Corpus) -> Run {
|
|||||||
if prefer_gpu && run.provider != "CUDA" {
|
if prefer_gpu && run.provider != "CUDA" {
|
||||||
// Said, and not timed: the CPU run, when asked for, is the same thing.
|
// Said, and not timed: the CPU run, when asked for, is the same thing.
|
||||||
sampler_stop();
|
sampler_stop();
|
||||||
run.error = sprint("not on the GPU: %", run.explanation);
|
run.error = tprint("not on the GPU: %", run.explanation,, context.allocator);
|
||||||
return run;
|
return run;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -69,7 +69,7 @@ bench_parse :: (text: string, path := "") -> Bench_Report, ok: bool, error: stri
|
|||||||
} else if key == "model" {
|
} else if key == "model" {
|
||||||
space := find_index_from_left(value, #char " ");
|
space := find_index_from_left(value, #char " ");
|
||||||
if space < 0 continue;
|
if space < 0 continue;
|
||||||
array_add(*report.header, .{sprint("model %", slice(value, 0, space)), copy_string(trim(advance(value, space + 1)))});
|
array_add(*report.header, .{tprint("model %", slice(value, 0, space),, context.allocator), copy_string(trim(advance(value, space + 1)))});
|
||||||
} else {
|
} else {
|
||||||
array_add(*report.header, .{copy_string(key), copy_string(value)});
|
array_add(*report.header, .{copy_string(key), copy_string(value)});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user