Browse Source

Updated makefiles to build spirv (#1025)

Brian Harris 9 years ago
parent
commit
ffd3771a09

+ 0 - 8
examples/01-cubes/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 8
examples/03-raymarch/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 8
examples/04-mesh/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 8
examples/05-instancing/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 8
examples/06-bump/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 8
examples/07-callback/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 8
examples/08-update/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 8
examples/09-hdr/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 8
examples/12-lod/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 8
examples/13-stencil/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 8
examples/14-shadowvolumes/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 8
examples/15-shadowmaps-simple/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 8
examples/16-shadowmaps/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 8
examples/18-ibl/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 8
examples/19-oit/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 7
examples/21-deferred/makefile

@@ -8,10 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 8
examples/23-vectordisplay/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 8
examples/24-nbody/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 8
examples/27-terrain/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 8
examples/28-wireframe/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 8
examples/30-picking/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 0 - 8
examples/31-rsm/makefile

@@ -8,11 +8,3 @@ RUNTIME_DIR=$(BGFX_DIR)/examples/runtime
 BUILD_DIR=../../.build
 BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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

+ 6 - 0
scripts/shader-embeded.mk

@@ -26,6 +26,8 @@ vs_%.bin.h : vs_%.sc
 	@echo [$(<)]
 	@echo [$(<)]
 	 $(SILENT) $(SHADERC) $(VS_FLAGS) --platform linux                  -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl
 	 $(SILENT) $(SHADERC) $(VS_FLAGS) --platform linux                  -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl
 	@cat $(SHADER_TMP) > $(@)
 	@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
 	-$(SILENT) $(SHADERC) $(VS_FLAGS) --platform windows -p vs_3_0 -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx9
 	-@cat $(SHADER_TMP) >> $(@)
 	-@cat $(SHADER_TMP) >> $(@)
 	-$(SILENT) $(SHADERC) $(VS_FLAGS) --platform windows -p vs_4_0 -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx11
 	-$(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 [$(<)]
 	@echo [$(<)]
 	 $(SILENT) $(SHADERC) $(FS_FLAGS) --platform linux                  -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl
 	 $(SILENT) $(SHADERC) $(FS_FLAGS) --platform linux                  -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl
 	@cat $(SHADER_TMP) > $(@)
 	@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
 	-$(SILENT) $(SHADERC) $(FS_FLAGS) --platform windows -p ps_3_0 -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx9
 	-@cat $(SHADER_TMP) >> $(@)
 	-@cat $(SHADER_TMP) >> $(@)
 	-$(SILENT) $(SHADERC) $(FS_FLAGS) --platform windows -p ps_4_0 -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx11
 	-$(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 [$(<)]
 	@echo [$(<)]
 	 $(SILENT) $(SHADERC) $(CS_FLAGS) --platform linux -p 430           -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl
 	 $(SILENT) $(SHADERC) $(CS_FLAGS) --platform linux -p 430           -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl
 	@cat $(SHADER_TMP) > $(@)
 	@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
 	-$(SILENT) $(SHADERC) $(CS_FLAGS) --platform windows -p cs_5_0 -O 1 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx11
 	-@cat $(SHADER_TMP) >> $(@)
 	-@cat $(SHADER_TMP) >> $(@)
 	-@echo extern const uint8_t* $(basename $(<))_pssl;>> $(@)
 	-@echo extern const uint8_t* $(basename $(<))_pssl;>> $(@)

+ 11 - 0
scripts/shader.mk

@@ -23,6 +23,17 @@ all:
 	@echo "  TARGET=5 (metal)"
 	@echo "  TARGET=5 (metal)"
 	@echo "  TARGET=6 (pssl)"
 	@echo "  TARGET=6 (pssl)"
 	@echo "  TARGET=7 (spriv)"
 	@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
 else
 
 
 ADDITIONAL_INCLUDES?=
 ADDITIONAL_INCLUDES?=

+ 3 - 0
scripts/shaderc.lua

@@ -47,6 +47,9 @@ project "glslang"
 		}
 		}
 
 
 	configuration {}
 	configuration {}
+		defines {
+			"ENABLE_HLSL=1",
+		}
 
 
 	includedirs {
 	includedirs {
 		GLSLANG,
 		GLSLANG,

+ 2 - 0
src/makefile

@@ -27,6 +27,8 @@ define shader-embedded
 	@echo [$(<)]
 	@echo [$(<)]
 	 $(SILENT) $(SHADERC) --type $(1) --platform linux                 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl
 	 $(SILENT) $(SHADERC) --type $(1) --platform linux                 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl
 	 @cat $(SHADER_TMP) > $(@)
 	 @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
 	-$(SILENT) $(SHADERC) --type $(1) --platform windows -p $(2)  -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx9
 	-@cat $(SHADER_TMP) >> $(@)
 	-@cat $(SHADER_TMP) >> $(@)
 	-$(SILENT) $(SHADERC) --type $(1) --platform windows -p $(3)  -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx11
 	-$(SILENT) $(SHADERC) --type $(1) --platform windows -p $(3)  -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx11