Skip to content

Commit

Permalink
metal: build shaders in Makefile instead
Browse files Browse the repository at this point in the history
  • Loading branch information
grovesNL committed Oct 17, 2019
1 parent b7eb2ad commit 5282bee
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 89 deletions.
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ else
endif


.PHONY: all check quad quad-wasm test doc reftests benches
.PHONY: all check quad quad-wasm test doc reftests benches shader-binaries

all: check test

Expand Down Expand Up @@ -78,3 +78,10 @@ quad:
quad-wasm:
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

shader-binaries:
ifeq ($(UNAME_S),Darwin)
cd ./src/backend/metal/shaders && \
xcrun -sdk macosx metal -c *.metal -mmacosx-version-min=10.11 && \
xcrun -sdk macosx metallib *.air -o gfx_shaders.metallib && \
rm *.air
endif
87 changes: 0 additions & 87 deletions src/backend/metal/build.rs

This file was deleted.

Binary file added src/backend/metal/shaders/gfx_shaders.metallib
Binary file not shown.
2 changes: 1 addition & 1 deletion src/backend/metal/src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ pub struct ServicePipes {

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

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

0 comments on commit 5282bee

Please sign in to comment.