Branimir Karadžić 9 years ago
parent
commit
96c8ac71ff
2 changed files with 12 additions and 2 deletions
  1. 11 1
      scripts/shader-embeded.mk
  2. 1 1
      src/shader_spirv.cpp

+ 11 - 1
scripts/shader-embeded.mk

@@ -8,14 +8,17 @@ include $(THISDIR)/tools.mk
 
 VS_FLAGS+=-i $(THISDIR)../src/ --type vertex
 FS_FLAGS+=-i $(THISDIR)../src/ --type fragment
+CS_FLAGS+=-i $(THISDIR)../src/ --type compute
 
 VS_SOURCES=$(wildcard vs_*.sc)
 FS_SOURCES=$(wildcard fs_*.sc)
+CS_SOURCES=$(wildcard cs_*.sc)
 
 VS_BIN = $(addsuffix .bin.h, $(basename $(VS_SOURCES)))
 FS_BIN = $(addsuffix .bin.h, $(basename $(FS_SOURCES)))
+CS_BIN = $(addsuffix .bin.h, $(basename $(CS_SOURCES)))
 
-BIN = $(VS_BIN) $(FS_BIN)
+BIN = $(VS_BIN) $(FS_BIN) $(CS_BIN)
 
 SHADER_TMP = $(TEMP)/tmp
 
@@ -41,6 +44,13 @@ fs_%.bin.h : fs_%.sc
 	-$(SILENT) $(SHADERC) $(FS_FLAGS) --platform ios     -p metal  -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_mtl
 	-@cat $(SHADER_TMP) >> $(@)
 
+cs_%.bin.h : cs_%.sc
+	@echo [$(<)]
+	$(SILENT) $(SHADERC) $(CS_FLAGS) --platform linux                  -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl
+	@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) >> $(@)
+
 .PHONY: all
 all: $(BIN)
 

+ 1 - 1
src/shader_spirv.cpp

@@ -781,7 +781,7 @@ namespace bgfx
 			size += read(_reader, _instruction.result, _err);
 		}
 
-		uint32_t currOp = 0;
+		uint16_t currOp = 0;
 		switch (_instruction.opcode)
 		{
 		case SpvOpcode::EntryPoint: