Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to compile examples on Unix #23

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,9 @@ __history/
# Castalia statistics file (since XE7 Castalia is distributed with Delphi)
*.stat

# Binaries
# Unix binaries
projectmanager
examples_x86_64-linux

FPCOutput
*.spv
35 changes: 35 additions & 0 deletions projects/examples/src/assets/shaders/compileshaders
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'

# ------------------------------------------------------------------------------
# Compile shaders with Spir-V for Vulkan.
# Make sure you have glslangValidator and spirv-opt
# (on Debian-based systems, just "apt install glslang-tools").
#
# bash script using http://redsymbol.net/articles/unofficial-bash-strict-mode/
# ------------------------------------------------------------------------------

compile_dir ()
{
SUBDIR_NAME="$1"
cd "${SUBDIR_NAME}"

for VERT_SHADER in *.vert; do
glslangValidator -V ${VERT_SHADER} -o `basename ${VERT_SHADER} .vert`.spv
done
for FRAG_SHADER in *.frag; do
glslangValidator -V ${FRAG_SHADER} -o `basename ${FRAG_SHADER} .frag`.spv
done
for f in *.spv; do
spirv-opt --strip-debug --unify-const --flatten-decorations --eliminate-dead-const --strength-reduction --simplify-instructions --remove-duplicates -O $f -o $f
done
mv -f *.spv ../../../../assets/shaders/"${SUBDIR_NAME}"

cd ../
}

compile_dir textoverlay
compile_dir triangle
compile_dir cube
compile_dir dragon
19 changes: 19 additions & 0 deletions src/assets/shaders/compileshaders
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'

# ------------------------------------------------------------------------------
# Compile shaders with Spir-V for Vulkan.
# Make sure you have glslc and glslangValidator
# (on Debian-based systems, just "apt install glslc glslang-tools").
#
# bash script using http://redsymbol.net/articles/unofficial-bash-strict-mode/
# ------------------------------------------------------------------------------

cd canvas
./compileshaders.sh
cd ..

cd scene3d
./compileshaders.sh
cd ..
2 changes: 1 addition & 1 deletion src/tools/projectmanager/makefpc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
mkdir -p fpctemp
fpc -Sd -B -FEfpctemp -FUfpctemp -o../../../projectmanager projectmanager.dpr
rm -f fpctemp
rm -Rf fpctemp