mcap/check_targets.jai
Musa Mahmood 9953ba6f1f [0.1.4] Video capture phase 2: Windows.Graphics.Capture, for when Desktop Duplication cannot run
- modules/Screen_Record/wgc_source.jai: the screen through Windows.Graphics.Capture, with
  hand-written bindings for its WinRT interfaces (capture item interop, item, free-threaded frame
  pool, frame, session 1-3, IDirect3DDxgiInterfaceAccess, IClosable). A small COM handler on
  FrameArrived sets an event per frame; when Windows refuses it the pool is polled each
  millisecond. The cursor is drawn by Windows; the yellow border is turned off where the system
  allows (Windows 11). A screen that changes size makes the pool again. WinRT's own calls are
  loaded from combase.dll at run time: runtimeobject.lib names no DLL for #library.
- capture_gpu.jai: what both sources share (the device on the screen's adapter, the region copy,
  the staging ring), so each is only "the next image's region into a texture".
- Record_Options.capture: AUTO (Desktop Duplication, else Windows.Graphics.Capture when it says
  fall_back), DXGI or WGC. Sources open on the capture thread, as WinRT objects belong to their
  apartment; record_start waits for it to say how that went. Record_Options.testing simulates the
  two-GPU failure, forces polling, or keeps the border, for record-probe.
- record-probe: -capture auto|dxgi|wgc, -simulate-unsupported, -poll, -border-test with
  -keep-border as its control, -cursor-test; DPI awareness set already is no longer reported as
  a failure.
- On the RTX 5080 laptop: auto falls back on the simulated failure; WGC records 4K at 60 fps with
  nothing dropped; its cursor and the one cursor.jai draws for duplication are the same; the
  border is off for an unpackaged app (0 yellow edge pixels, 14,214 with it kept);
  WDA_EXCLUDEFROMCAPTURE is respected; polling holds 30 fps. The plan records the results.
- README: Screen_Record's line, which held a carriage return in place of "\r" since 0.1.3.
2026-10-10 07:03:47 +01:00

52 lines
1.6 KiB
Plaintext

// Type-checks src/App.jai for another OS without producing or linking a binary, to catch errors
// in code your machine does not build:
//
// jai check_targets.jai - linux (from any OS)
// jai check_targets.jai - macos (from a Mac only: the Objective_C module runs code at compile time)
//
// The constants below stand in for the ones first.jai generates; keep their names in step.
#run,stallable {
set_build_options_dc(.{do_output = false});
args := get_build_options().compile_time_command_line;
target := Operating_System_Tag.LINUX;
cpu := CPU_Tag.X64;
if array_find(args, "macos") { target = .MACOS; cpu = .ARM64; }
options := get_build_options();
options.os_target = target;
options.cpu_target = cpu;
options.output_type = .NO_OUTPUT;
options.backend = .LLVM;
options.output_executable_name = "check";
options.output_path = ".build";
w := compiler_create_workspace("check");
set_build_options(options, w);
compiler_begin_intercept(w);
add_build_file("src/App.jai", w);
add_build_string(#string S
APP_NAME :: "mcap";
APP_FOLDER_NAME :: "mcap";
GIT_BRANCH :: "check";
GIT_HASH :: "-";
VERSION :: "0.1.4";
BUILD_DATE :: "-";
DEBUG :: true;
COMPILE_TESTS :: true;
COMPILE_ARGS :: "";
NO_CRASH_DIALOG :: false;
S, w);
while true {
message := compiler_wait_for_message();
if message.kind == .COMPLETE {
m := cast(*Message_Complete) message;
log("% check: %", target, m.error_code);
break;
}
}
compiler_end_intercept(w);
}
#import "Basic";
#import "Compiler";