diff --git a/include/bgfx/embedded_shader.h b/include/bgfx/embedded_shader.h index db80f936d..c12a7f8a9 100644 --- a/include/bgfx/embedded_shader.h +++ b/include/bgfx/embedded_shader.h @@ -75,7 +75,7 @@ #if BGFX_PLATFORM_SUPPORTS_PSSL # undef BGFX_EMBEDDED_SHADER_PSSL # define BGFX_EMBEDDED_SHADER_PSSL(_renderer, _name) \ - { _renderer, BGFX_EMBEDDED_SHADER_CONCATENATE(_name, _pssl), BGFX_EMBEDDED_SHADER_COUNTOF(BGFX_EMBEDDED_SHADER_CONCATENATE(_name, _pssl_size) ) }, + { _renderer, BGFX_EMBEDDED_SHADER_CONCATENATE(_name, _pssl), BGFX_EMBEDDED_SHADER_COUNTOF(BGFX_EMBEDDED_SHADER_CONCATENATE(_name, _pssl) ) }, #endif // BGFX_PLATFORM_SUPPORTS_PSSL #if BGFX_PLATFORM_SUPPORTS_ESSL diff --git a/scripts/shader-embeded.mk b/scripts/shader-embeded.mk index e058be3ec..11c7cc6eb 100644 --- a/scripts/shader-embeded.mk +++ b/scripts/shader-embeded.mk @@ -34,8 +34,7 @@ vs_%.bin.h : vs_%.sc -@cat "$(SHADER_TMP)" >> $(@) -$(SILENT) $(SHADERC) $(VS_FLAGS) --platform ios -p metal -O 3 -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_mtl -@cat "$(SHADER_TMP)" >> $(@) - -@printf "extern const uint8_t* $(basename $(<))_pssl;\n" | tr -d '\015' >> $(@) - -@printf "extern const uint32_t $(basename $(<))_pssl_size;\n" | tr -d '\015' >> $(@) + -@printf "static const uint8_t $(basename $(<))_pssl[1] = {0};\n" | tr -d '\015' >> $(@) fs_%.bin.h : fs_%.sc @echo [$(<)] @@ -49,8 +48,7 @@ fs_%.bin.h : fs_%.sc -@cat "$(SHADER_TMP)" >> $(@) -$(SILENT) $(SHADERC) $(FS_FLAGS) --platform ios -p metal -O 3 -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_mtl -@cat "$(SHADER_TMP)" >> $(@) - -@printf "extern const uint8_t* $(basename $(<))_pssl;\n" | tr -d '\015' >> $(@) - -@printf "extern const uint32_t $(basename $(<))_pssl_size;\n" | tr -d '\015' >> $(@) + -@printf "static const uint8_t $(basename $(<))_pssl[1] = {0};\n" | tr -d '\015' >> $(@) cs_%.bin.h : cs_%.sc @echo [$(<)] @@ -62,8 +60,7 @@ cs_%.bin.h : cs_%.sc -@cat "$(SHADER_TMP)" >> $(@) -$(SILENT) $(SHADERC) $(CS_FLAGS) --platform windows -p s_5_0 -O 1 -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_dx11 -@cat "$(SHADER_TMP)" >> $(@) - -@printf "extern const uint8_t* $(basename $(<))_pssl;\n" | tr -d '\015' >> $(@) - -@printf "extern const uint32_t $(basename $(<))_pssl_size;\n" | tr -d '\015' >> $(@) + -@printf "static const uint8_t $(basename $(<))_pssl[1] = {0};\n" | tr -d '\015' >> $(@) .PHONY: all all: $(BIN) diff --git a/src/bgfx_shader.sh b/src/bgfx_shader.sh index 3fe839a6d..5fb96d9eb 100644 --- a/src/bgfx_shader.sh +++ b/src/bgfx_shader.sh @@ -52,7 +52,7 @@ // To be able to patch the uav registers on the DXBC SPDB Chunk (D3D11 renderer) the whitespaces around // '_type[_reg]' are necessary. This only affects shaders with debug info (i.e., those that have the SPDB Chunk). -# if BGFX_SHADER_LANGUAGE_HLSL > 400 || BGFX_SHADER_LANGUAGE_PSSL || BGFX_SHADER_LANGUAGE_SPIRV || BGFX_SHADER_LANGUAGE_METAL +# if BGFX_SHADER_LANGUAGE_HLSL > 400 || BGFX_SHADER_LANGUAGE_SPIRV || BGFX_SHADER_LANGUAGE_METAL # define REGISTER(_type, _reg) register( _type[_reg] ) # else # define REGISTER(_type, _reg) register(_type ## _reg) diff --git a/src/fs_clear0.bin.h b/src/fs_clear0.bin.h index 3c05f2efc..ead7c9b23 100644 --- a/src/fs_clear0.bin.h +++ b/src/fs_clear0.bin.h @@ -118,5 +118,4 @@ static const uint8_t fs_clear0_mtl[424] = 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, // . return out; 0x0a, 0x7d, 0x0a, 0x0a, 0x00, 0x00, 0x10, 0x00, // .}...... }; -extern const uint8_t* fs_clear0_pssl; -extern const uint32_t fs_clear0_pssl_size; +static const uint8_t fs_clear0_pssl[1] = {0}; diff --git a/src/fs_clear1.bin.h b/src/fs_clear1.bin.h index 24dc08043..056d1cb11 100644 --- a/src/fs_clear1.bin.h +++ b/src/fs_clear1.bin.h @@ -142,5 +142,4 @@ static const uint8_t fs_clear1_mtl[517] = 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, // return out;.}. 0x0a, 0x00, 0x00, 0x20, 0x00, // ... . }; -extern const uint8_t* fs_clear1_pssl; -extern const uint32_t fs_clear1_pssl_size; +static const uint8_t fs_clear1_pssl[1] = {0}; diff --git a/src/fs_clear2.bin.h b/src/fs_clear2.bin.h index bf2f60462..4a756996e 100644 --- a/src/fs_clear2.bin.h +++ b/src/fs_clear2.bin.h @@ -164,5 +164,4 @@ static const uint8_t fs_clear2_mtl[610] = 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, 0x00, // eturn out;.}.... 0x30, 0x00, // 0. }; -extern const uint8_t* fs_clear2_pssl; -extern const uint32_t fs_clear2_pssl_size; +static const uint8_t fs_clear2_pssl[1] = {0}; diff --git a/src/fs_clear3.bin.h b/src/fs_clear3.bin.h index ae4382689..281b1ec54 100644 --- a/src/fs_clear3.bin.h +++ b/src/fs_clear3.bin.h @@ -187,5 +187,4 @@ static const uint8_t fs_clear3_mtl[703] = 0x6c, 0x6f, 0x72, 0x5b, 0x33, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, // lor[3];. retu 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, 0x00, 0x40, 0x00, // rn out;.}....@. }; -extern const uint8_t* fs_clear3_pssl; -extern const uint32_t fs_clear3_pssl_size; +static const uint8_t fs_clear3_pssl[1] = {0}; diff --git a/src/fs_clear4.bin.h b/src/fs_clear4.bin.h index 820efe05e..a79f48912 100644 --- a/src/fs_clear4.bin.h +++ b/src/fs_clear4.bin.h @@ -208,5 +208,4 @@ static const uint8_t fs_clear4_mtl[796] = 0x5b, 0x34, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, // [4];. return 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, 0x00, 0x50, 0x00, // out;.}....P. }; -extern const uint8_t* fs_clear4_pssl; -extern const uint32_t fs_clear4_pssl_size; +static const uint8_t fs_clear4_pssl[1] = {0}; diff --git a/src/fs_clear5.bin.h b/src/fs_clear5.bin.h index e1a3c72b2..c7f43046e 100644 --- a/src/fs_clear5.bin.h +++ b/src/fs_clear5.bin.h @@ -232,5 +232,4 @@ static const uint8_t fs_clear5_mtl[889] = 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, // ;. return out 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, 0x00, 0x60, 0x00, // ;.}....`. }; -extern const uint8_t* fs_clear5_pssl; -extern const uint32_t fs_clear5_pssl_size; +static const uint8_t fs_clear5_pssl[1] = {0}; diff --git a/src/fs_clear6.bin.h b/src/fs_clear6.bin.h index 8f29ba451..28e7f12c4 100644 --- a/src/fs_clear6.bin.h +++ b/src/fs_clear6.bin.h @@ -254,5 +254,4 @@ static const uint8_t fs_clear6_mtl[982] = 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, // return out;.} 0x0a, 0x0a, 0x00, 0x00, 0x70, 0x00, // ....p. }; -extern const uint8_t* fs_clear6_pssl; -extern const uint32_t fs_clear6_pssl_size; +static const uint8_t fs_clear6_pssl[1] = {0}; diff --git a/src/fs_clear7.bin.h b/src/fs_clear7.bin.h index a88a1b83b..4023202d3 100644 --- a/src/fs_clear7.bin.h +++ b/src/fs_clear7.bin.h @@ -278,5 +278,4 @@ static const uint8_t fs_clear7_mtl[1075] = 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // return out;.}... 0x00, 0x80, 0x00, // ... }; -extern const uint8_t* fs_clear7_pssl; -extern const uint32_t fs_clear7_pssl_size; +static const uint8_t fs_clear7_pssl[1] = {0}; diff --git a/src/fs_debugfont.bin.h b/src/fs_debugfont.bin.h index b39bfeb6a..501183551 100644 --- a/src/fs_debugfont.bin.h +++ b/src/fs_debugfont.bin.h @@ -215,5 +215,4 @@ static const uint8_t fs_debugfont_mtl[843] = 0x39, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, // 96;. return o 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, 0x00, 0x20, 0x00, // ut;.}.... . }; -extern const uint8_t* fs_debugfont_pssl; -extern const uint32_t fs_debugfont_pssl_size; +static const uint8_t fs_debugfont_pssl[1] = {0}; diff --git a/src/makefile b/src/makefile index 8257fcd62..5fbe018c2 100644 --- a/src/makefile +++ b/src/makefile @@ -35,8 +35,7 @@ define shader-embedded -@cat "$(SHADER_TMP)" >> $(@) -$(SILENT) $(SHADERC) --type $(1) --platform ios -p metal -O 3 -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_mtl -@cat "$(SHADER_TMP)" >> $(@) - -@printf "extern const uint8_t* $(basename $(<))_pssl;\n" | tr -d '\015' >> $(@) - -@printf "extern const uint32_t $(basename $(<))_pssl_size;\n" | tr -d '\015' >> $(@) + -@printf "static const uint8_t $(basename $(<))_pssl[1] = {0};\n" | tr -d '\015' >> $(@) endef vs_debugfont.bin.h : vs_debugfont.sc diff --git a/src/vs_clear.bin.h b/src/vs_clear.bin.h index 38a7151d3..1d4f5742f 100644 --- a/src/vs_clear.bin.h +++ b/src/vs_clear.bin.h @@ -158,5 +158,4 @@ static const uint8_t vs_clear_mtl[593] = 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, 0x01, 0x01, 0x00, 0x10, // rn out;.}....... 0x00, // . }; -extern const uint8_t* vs_clear_pssl; -extern const uint32_t vs_clear_pssl_size; +static const uint8_t vs_clear_pssl[1] = {0}; diff --git a/src/vs_debugfont.bin.h b/src/vs_debugfont.bin.h index 08510cd66..560d90f08 100644 --- a/src/vs_debugfont.bin.h +++ b/src/vs_debugfont.bin.h @@ -275,5 +275,4 @@ static const uint8_t vs_debugfont_mtl[1035] = 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // return out;.}... 0x04, 0x05, 0x00, 0x06, 0x00, 0x01, 0x00, 0x10, 0x00, 0x40, 0x00, // .........@. }; -extern const uint8_t* vs_debugfont_pssl; -extern const uint32_t vs_debugfont_pssl_size; +static const uint8_t vs_debugfont_pssl[1] = {0};