Skip to content

Commit

Permalink
Fixed shader compilation.
Browse files Browse the repository at this point in the history
  • Loading branch information
zlogic committed Jan 24, 2024
1 parent 372fe76 commit 889e762
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
8 changes: 8 additions & 0 deletions .github/compile-shaders-spirv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
rm -f src/correlation/*.spv
for ENTRYPOINT in src/correlation/*.comp.glsl; do
ENTRYPOINT_NAME=$(basename $ENTRYPOINT | cut -f 1 -d ".")
echo "Compiling $ENTRYPOINT_NAME..."
glslangValidator -V -g0 $ENTRYPOINT -e $ENTRYPOINT_NAME \
-o src/correlation/${ENTRYPOINT_NAME}.spv
done
16 changes: 8 additions & 8 deletions .github/workflows/cargo-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: sudo apt install glslang-tools

- name: Build SPIR-V shaders with glslang
run: glslangValidator -V -g0 src/correlation/correlation.comp.glsl -o src/correlation/correlation.spv
run: .github/compile-shaders-spirv.sh

- name: Validate Rust code with clippy
run: cargo clippy
Expand All @@ -42,7 +42,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: shaders-spv
path: src/correlation/correlation.spv
path: src/correlation/*.spv

build-linux:
# Older Ubuntu versions will link with an older GLIBC and provide better compatibility
Expand Down Expand Up @@ -191,18 +191,18 @@ jobs:
xcrun -sdk macosx metal -c src/correlation/correlation.metal -o src/correlation/correlation.air
xcrun -sdk macosx metallib src/correlation/correlation.air -o src/correlation/correlation.metallib
- name: Upload metallib shaders
uses: actions/upload-artifact@v4
with:
name: shaders-metallib
path: src/correlation/correlation.metallib

- name: Build
run: cargo build --target=${{ matrix.arch }}-apple-darwin --release

- name: Package application
run: tar -cvjf cybervision-${{ runner.os }}-${{ matrix.arch }}.tar.bz2 -C target/${{ matrix.arch }}-apple-darwin/release cybervision

- name: Upload metallib shaders
uses: actions/upload-artifact@v4
with:
name: shaders-metallib-${{ matrix.arch }}
path: src/correlation/correlation.metallib

- name: Upload application
uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Rust build directory
/target

/src/correlation/*.spv

0 comments on commit 889e762

Please sign in to comment.