Skip to content

Commit 39be040

Browse files
committed
metal: build shaders in Makefile instead
1 parent b7eb2ad commit 39be040

File tree

4 files changed

+7
-89
lines changed

4 files changed

+7
-89
lines changed

Makefile

+6-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ else
3939
endif
4040

4141

42-
.PHONY: all check quad quad-wasm test doc reftests benches
42+
.PHONY: all check quad quad-wasm test doc reftests benches metal-shaders
4343

4444
all: check test
4545

@@ -78,3 +78,8 @@ quad:
7878
quad-wasm:
7979
cd examples && cargo +nightly build --target wasm32-unknown-unknown --features gl --bin quad && wasm-bindgen ../target/wasm32-unknown-unknown/debug/quad.wasm --out-dir ../examples/generated-wasm --web
8080

81+
metal-shaders:
82+
cd ./src/backend/metal/shaders && \
83+
xcrun -sdk macosx metal -c *.metal -mmacosx-version-min=10.11 && \
84+
xcrun -sdk macosx metallib *.air -o gfx_shaders.metallib && \
85+
rm *.air

src/backend/metal/build.rs

-87
This file was deleted.
54.8 KB
Binary file not shown.

src/backend/metal/src/internal.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ pub struct ServicePipes {
451451

452452
impl ServicePipes {
453453
pub fn new(device: &metal::DeviceRef) -> Self {
454-
let data = include_bytes!(concat!(env!("OUT_DIR"), "/gfx_shaders.metallib"));
454+
let data = include_bytes!("./../shaders/gfx_shaders.metallib");
455455
let library = device.new_library_with_data(data).unwrap();
456456

457457
let copy_buffer = Self::create_copy_buffer(&library, device);

0 commit comments

Comments
 (0)