move compiled shaders out of repo and put every shader in separate file

This commit is contained in:
ohyzha
2024-07-10 10:25:34 +03:00
parent 29bad103e6
commit 422e2e4261
5 changed files with 24 additions and 1307 deletions

3
.gitignore vendored
View File

@@ -6,6 +6,9 @@
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# Ignore generated shader's output
openVulkanoCpp/GeneratedShaderData/*
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml

21
Scripts/CompileShaders.sh Normal file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
GENERATED_DATA_PATH="../openVulkanoCpp/GeneratedShaderData"
rm $GENERATED_DATA_PATH/*.h
rm $GENERATED_DATA_PATH/*.c
for f in ../openVulkanoCpp/Shader/* ; do
if [[ "$f" == *.frag ]] || [[ "$f" == *.vert ]]
then
filename=$(basename -- "$f")
filename="${filename%.*}"
glslang -V $f -o $GENERATED_DATA_PATH/$filename.spv
bin2c -t -d $GENERATED_DATA_PATH/$filename.h -o $GENERATED_DATA_PATH/$filename.c $GENERATED_DATA_PATH/$filename.spv
sed -i 's/char \*entryName/const char *entryName/' $GENERATED_DATA_PATH/$filename.h
sed -i 's/const char \*data/const unsigned char *data/' $GENERATED_DATA_PATH/$filename.h
rm $GENERATED_DATA_PATH/$filename.spv
fi
done
read -p "Press enter to continue"

View File

@@ -1,19 +0,0 @@
#!/bin/bash
rm Shaders.h
rm Shaders.c
rm *.spv
for f in ./* ; do
if [[ "$f" != *.sh ]] && [[ "$f" != *.hpp ]] && [[ "$f" != *.cpp ]]
then
glslang -V $f -o $f.spv
fi
done
bin2c -t -d Shaders.h -o Shaders.c *.spv
sed -i 's/char \*entryName/const char *entryName/' Shaders.h
sed -i 's/const char \*data/const unsigned char *data/' Shaders.h
rm *.spv

File diff suppressed because it is too large Load Diff

View File

@@ -1,43 +0,0 @@
/* Generated by bin2c, do not edit manually */
#ifndef __Shaders_h_included
#define __Shaders_h_included
/* Contents of file background.frag.spv */
extern const long int background_frag_spv_size;
extern const unsigned char background_frag_spv[1076];
/* Contents of file background.vert.spv */
extern const long int background_vert_spv_size;
extern const unsigned char background_vert_spv[4180];
/* Contents of file basic.frag.spv */
extern const long int basic_frag_spv_size;
extern const unsigned char basic_frag_spv[376];
/* Contents of file basicTexture.frag.spv */
extern const long int basicTexture_frag_spv_size;
extern const unsigned char basicTexture_frag_spv[668];
/* Contents of file basic.vert.spv */
extern const long int basic_vert_spv_size;
extern const unsigned char basic_vert_spv[2972];
/* Contents of file grid.frag.spv */
extern const long int grid_frag_spv_size;
extern const unsigned char grid_frag_spv[6472];
/* Contents of file grid.vert.spv */
extern const long int grid_vert_spv_size;
extern const unsigned char grid_vert_spv[3340];
/* File table comprising original file name, address and size */
typedef struct {
const char *entryName;
const unsigned char *data;
long int size;
} TFileTableEntry;
extern const unsigned int fileTableSize;
extern const TFileTableEntry fileTable[];
#endif /* __Shaders_h_included */