Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal changes to update pssl support. #3355

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/bgfx/embedded_shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 3 additions & 6 deletions scripts/shader-embeded.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 [$(<)]
Expand All @@ -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 [$(<)]
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/bgfx_shader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions src/fs_clear0.bin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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};
3 changes: 1 addition & 2 deletions src/fs_clear1.bin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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};
3 changes: 1 addition & 2 deletions src/fs_clear2.bin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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};
3 changes: 1 addition & 2 deletions src/fs_clear3.bin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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};
3 changes: 1 addition & 2 deletions src/fs_clear4.bin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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};
3 changes: 1 addition & 2 deletions src/fs_clear5.bin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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};
3 changes: 1 addition & 2 deletions src/fs_clear6.bin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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};
3 changes: 1 addition & 2 deletions src/fs_clear7.bin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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};
3 changes: 1 addition & 2 deletions src/fs_debugfont.bin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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};
3 changes: 1 addition & 2 deletions src/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/vs_clear.bin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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};
3 changes: 1 addition & 2 deletions src/vs_debugfont.bin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Loading