package parity_common import "core:os" import app "../../app" import gpu "../.." Runtime :: struct { app_state: app.State, headless: bool, } init_runtime :: proc(width, height: u32, title: cstring) -> (runtime: Runtime, ok: bool) { runtime.headless = os.get_env("GPU_PROOF_HEADLESS", context.allocator) == "1" if runtime.headless { if !gpu.init_headless(width, height, title) { return runtime, false } return runtime, true } state, app_ok := app.init_window(i32(width), i32(height), title) if !app_ok { return runtime, false } runtime.app_state = state return runtime, true } shutdown_runtime :: proc(runtime: ^Runtime) { if runtime == nil do return if runtime.headless { gpu.shutdown() return } app.shutdown(&runtime.app_state) }