#!/bin/bash
set -eu

# SHADERS

shader_compiler="glslc"
shader_flags="-std=460 -O --target-env=vulkan1.2 -g"
shader_out="-oassets/"

mkdir -p build
mkdir -p assets

for shader in src/shaders/*.glsl; do
	base_name=$(basename -- "$shader" .glsl)

	case "$base_name" in
		*.vert) shader_stage="-fshader-stage=vert" ;;
		*.frag) shader_stage="-fshader-stage=frag" ;;
		*.tesc) shader_stage="-fshader-stage=tesc" ;;
		*.tese) shader_stage="-fshader-stage=tese" ;;
		*.geom) shader_stage="-fshader-stage=geom" ;;
		*.comp) shader_stage="-fshader-stage=comp" ;;
		*) continue ;;
	esac

	$shader_compiler $shader_flags $shader_stage $shader "${shader_out}${base_name}.spv"
done

/bin/bash src/VulkanRenderer/build.sh build

/bin/bash src/dlib/build.sh build
