Compare commits

..
Author SHA1 Message Date
codegirl007 3a8c2ee830 change the way we install sdl 2026-08-01 01:10:37 -07:00
codegirl007 a1fa9863b6 Set up github to run tests 2026-08-01 01:06:05 -07:00
codegirl007 d5ef7f478e Add initial unit tests
- Pulled pure logic out of GPU-facing code so it can be tested without a window: parse_char_def (JSON → Char_Def) and choose_shader_runtime_from_formats (MSL → DXIL → SPIR-V preference)
- Added eight Odin @(test) cases in engine/ covering happy/bad JSON parse, frame-rect hit/miss/OOB, clip-space conversion corners, shader filename mapping, and backend selection
- Added make test to run odin test engine
2026-08-01 01:04:31 -07:00
codegirl007 71d3ce4041 small edit to makefile 2026-08-01 01:03:16 -07:00
codegirl007 22cca621f7 Add shader backend + support for multiple shader formats- #2
Adds a runtime GPU shader-backend selection layer so the engine is no longer hardcoded to #load SPIR-V only.

- Introduce Shader_Runtime / choose_shader_runtime (engine/shader_backend.odin)
- Create the GPU device with {.SPIRV, .DXIL, .MSL}, then pick a supported format + shaders/<backend>/ directory
- Load shader blobs from disk and build the sprite pipeline with the chosen format/entrypoint
- Add shader build scripts + Makefile targets (shaders-vulkan / d3d12 / metal / all)
2026-08-01 00:57:32 -07:00
2 changed files with 56 additions and 1 deletions
+55
View File
@@ -0,0 +1,55 @@
name: CI
on:
pull_request:
push:
branches: [master, main]
jobs:
test:
name: Engine tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
# Ubuntu 24.04 does not ship libsdl3-dev; build/install SDL3 from source (cached).
- name: Setup SDL3
id: sdl
uses: libsdl-org/setup-sdl@main
with:
version: 3-latest
install-linux-dependencies: true
add-to-environment: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Export SDL3 paths for the linker
run: |
PREFIX="${{ steps.sdl.outputs.prefix }}"
echo "PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH:-}" >> "$GITHUB_ENV"
echo "LIBRARY_PATH=${PREFIX}/lib:${LIBRARY_PATH:-}" >> "$GITHUB_ENV"
echo "LD_LIBRARY_PATH=${PREFIX}/lib:${LD_LIBRARY_PATH:-}" >> "$GITHUB_ENV"
echo "C_INCLUDE_PATH=${PREFIX}/include:${C_INCLUDE_PATH:-}" >> "$GITHUB_ENV"
# Help some linkers find the shared lib without rpath surprises
if [ -d "${PREFIX}/lib" ]; then
echo "${PREFIX}/lib" | sudo tee /etc/ld.so.conf.d/sdl3-ci.conf >/dev/null
sudo ldconfig
fi
- name: Setup Odin
uses: laytan/setup-odin@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
# Match local toolchain: odin version dev-2026-05
release: dev-2026-05
- name: Odin version
run: odin version
- name: Unit tests
run: make test
- name: Typecheck toad example
run: make check
+1 -1
View File
@@ -6,7 +6,7 @@ help:
@echo " shaders-d3d12 Compile DXIL into shaders/d3d12/ (needs shadercross)"
@echo " shaders-metal Compile MSL into shaders/metal/ (needs shadercross)"
@echo " shaders-all Build all shader backends"
@echo " test Run engine pure unit tests"
@echo " test Run engine unit tests"
@echo " check Typecheck examples/toad"
@echo " toad Run the toad example"