forked from amethyst/amethyst
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Precompile shaders offline, add shader makefile
+ makes shaderc dependency optional + removes requirement of distributing builtin shaders + speeds up engine startup time
- Loading branch information
Showing
22 changed files
with
161 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
GLSLC = $(shell ./find_glslc.sh) | ||
ifeq "$(GLSLC)" "" | ||
break; | ||
endif | ||
|
||
FLAGS = -c -g | ||
|
||
SHADERS=$(wildcard shaders/**/*) | ||
COMP_SHADERS = $(patsubst shaders/%,compiled/%.spv,$(SHADERS)) | ||
COMP_DISASMS = $(patsubst shaders/%,compiled/%.spvasm,$(SHADERS)) | ||
|
||
all: $(COMP_SHADERS) $(COMP_DISASMS) | ||
|
||
compiled/%.spv: shaders/% | ||
mkdir -p $(dir $@) | ||
$(GLSLC) -MD -c -g -O -o $@ $< | ||
|
||
compiled/%.spvasm: shaders/% | ||
mkdir -p $(dir $@) | ||
$(GLSLC) -MD -S -g -O -o $@ $< | ||
|
||
clean: | ||
rm compiled/**/*.spv compiled/**/*.spvasm compiled/**/*.d | ||
|
||
.PHONY: all clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.spvasm | ||
*.d |
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
amethyst_rendy/compiled/vertex/pos_norm_tang_tex_skin.vert.spv
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
cd "${0%/*}" | ||
set -e | ||
|
||
BIN="" | ||
|
||
if [ -e "$(which glslc)" ]; then | ||
BIN="$(which glslc)" | ||
elif [ -e "$(which glslc.exe)" ]; then | ||
# support WSL | ||
BIN="$(which glslc.exe)" | ||
else | ||
>&2 echo "Cannot find glslc binary. Make sure you have VulkanSDK installed and added to PATH." | ||
exit 1 | ||
fi | ||
|
||
echo "$BIN" | ||
|
||
# for SHADER in $(find shaders -type f -name "*.vert" -o -name "*.frag"); do | ||
# echo $SHADER | ||
# "$BIN" -MD -c -g -O "$SHADER" -o "$SHADER.spv" | ||
# "$BIN" -S -g -O "$SHADER" -o "$SHADER.spvasm" | ||
# done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters