vk-graph 0.14.4

A high-performance Vulkan driver with automatic resource management and execution.
Documentation
#!/bin/sh

set -e

TIMEOUT=

if [ "$#" -gt 0 ]; then
    if [ "$1" = "--timeout" ] && [ "$#" -ge 2 ]; then
        TIMEOUT=$2
        shift 2
    else
        printf 'usage: %s [--timeout SECONDS]\n' "$0" >&2
        exit 1
    fi
fi

xdotool=""
if [ -n "$TIMEOUT" ]; then
    if [ -n "$DISPLAY" ] \
        && command -v xdotool >/dev/null 2>&1 \
        && xdotool getdisplaygeometry >/dev/null 2>&1; then
        xdotool="xdotool"
    else
        printf "run-all-examples: WARNING xdotool unavailable, using timeout fallback" >&2
    fi
fi

close_windows() {
    _children=$(pgrep -P "$1" 2>/dev/null || true)

    # Try to close any X11 windows owned by PID $1, ignoring failure
    "$xdotool" search --pid "$1" windowclose >/dev/null 2>&1 || true

    for _ch in $_children; do
        close_windows "$_ch"
    done
}

ok_or_timeout() {
    if "$@"; then
        return 0
    fi

    _ret=$?
    [ "$_ret" -eq 124 ] && return 0
    return "$_ret"
}

run() {
    # If there is no timeout we just run the command
    if [ -z "$TIMEOUT" ]; then
        "$@"
        return
    fi

    if [ -n "$xdotool" ]; then
        # Close the window with a window message after a timeout
        "$@" &
        _PID=$!
        sleep "$TIMEOUT"
        close_windows "$_PID"
        ok_or_timeout wait "$_PID"
    else
        # Kill the process after a timeout
        ok_or_timeout timeout "$TIMEOUT" "$@"
    fi
}

# Build all examples and bins first to get failures fast
cargo build --workspace --examples --bins

# Run the "test" example first
cargo run --example fuzzer

# Run all regular examples, in debug mode, next
run cargo run -p vk-graph-window --example hello_world -- --debug
run cargo run --example app -- --debug
run cargo run --example aliasing -- --debug
run cargo run --example cpu_readback -- --debug
run cargo run --example subgroup_ops -- --debug
run cargo run --example bindless -- --debug
run cargo run --example image_sampler -- --debug
run cargo run --example image_sampler -- --debug --hlsl
run cargo run --example image_sampler -- --debug --separate
run cargo run --example image_sampler -- --debug --hlsl --separate
run cargo run --example vertex_layout -- --debug
run cargo run --example font_bmp -- --debug
run cargo run --example egui -- --debug
run cargo run --example imgui -- --debug
run cargo run --example min_max -- --debug
run cargo run --example mip_compute -- --debug
run cargo run --example mip_graphics -- --debug
run cargo run --example multithread -- --debug
run cargo run --example multithread -- --debug --concurrent
run cargo run --example multithread --release
run cargo run --example multithread --release -- --concurrent
run cargo run --example multipass -- --debug
run cargo run --example msaa -- --debug
run cargo run --example triangle -- --debug
run cargo run --example rt_triangle -- --debug
run cargo run --example ray_tracing -- --debug
run cargo run --example transitions -- --debug
run cargo run --example vsm_omni -- --debug
run cargo run --example vsm_omni -- --debug --geometry-shader
run cargo run --example ray_omni -- --debug
run cargo run -p skeletal-anim -- --debug

# Hot-reload examples
run cargo run -p vk-graph-hot --example glsl -- --debug
run cargo run -p vk-graph-hot --example hlsl -- --debug

# Run this one in release mode
run cargo run -p shader-toy --release -- --debug