Add a step to fix generated shader code

This commit is contained in:
Sam Lantinga 2024-09-06 09:09:01 -07:00
parent 104642ffe7
commit 1381cc8554
26 changed files with 43 additions and 36 deletions

View File

@ -83,3 +83,4 @@ for i in *.vert *.frag; do
make-header "$metal"
echo "#include \"$metal.h\"" >> "$metal_bundle"
done
./fix-shaders.sh

View File

@ -1,4 +1,4 @@
const unsigned char color_frag_metal[] = {
static const unsigned char color_frag_metal[] = {
0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x6d, 0x65,
0x74, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x3e, 0x0a,
0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x73, 0x69,
@ -25,4 +25,4 @@ const unsigned char color_frag_metal[] = {
0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72,
0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a
};
const unsigned int color_frag_metal_len = 298;
static const unsigned int color_frag_metal_len = 298;

View File

@ -1,4 +1,4 @@
const signed char color_frag_sm50_dxbc[] =
static const signed char color_frag_sm50_dxbc[] =
{
68, 88, 66, 67, 114,-117,
-124, 82, -97, 76, -66, -74,

View File

@ -100,7 +100,7 @@ attributes #1 = { nounwind }
#endif
const unsigned char color_frag_sm60_dxil[] = {
static const unsigned char color_frag_sm60_dxil[] = {
0x44, 0x58, 0x42, 0x43, 0x33, 0x91, 0x9f, 0xec, 0x78, 0x7d, 0xbb, 0xfa,
0xeb, 0x8d, 0xfb, 0x1b, 0x79, 0x47, 0x1d, 0xb2, 0x01, 0x00, 0x00, 0x00,
0x0c, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,

View File

@ -1,4 +1,4 @@
const unsigned char color_frag_spv[] = {
static const unsigned char color_frag_spv[] = {
0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0b, 0x00, 0x08, 0x00,
0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00,
@ -26,4 +26,4 @@ const unsigned char color_frag_spv[] = {
0x0b, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x09, 0x00, 0x00, 0x00,
0x0c, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00
};
const unsigned int color_frag_spv_len = 312;
static const unsigned int color_frag_spv_len = 312;

View File

@ -0,0 +1,6 @@
#!/bin/sh
#
# Update generated shader code to fix compiler warnings
sed -i '' 's,^const,static const,' *.h
sed -i '' 's,const unsigned,const signed,' *.dxbc.h

View File

@ -1,4 +1,4 @@
const unsigned char linepoint_vert_metal[] = {
static const unsigned char linepoint_vert_metal[] = {
0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x6d, 0x65,
0x74, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x3e, 0x0a,
0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x73, 0x69,
@ -48,4 +48,4 @@ const unsigned char linepoint_vert_metal[] = {
0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a,
0x0a
};
const unsigned int linepoint_vert_metal_len = 565;
static const unsigned int linepoint_vert_metal_len = 565;

View File

@ -1,4 +1,4 @@
const signed char linepoint_vert_sm50_dxbc[] =
static const signed char linepoint_vert_sm50_dxbc[] =
{
68, 88, 66, 67, 0, 119,
101, -18, 103, 113, 34, 52,

View File

@ -171,7 +171,7 @@ attributes #2 = { nounwind readonly }
#endif
const unsigned char linepoint_vert_sm60_dxil[] = {
static const unsigned char linepoint_vert_sm60_dxil[] = {
0x44, 0x58, 0x42, 0x43, 0x07, 0x97, 0x68, 0xde, 0x5f, 0x50, 0x0b, 0x5d,
0x22, 0x1b, 0xe5, 0xb4, 0xe8, 0xdb, 0x02, 0xea, 0x01, 0x00, 0x00, 0x00,
0x04, 0x0f, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,

View File

@ -1,4 +1,4 @@
const unsigned char linepoint_vert_spv[] = {
static const unsigned char linepoint_vert_spv[] = {
0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0b, 0x00, 0x08, 0x00,
0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00,
@ -90,4 +90,4 @@ const unsigned char linepoint_vert_spv[] = {
0x3e, 0x00, 0x03, 0x00, 0x26, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00,
0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00
};
const unsigned int linepoint_vert_spv_len = 1076;
static const unsigned int linepoint_vert_spv_len = 1076;

View File

@ -1,4 +1,4 @@
const unsigned char texture_rgb_frag_metal[] = {
static const unsigned char texture_rgb_frag_metal[] = {
0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x6d, 0x65,
0x74, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x3e, 0x0a,
0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x73, 0x69,
@ -38,4 +38,4 @@ const unsigned char texture_rgb_frag_metal[] = {
0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75,
0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a
};
const unsigned int texture_rgb_frag_metal_len = 450;
static const unsigned int texture_rgb_frag_metal_len = 450;

View File

@ -1,4 +1,4 @@
const signed char texture_rgb_frag_sm50_dxbc[] =
static const signed char texture_rgb_frag_sm50_dxbc[] =
{
68, 88, 66, 67, -22, -54,
-48, 73, -47, -40, -92, -21,

View File

@ -138,7 +138,7 @@ attributes #2 = { nounwind readonly }
#endif
const unsigned char texture_rgb_frag_sm60_dxil[] = {
static const unsigned char texture_rgb_frag_sm60_dxil[] = {
0x44, 0x58, 0x42, 0x43, 0x80, 0x0c, 0x49, 0xdc, 0x1e, 0x21, 0x6f, 0xab,
0x8e, 0x0c, 0x74, 0xde, 0x47, 0xb3, 0x50, 0xf3, 0x01, 0x00, 0x00, 0x00,
0x1c, 0x0f, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,

View File

@ -1,4 +1,4 @@
const unsigned char texture_rgb_frag_spv[] = {
static const unsigned char texture_rgb_frag_spv[] = {
0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0b, 0x00, 0x08, 0x00,
0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00,
@ -56,4 +56,4 @@ const unsigned char texture_rgb_frag_spv[] = {
0x3e, 0x00, 0x03, 0x00, 0x09, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00,
0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00
};
const unsigned int texture_rgb_frag_spv_len = 668;
static const unsigned int texture_rgb_frag_spv_len = 668;

View File

@ -1,4 +1,4 @@
const unsigned char texture_rgba_frag_metal[] = {
static const unsigned char texture_rgba_frag_metal[] = {
0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x6d, 0x65,
0x74, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x3e, 0x0a,
0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x73, 0x69,
@ -37,4 +37,4 @@ const unsigned char texture_rgba_frag_metal[] = {
0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a,
0x0a
};
const unsigned int texture_rgba_frag_metal_len = 433;
static const unsigned int texture_rgba_frag_metal_len = 433;

View File

@ -1,4 +1,4 @@
const signed char texture_rgba_frag_sm50_dxbc[] =
static const signed char texture_rgba_frag_sm50_dxbc[] =
{
68, 88, 66, 67, -83, 124,
-3, -84,-102, 126, 29, -62,

View File

@ -140,7 +140,7 @@ attributes #2 = { nounwind readonly }
#endif
const unsigned char texture_rgba_frag_sm60_dxil[] = {
static const unsigned char texture_rgba_frag_sm60_dxil[] = {
0x44, 0x58, 0x42, 0x43, 0x5c, 0x82, 0x6d, 0x45, 0x43, 0x35, 0xdf, 0xf5,
0xad, 0xf7, 0x1b, 0x5e, 0xc0, 0x65, 0x38, 0x3f, 0x01, 0x00, 0x00, 0x00,
0x24, 0x0f, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,

View File

@ -1,4 +1,4 @@
const unsigned char texture_rgba_frag_spv[] = {
static const unsigned char texture_rgba_frag_spv[] = {
0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0b, 0x00, 0x08, 0x00,
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00,
@ -47,4 +47,4 @@ const unsigned char texture_rgba_frag_spv[] = {
0x16, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x09, 0x00, 0x00, 0x00,
0x17, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00
};
const unsigned int texture_rgba_frag_spv_len = 564;
static const unsigned int texture_rgba_frag_spv_len = 564;

View File

@ -1,4 +1,4 @@
const unsigned char tri_color_vert_metal[] = {
static const unsigned char tri_color_vert_metal[] = {
0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x6d, 0x65,
0x74, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x3e, 0x0a,
0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x73, 0x69,
@ -45,4 +45,4 @@ const unsigned char tri_color_vert_metal[] = {
0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b,
0x0a, 0x7d, 0x0a, 0x0a
};
const unsigned int tri_color_vert_metal_len = 532;
static const unsigned int tri_color_vert_metal_len = 532;

View File

@ -1,4 +1,4 @@
const signed char tri_color_vert_sm50_dxbc[] =
static const signed char tri_color_vert_sm50_dxbc[] =
{
68, 88, 66, 67, -99, -1,
-83, -50, 75, -96, -1, 28,

View File

@ -178,7 +178,7 @@ attributes #2 = { nounwind readonly }
#endif
const unsigned char tri_color_vert_sm60_dxil[] = {
static const unsigned char tri_color_vert_sm60_dxil[] = {
0x44, 0x58, 0x42, 0x43, 0xeb, 0x11, 0xa0, 0x76, 0xea, 0x69, 0xbc, 0x28,
0xcd, 0xbc, 0x0c, 0xab, 0x14, 0x5d, 0xfa, 0x53, 0x01, 0x00, 0x00, 0x00,
0x98, 0x0f, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,

View File

@ -1,4 +1,4 @@
const unsigned char tri_color_vert_spv[] = {
static const unsigned char tri_color_vert_spv[] = {
0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0b, 0x00, 0x08, 0x00,
0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00,
@ -86,4 +86,4 @@ const unsigned char tri_color_vert_spv[] = {
0x3e, 0x00, 0x03, 0x00, 0x23, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00,
0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00
};
const unsigned int tri_color_vert_spv_len = 1028;
static const unsigned int tri_color_vert_spv_len = 1028;

View File

@ -1,4 +1,4 @@
const unsigned char tri_texture_vert_metal[] = {
static const unsigned char tri_texture_vert_metal[] = {
0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x6d, 0x65,
0x74, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x3e, 0x0a,
0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x73, 0x69,
@ -53,4 +53,4 @@ const unsigned char tri_texture_vert_metal[] = {
0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e,
0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a
};
const unsigned int tri_texture_vert_metal_len = 633;
static const unsigned int tri_texture_vert_metal_len = 633;

View File

@ -1,4 +1,4 @@
const signed char tri_texture_vert_sm50_dxbc[] =
static const signed char tri_texture_vert_sm50_dxbc[] =
{
68, 88, 66, 67, 108, 113,
-108, 81, -2, 27, 41, 94,

View File

@ -196,7 +196,7 @@ attributes #2 = { nounwind readonly }
#endif
const unsigned char tri_texture_vert_sm60_dxil[] = {
static const unsigned char tri_texture_vert_sm60_dxil[] = {
0x44, 0x58, 0x42, 0x43, 0x1d, 0x39, 0x3a, 0xc6, 0x32, 0xb6, 0x8e, 0x58,
0x41, 0xa6, 0x3b, 0x02, 0xc5, 0x3c, 0xcc, 0x94, 0x01, 0x00, 0x00, 0x00,
0xc8, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,

View File

@ -1,4 +1,4 @@
const unsigned char tri_texture_vert_spv[] = {
static const unsigned char tri_texture_vert_spv[] = {
0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0b, 0x00, 0x08, 0x00,
0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00,
@ -103,4 +103,4 @@ const unsigned char tri_texture_vert_spv[] = {
0x3e, 0x00, 0x03, 0x00, 0x28, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00,
0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00
};
const unsigned int tri_texture_vert_spv_len = 1232;
static const unsigned int tri_texture_vert_spv_len = 1232;