Browse Source

Add a step to fix generated shader code

Sam Lantinga 7 months ago
parent
commit
1381cc8554
26 changed files with 43 additions and 36 deletions
  1. 1 0
      src/render/sdlgpu/shaders/build-shaders.sh
  2. 2 2
      src/render/sdlgpu/shaders/color.frag.metal.h
  3. 1 1
      src/render/sdlgpu/shaders/color.frag.sm50.dxbc.h
  4. 1 1
      src/render/sdlgpu/shaders/color.frag.sm60.dxil.h
  5. 2 2
      src/render/sdlgpu/shaders/color.frag.spv.h
  6. 6 0
      src/render/sdlgpu/shaders/fix-shaders.sh
  7. 2 2
      src/render/sdlgpu/shaders/linepoint.vert.metal.h
  8. 1 1
      src/render/sdlgpu/shaders/linepoint.vert.sm50.dxbc.h
  9. 1 1
      src/render/sdlgpu/shaders/linepoint.vert.sm60.dxil.h
  10. 2 2
      src/render/sdlgpu/shaders/linepoint.vert.spv.h
  11. 2 2
      src/render/sdlgpu/shaders/texture_rgb.frag.metal.h
  12. 1 1
      src/render/sdlgpu/shaders/texture_rgb.frag.sm50.dxbc.h
  13. 1 1
      src/render/sdlgpu/shaders/texture_rgb.frag.sm60.dxil.h
  14. 2 2
      src/render/sdlgpu/shaders/texture_rgb.frag.spv.h
  15. 2 2
      src/render/sdlgpu/shaders/texture_rgba.frag.metal.h
  16. 1 1
      src/render/sdlgpu/shaders/texture_rgba.frag.sm50.dxbc.h
  17. 1 1
      src/render/sdlgpu/shaders/texture_rgba.frag.sm60.dxil.h
  18. 2 2
      src/render/sdlgpu/shaders/texture_rgba.frag.spv.h
  19. 2 2
      src/render/sdlgpu/shaders/tri_color.vert.metal.h
  20. 1 1
      src/render/sdlgpu/shaders/tri_color.vert.sm50.dxbc.h
  21. 1 1
      src/render/sdlgpu/shaders/tri_color.vert.sm60.dxil.h
  22. 2 2
      src/render/sdlgpu/shaders/tri_color.vert.spv.h
  23. 2 2
      src/render/sdlgpu/shaders/tri_texture.vert.metal.h
  24. 1 1
      src/render/sdlgpu/shaders/tri_texture.vert.sm50.dxbc.h
  25. 1 1
      src/render/sdlgpu/shaders/tri_texture.vert.sm60.dxil.h
  26. 2 2
      src/render/sdlgpu/shaders/tri_texture.vert.spv.h

+ 1 - 0
src/render/sdlgpu/shaders/build-shaders.sh

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

+ 2 - 2
src/render/sdlgpu/shaders/color.frag.metal.h

@@ -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;

+ 1 - 1
src/render/sdlgpu/shaders/color.frag.sm50.dxbc.h

@@ -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,

+ 1 - 1
src/render/sdlgpu/shaders/color.frag.sm60.dxil.h

@@ -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,

+ 2 - 2
src/render/sdlgpu/shaders/color.frag.spv.h

@@ -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;

+ 6 - 0
src/render/sdlgpu/shaders/fix-shaders.sh

@@ -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

+ 2 - 2
src/render/sdlgpu/shaders/linepoint.vert.metal.h

@@ -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;

+ 1 - 1
src/render/sdlgpu/shaders/linepoint.vert.sm50.dxbc.h

@@ -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,

+ 1 - 1
src/render/sdlgpu/shaders/linepoint.vert.sm60.dxil.h

@@ -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,

+ 2 - 2
src/render/sdlgpu/shaders/linepoint.vert.spv.h

@@ -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;

+ 2 - 2
src/render/sdlgpu/shaders/texture_rgb.frag.metal.h

@@ -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;

+ 1 - 1
src/render/sdlgpu/shaders/texture_rgb.frag.sm50.dxbc.h

@@ -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,

+ 1 - 1
src/render/sdlgpu/shaders/texture_rgb.frag.sm60.dxil.h

@@ -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,

+ 2 - 2
src/render/sdlgpu/shaders/texture_rgb.frag.spv.h

@@ -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;

+ 2 - 2
src/render/sdlgpu/shaders/texture_rgba.frag.metal.h

@@ -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;

+ 1 - 1
src/render/sdlgpu/shaders/texture_rgba.frag.sm50.dxbc.h

@@ -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,

+ 1 - 1
src/render/sdlgpu/shaders/texture_rgba.frag.sm60.dxil.h

@@ -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,

+ 2 - 2
src/render/sdlgpu/shaders/texture_rgba.frag.spv.h

@@ -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;

+ 2 - 2
src/render/sdlgpu/shaders/tri_color.vert.metal.h

@@ -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;

+ 1 - 1
src/render/sdlgpu/shaders/tri_color.vert.sm50.dxbc.h

@@ -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,

+ 1 - 1
src/render/sdlgpu/shaders/tri_color.vert.sm60.dxil.h

@@ -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,

+ 2 - 2
src/render/sdlgpu/shaders/tri_color.vert.spv.h

@@ -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;

+ 2 - 2
src/render/sdlgpu/shaders/tri_texture.vert.metal.h

@@ -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;

+ 1 - 1
src/render/sdlgpu/shaders/tri_texture.vert.sm50.dxbc.h

@@ -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,

+ 1 - 1
src/render/sdlgpu/shaders/tri_texture.vert.sm60.dxil.h

@@ -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,

+ 2 - 2
src/render/sdlgpu/shaders/tri_texture.vert.spv.h

@@ -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;