bgfx/scripts/shader-embeded.mk

70 lines
2.7 KiB
Makefile
Raw Normal View History

2013-04-23 10:33:32 +04:00
#
2016-03-05 22:03:52 +03:00
# Copyright 2011-2016 Branimir Karadzic. All rights reserved.
2013-04-23 10:33:32 +04:00
# License: http://www.opensource.org/licenses/BSD-2-Clause
#
THISDIR:=$(dir $(lastword $(MAKEFILE_LIST)))
include $(THISDIR)/tools.mk
2013-04-23 10:33:32 +04:00
VS_FLAGS+=-i $(THISDIR)../src/ --type vertex
FS_FLAGS+=-i $(THISDIR)../src/ --type fragment
2016-03-08 02:39:11 +03:00
CS_FLAGS+=-i $(THISDIR)../src/ --type compute
2013-04-23 10:33:32 +04:00
VS_SOURCES=$(wildcard vs_*.sc)
FS_SOURCES=$(wildcard fs_*.sc)
2016-03-08 02:39:11 +03:00
CS_SOURCES=$(wildcard cs_*.sc)
2013-04-23 10:33:32 +04:00
VS_BIN = $(addsuffix .bin.h, $(basename $(VS_SOURCES)))
FS_BIN = $(addsuffix .bin.h, $(basename $(FS_SOURCES)))
2016-03-08 02:39:11 +03:00
CS_BIN = $(addsuffix .bin.h, $(basename $(CS_SOURCES)))
2013-04-23 10:33:32 +04:00
2016-03-08 02:39:11 +03:00
BIN = $(VS_BIN) $(FS_BIN) $(CS_BIN)
2013-04-23 10:33:32 +04:00
SHADER_TMP = $(TEMP)/tmp
vs_%.bin.h : vs_%.sc
@echo [$(<)]
2016-06-15 19:33:11 +03:00
$(SILENT) $(SHADERC) $(VS_FLAGS) --platform linux -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl
@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
-@cat $(SHADER_TMP) >> $(@)
2015-09-02 02:44:11 +03:00
-$(SILENT) $(SHADERC) $(VS_FLAGS) --platform ios -p metal -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_mtl
-@cat $(SHADER_TMP) >> $(@)
2016-12-06 03:55:49 +03:00
-@echo extern const uint8_t* $(basename $(<))_pssl;>> $(@)
-@echo extern const uint32_t $(basename $(<))_pssl_size;>> $(@)
2013-04-23 10:33:32 +04:00
fs_%.bin.h : fs_%.sc
@echo [$(<)]
2016-06-15 19:33:11 +03:00
$(SILENT) $(SHADERC) $(FS_FLAGS) --platform linux -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl
@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
-@cat $(SHADER_TMP) >> $(@)
2015-09-02 02:44:11 +03:00
-$(SILENT) $(SHADERC) $(FS_FLAGS) --platform ios -p metal -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_mtl
-@cat $(SHADER_TMP) >> $(@)
2016-12-06 03:55:49 +03:00
-@echo extern const uint8_t* $(basename $(<))_pssl;>> $(@)
-@echo extern const uint32_t $(basename $(<))_pssl_size;>> $(@)
2013-04-23 10:33:32 +04:00
2016-03-08 02:39:11 +03:00
cs_%.bin.h : cs_%.sc
@echo [$(<)]
2016-06-15 19:33:11 +03:00
$(SILENT) $(SHADERC) $(CS_FLAGS) --platform linux -p 430 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl
2016-03-08 02:39:11 +03:00
@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) >> $(@)
2016-12-06 03:55:49 +03:00
-@echo extern const uint8_t* $(basename $(<))_pssl;>> $(@)
-@echo extern const uint32_t $(basename $(<))_pssl_size;>> $(@)
2016-03-08 02:39:11 +03:00
2013-04-23 10:33:32 +04:00
.PHONY: all
all: $(BIN)
.PHONY: clean
clean:
@echo Cleaning...
@-rm -vf $(BIN)
.PHONY: rebuild
rebuild: clean all