Files
bgfx/src/makefile
kingscallop 73784ac9eb Split embedded shaders into essl and glsl - Part 1 (#2535)
In non-embedded shaders there is a separation between essl binaries (examples/runtime/shaders/essl)
and glsl binaries (examples/runtime/shaders/glsl). On embedded shaders there is no such separation
and by default essl shaders are being used by the OpenGL runtime. This usually doesn't cause any
issues but in the case of the debugdraw shaders, that started using uvec4, this now leads to a
runtime error. This patch fixes this by splitting the embedded shaders into essl and glsl.

As asked, this is the first part of the change.

To be able to compile the 'examples/common/debugdraw' shaders, pull
request #2362 is needed.
2021-06-06 13:53:26 -07:00

84 lines
2.5 KiB
Makefile

#
# Copyright 2011-2021 Branimir Karadzic. All rights reserved.
# License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
#
THISDIR:=$(dir $(lastword $(MAKEFILE_LIST)))
include $(THISDIR)/../scripts/tools.mk
SHADER_TMP = $(TEMP)/tmp
BIN = vs_debugfont.bin.h \
fs_debugfont.bin.h \
vs_clear.bin.h \
fs_clear0.bin.h \
fs_clear1.bin.h \
fs_clear2.bin.h \
fs_clear3.bin.h \
fs_clear4.bin.h \
fs_clear5.bin.h \
fs_clear6.bin.h \
fs_clear7.bin.h \
.PHONY: all
all: $(BIN)
define shader-embedded
@echo [$(<)]
$(SILENT) $(SHADERC) --type $(1) --platform linux -p 120 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl
@cat $(SHADER_TMP) > $(@)
-$(SILENT) $(SHADERC) --type $(1) --platform android -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_essl
-@cat $(SHADER_TMP) >> $(@)
-$(SILENT) $(SHADERC) --type $(1) --platform linux -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
-@cat $(SHADER_TMP) >> $(@)
-$(SILENT) $(SHADERC) --type $(1) --platform ios -p metal -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_mtl
-@cat $(SHADER_TMP) >> $(@)
-@echo extern const uint8_t* $(basename $(<))_pssl;>> $(@)
-@echo extern const uint32_t $(basename $(<))_pssl_size;>> $(@)
endef
vs_debugfont.bin.h : vs_debugfont.sc
$(call shader-embedded, v, vs_3_0, vs_4_0)
fs_debugfont.bin.h : fs_debugfont.sc
$(call shader-embedded, f, ps_3_0, ps_4_0)
vs_clear.bin.h : vs_clear.sc
$(call shader-embedded, v, vs_3_0, vs_4_0)
fs_clear0.bin.h : fs_clear0.sc
$(call shader-embedded, f, ps_3_0, ps_4_0)
fs_clear1.bin.h : fs_clear1.sc
$(call shader-embedded, f, ps_3_0, ps_4_0)
fs_clear2.bin.h : fs_clear2.sc
$(call shader-embedded, f, ps_3_0, ps_4_0)
fs_clear3.bin.h : fs_clear3.sc
$(call shader-embedded, f, ps_3_0, ps_4_0)
fs_clear4.bin.h : fs_clear4.sc
$(call shader-embedded, f, ps_3_0, ps_4_0)
fs_clear5.bin.h : fs_clear5.sc
$(call shader-embedded, f, ps_3_0, ps_4_0)
fs_clear6.bin.h : fs_clear6.sc
$(call shader-embedded, f, ps_3_0, ps_4_0)
fs_clear7.bin.h : fs_clear7.sc
$(call shader-embedded, f, ps_3_0, ps_4_0)
.PHONY: clean
clean:
@echo Cleaning...
@-rm -vf $(BIN)
.PHONY: rebuild
rebuild: clean all