Minimal changes to update pssl support.

- Fix a line in bgfx_shader.sh (tested locally).
- Update the shader embedding macro to match the other macros.
- Update embedded shader generating make rules to output the same style for PSSL as the other rules (but empty arrays).

Some of the changes are not well tested as I'm having trouble (re-)generating all shaders in my dev environment.
This commit is contained in:
Daniel Kalmar 2024-09-30 22:32:29 +02:00 committed by Daniel Kalmar
parent f8b20616de
commit d71a46e1a0
15 changed files with 17 additions and 32 deletions

View File

@ -75,7 +75,7 @@
#if BGFX_PLATFORM_SUPPORTS_PSSL #if BGFX_PLATFORM_SUPPORTS_PSSL
# undef BGFX_EMBEDDED_SHADER_PSSL # undef BGFX_EMBEDDED_SHADER_PSSL
# define BGFX_EMBEDDED_SHADER_PSSL(_renderer, _name) \ # 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 #endif // BGFX_PLATFORM_SUPPORTS_PSSL
#if BGFX_PLATFORM_SUPPORTS_ESSL #if BGFX_PLATFORM_SUPPORTS_ESSL

View File

@ -34,8 +34,7 @@ vs_%.bin.h : vs_%.sc
-@cat "$(SHADER_TMP)" >> $(@) -@cat "$(SHADER_TMP)" >> $(@)
-$(SILENT) $(SHADERC) $(VS_FLAGS) --platform ios -p metal -O 3 -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_mtl -$(SILENT) $(SHADERC) $(VS_FLAGS) --platform ios -p metal -O 3 -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_mtl
-@cat "$(SHADER_TMP)" >> $(@) -@cat "$(SHADER_TMP)" >> $(@)
-@printf "extern const uint8_t* $(basename $(<))_pssl;\n" | tr -d '\015' >> $(@) -@printf "static const uint8_t $(basename $(<))_pssl[1] = {0};\n" | tr -d '\015' >> $(@)
-@printf "extern const uint32_t $(basename $(<))_pssl_size;\n" | tr -d '\015' >> $(@)
fs_%.bin.h : fs_%.sc fs_%.bin.h : fs_%.sc
@echo [$(<)] @echo [$(<)]
@ -49,8 +48,7 @@ fs_%.bin.h : fs_%.sc
-@cat "$(SHADER_TMP)" >> $(@) -@cat "$(SHADER_TMP)" >> $(@)
-$(SILENT) $(SHADERC) $(FS_FLAGS) --platform ios -p metal -O 3 -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_mtl -$(SILENT) $(SHADERC) $(FS_FLAGS) --platform ios -p metal -O 3 -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_mtl
-@cat "$(SHADER_TMP)" >> $(@) -@cat "$(SHADER_TMP)" >> $(@)
-@printf "extern const uint8_t* $(basename $(<))_pssl;\n" | tr -d '\015' >> $(@) -@printf "static const uint8_t $(basename $(<))_pssl[1] = {0};\n" | tr -d '\015' >> $(@)
-@printf "extern const uint32_t $(basename $(<))_pssl_size;\n" | tr -d '\015' >> $(@)
cs_%.bin.h : cs_%.sc cs_%.bin.h : cs_%.sc
@echo [$(<)] @echo [$(<)]
@ -62,8 +60,7 @@ cs_%.bin.h : cs_%.sc
-@cat "$(SHADER_TMP)" >> $(@) -@cat "$(SHADER_TMP)" >> $(@)
-$(SILENT) $(SHADERC) $(CS_FLAGS) --platform windows -p s_5_0 -O 1 -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_dx11 -$(SILENT) $(SHADERC) $(CS_FLAGS) --platform windows -p s_5_0 -O 1 -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_dx11
-@cat "$(SHADER_TMP)" >> $(@) -@cat "$(SHADER_TMP)" >> $(@)
-@printf "extern const uint8_t* $(basename $(<))_pssl;\n" | tr -d '\015' >> $(@) -@printf "static const uint8_t $(basename $(<))_pssl[1] = {0};\n" | tr -d '\015' >> $(@)
-@printf "extern const uint32_t $(basename $(<))_pssl_size;\n" | tr -d '\015' >> $(@)
.PHONY: all .PHONY: all
all: $(BIN) all: $(BIN)

View File

@ -52,7 +52,7 @@
// To be able to patch the uav registers on the DXBC SPDB Chunk (D3D11 renderer) the whitespaces around // 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). // '_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] ) # define REGISTER(_type, _reg) register( _type[_reg] )
# else # else
# define REGISTER(_type, _reg) register(_type ## _reg) # define REGISTER(_type, _reg) register(_type ## _reg)

View File

@ -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, 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, // .}...... 0x0a, 0x7d, 0x0a, 0x0a, 0x00, 0x00, 0x10, 0x00, // .}......
}; };
extern const uint8_t* fs_clear0_pssl; static const uint8_t fs_clear0_pssl[1] = {0};
extern const uint32_t fs_clear0_pssl_size;

View File

@ -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;.}. 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, // return out;.}.
0x0a, 0x00, 0x00, 0x20, 0x00, // ... . 0x0a, 0x00, 0x00, 0x20, 0x00, // ... .
}; };
extern const uint8_t* fs_clear1_pssl; static const uint8_t fs_clear1_pssl[1] = {0};
extern const uint32_t fs_clear1_pssl_size;

View File

@ -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;.}.... 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, 0x00, // eturn out;.}....
0x30, 0x00, // 0. 0x30, 0x00, // 0.
}; };
extern const uint8_t* fs_clear2_pssl; static const uint8_t fs_clear2_pssl[1] = {0};
extern const uint32_t fs_clear2_pssl_size;

View File

@ -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 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;.}....@. 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, 0x00, 0x40, 0x00, // rn out;.}....@.
}; };
extern const uint8_t* fs_clear3_pssl; static const uint8_t fs_clear3_pssl[1] = {0};
extern const uint32_t fs_clear3_pssl_size;

View File

@ -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 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. 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, 0x00, 0x50, 0x00, // out;.}....P.
}; };
extern const uint8_t* fs_clear4_pssl; static const uint8_t fs_clear4_pssl[1] = {0};
extern const uint32_t fs_clear4_pssl_size;

View File

@ -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, 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, // ;.}....`. 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, 0x00, 0x60, 0x00, // ;.}....`.
}; };
extern const uint8_t* fs_clear5_pssl; static const uint8_t fs_clear5_pssl[1] = {0};
extern const uint32_t fs_clear5_pssl_size;

View File

@ -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;.} 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. 0x0a, 0x0a, 0x00, 0x00, 0x70, 0x00, // ....p.
}; };
extern const uint8_t* fs_clear6_pssl; static const uint8_t fs_clear6_pssl[1] = {0};
extern const uint32_t fs_clear6_pssl_size;

View File

@ -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;.}... 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // return out;.}...
0x00, 0x80, 0x00, // ... 0x00, 0x80, 0x00, // ...
}; };
extern const uint8_t* fs_clear7_pssl; static const uint8_t fs_clear7_pssl[1] = {0};
extern const uint32_t fs_clear7_pssl_size;

View File

@ -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 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;.}.... . 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, 0x00, 0x20, 0x00, // ut;.}.... .
}; };
extern const uint8_t* fs_debugfont_pssl; static const uint8_t fs_debugfont_pssl[1] = {0};
extern const uint32_t fs_debugfont_pssl_size;

View File

@ -35,8 +35,7 @@ define shader-embedded
-@cat "$(SHADER_TMP)" >> $(@) -@cat "$(SHADER_TMP)" >> $(@)
-$(SILENT) $(SHADERC) --type $(1) --platform ios -p metal -O 3 -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_mtl -$(SILENT) $(SHADERC) --type $(1) --platform ios -p metal -O 3 -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_mtl
-@cat "$(SHADER_TMP)" >> $(@) -@cat "$(SHADER_TMP)" >> $(@)
-@printf "extern const uint8_t* $(basename $(<))_pssl;\n" | tr -d '\015' >> $(@) -@printf "static const uint8_t $(basename $(<))_pssl[1] = {0};\n" | tr -d '\015' >> $(@)
-@printf "extern const uint32_t $(basename $(<))_pssl_size;\n" | tr -d '\015' >> $(@)
endef endef
vs_debugfont.bin.h : vs_debugfont.sc vs_debugfont.bin.h : vs_debugfont.sc

View File

@ -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;.}....... 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, 0x01, 0x01, 0x00, 0x10, // rn out;.}.......
0x00, // . 0x00, // .
}; };
extern const uint8_t* vs_clear_pssl; static const uint8_t vs_clear_pssl[1] = {0};
extern const uint32_t vs_clear_pssl_size;

View File

@ -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;.}... 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, // .........@. 0x04, 0x05, 0x00, 0x06, 0x00, 0x01, 0x00, 0x10, 0x00, 0x40, 0x00, // .........@.
}; };
extern const uint8_t* vs_debugfont_pssl; static const uint8_t vs_debugfont_pssl[1] = {0};
extern const uint32_t vs_debugfont_pssl_size;