diff --git a/examples/01-cubes/makefile b/examples/01-cubes/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/01-cubes/makefile +++ b/examples/01-cubes/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/03-raymarch/makefile b/examples/03-raymarch/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/03-raymarch/makefile +++ b/examples/03-raymarch/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/04-mesh/makefile b/examples/04-mesh/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/04-mesh/makefile +++ b/examples/04-mesh/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/05-instancing/makefile b/examples/05-instancing/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/05-instancing/makefile +++ b/examples/05-instancing/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/06-bump/makefile b/examples/06-bump/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/06-bump/makefile +++ b/examples/06-bump/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/07-callback/makefile b/examples/07-callback/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/07-callback/makefile +++ b/examples/07-callback/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/08-update/makefile b/examples/08-update/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/08-update/makefile +++ b/examples/08-update/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/09-hdr/makefile b/examples/09-hdr/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/09-hdr/makefile +++ b/examples/09-hdr/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/12-lod/makefile b/examples/12-lod/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/12-lod/makefile +++ b/examples/12-lod/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/13-stencil/makefile b/examples/13-stencil/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/13-stencil/makefile +++ b/examples/13-stencil/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/14-shadowvolumes/makefile b/examples/14-shadowvolumes/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/14-shadowvolumes/makefile +++ b/examples/14-shadowvolumes/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/15-shadowmaps-simple/makefile b/examples/15-shadowmaps-simple/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/15-shadowmaps-simple/makefile +++ b/examples/15-shadowmaps-simple/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/16-shadowmaps/makefile b/examples/16-shadowmaps/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/16-shadowmaps/makefile +++ b/examples/16-shadowmaps/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/18-ibl/makefile b/examples/18-ibl/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/18-ibl/makefile +++ b/examples/18-ibl/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/19-oit/makefile b/examples/19-oit/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/19-oit/makefile +++ b/examples/19-oit/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/21-deferred/makefile b/examples/21-deferred/makefile index ce6bf430d..94d3aae70 100644 --- a/examples/21-deferred/makefile +++ b/examples/21-deferred/makefile @@ -8,10 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all diff --git a/examples/23-vectordisplay/makefile b/examples/23-vectordisplay/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/23-vectordisplay/makefile +++ b/examples/23-vectordisplay/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/24-nbody/makefile b/examples/24-nbody/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/24-nbody/makefile +++ b/examples/24-nbody/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/27-terrain/makefile b/examples/27-terrain/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/27-terrain/makefile +++ b/examples/27-terrain/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/28-wireframe/makefile b/examples/28-wireframe/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/28-wireframe/makefile +++ b/examples/28-wireframe/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/30-picking/makefile b/examples/30-picking/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/30-picking/makefile +++ b/examples/30-picking/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/31-rsm/makefile b/examples/31-rsm/makefile index 3ee4cd72c..94d3aae70 100644 --- a/examples/31-rsm/makefile +++ b/examples/31-rsm/makefile @@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk - -rebuild: - @make -s --no-print-directory TARGET=0 clean all - @make -s --no-print-directory TARGET=1 clean all - @make -s --no-print-directory TARGET=2 clean all - @make -s --no-print-directory TARGET=3 clean all - @make -s --no-print-directory TARGET=4 clean all - @make -s --no-print-directory TARGET=5 clean all diff --git a/scripts/shader-embeded.mk b/scripts/shader-embeded.mk index 9ced9e083..04237955e 100644 --- a/scripts/shader-embeded.mk +++ b/scripts/shader-embeded.mk @@ -26,6 +26,8 @@ vs_%.bin.h : vs_%.sc @echo [$(<)] $(SILENT) $(SHADERC) $(VS_FLAGS) --platform linux -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl @cat $(SHADER_TMP) > $(@) + -$(SILENT) $(SHADERC) $(VS_FLAGS) --platform linux -p spirv -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_spv + -@cat $(SHADER_TMP) >> $(@) -$(SILENT) $(SHADERC) $(VS_FLAGS) --platform windows -p vs_3_0 -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx9 -@cat $(SHADER_TMP) >> $(@) -$(SILENT) $(SHADERC) $(VS_FLAGS) --platform windows -p vs_4_0 -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx11 @@ -39,6 +41,8 @@ fs_%.bin.h : fs_%.sc @echo [$(<)] $(SILENT) $(SHADERC) $(FS_FLAGS) --platform linux -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl @cat $(SHADER_TMP) > $(@) + -$(SILENT) $(SHADERC) $(FS_FLAGS) --platform linux -p spirv -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_spv + -@cat $(SHADER_TMP) >> $(@) -$(SILENT) $(SHADERC) $(FS_FLAGS) --platform windows -p ps_3_0 -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx9 -@cat $(SHADER_TMP) >> $(@) -$(SILENT) $(SHADERC) $(FS_FLAGS) --platform windows -p ps_4_0 -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx11 @@ -52,6 +56,8 @@ cs_%.bin.h : cs_%.sc @echo [$(<)] $(SILENT) $(SHADERC) $(CS_FLAGS) --platform linux -p 430 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl @cat $(SHADER_TMP) > $(@) + -$(SILENT) $(SHADERC) $(CS_FLAGS) --platform linux -p spirv -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_spv + -@cat $(SHADER_TMP) >> $(@) -$(SILENT) $(SHADERC) $(CS_FLAGS) --platform windows -p cs_5_0 -O 1 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx11 -@cat $(SHADER_TMP) >> $(@) -@echo extern const uint8_t* $(basename $(<))_pssl;>> $(@) diff --git a/scripts/shader.mk b/scripts/shader.mk index 5502d49b4..897b280b3 100644 --- a/scripts/shader.mk +++ b/scripts/shader.mk @@ -23,6 +23,17 @@ all: @echo " TARGET=5 (metal)" @echo " TARGET=6 (pssl)" @echo " TARGET=7 (spriv)" + +.PHONY: rebuild +rebuild: + @make -s --no-print-directory TARGET=0 clean all + @make -s --no-print-directory TARGET=1 clean all + @make -s --no-print-directory TARGET=2 clean all + @make -s --no-print-directory TARGET=3 clean all + @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all + @make -s --no-print-directory TARGET=7 clean all + else ADDITIONAL_INCLUDES?= diff --git a/scripts/shaderc.lua b/scripts/shaderc.lua index e04813d8f..17c003222 100644 --- a/scripts/shaderc.lua +++ b/scripts/shaderc.lua @@ -47,6 +47,9 @@ project "glslang" } configuration {} + defines { + "ENABLE_HLSL=1", + } includedirs { GLSLANG, diff --git a/src/makefile b/src/makefile index 00bac69fa..2475a5104 100644 --- a/src/makefile +++ b/src/makefile @@ -27,6 +27,8 @@ define shader-embedded @echo [$(<)] $(SILENT) $(SHADERC) --type $(1) --platform linux -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl @cat $(SHADER_TMP) > $(@) + -$(SILENT) $(SHADERC) --type $(1) --platform windows -p spirv -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_spv + -@cat $(SHADER_TMP) >> $(@) -$(SILENT) $(SHADERC) --type $(1) --platform windows -p $(2) -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx9 -@cat $(SHADER_TMP) >> $(@) -$(SILENT) $(SHADERC) --type $(1) --platform windows -p $(3) -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx11