Harbor

branch main
showing the latest snapshot on main
check.sh 1.6 KB · Shell
gpu/scripts/check.sh 0755 Raw
#!/bin/sh
set -eu

ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"

WINDOW_COLLECTION="${GPU_WINDOW_COLLECTION:-$ROOT/../window}"
RENDER_IR_TEST_BIN="${TMPDIR:-/tmp}/gpu_render_ir_tests_$$"
trap 'rm -f "$RENDER_IR_TEST_BIN"' EXIT HUP INT TERM

if [ "${GPU_SKIP_LUA_SELFTEST:-0}" != "1" ]; then
	echo "==> test: lua tooling"
	lua tools/test.lua selftest
	lua tools/test.lua visual-matrix --dry-run --json "${TMPDIR:-/tmp}/gpu_visual_matrix_dry_run_$$.json" >/dev/null
fi

echo "==> test: shader"
odin test shader
shader/tests/workflow_equivalence.sh

echo "==> test: render_ir"
odin test tests/render_ir -collection:window="$WINDOW_COLLECTION" -out:"$RENDER_IR_TEST_BIN"

echo "==> test: profile"
odin test tests/profile -collection:window="$WINDOW_COLLECTION"

echo "==> test: tests"
odin test tests -collection:window="$WINDOW_COLLECTION"

echo "==> check: d3d12 transition boundary"
if grep -n "Type = \\.TRANSITION\\|transition_resource(" backend/d3d12/d3d12_ops.odin backend/d3d12/d3d12_frame.odin; then
	echo "D3D12 transition barriers must go through typed helpers in d3d12_backend.odin" >&2
	exit 1
fi

for backend in vulkan d3d11 d3d12 opengl; do
	echo "==> check: gpu ($backend)"
	odin check . -no-entry-point -collection:window="$WINDOW_COLLECTION" -define:GPU_BACKEND="$backend"
done

for example in examples/*; do
	if [ -d "$example" ] && [ -f "$example/main.odin" ]; then
		echo "==> check: $example"
		odin check "$example" -collection:window="$WINDOW_COLLECTION"
	fi
done

for tool in tools/*; do
	if [ -d "$tool" ] && [ -f "$tool/main.odin" ]; then
		echo "==> check: $tool"
		odin check "$tool" -collection:window="$WINDOW_COLLECTION"
	fi
done