[gtk+] build: Move Vulkan shader handling to its own directory



commit 4904491b77bf5c93d9419b63ef8d77f69389ed38
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Aug 15 16:17:05 2017 +0100

    build: Move Vulkan shader handling to its own directory
    
    Spooky action at a distance is not really allowed in Meson, so the rules
    to generate the SPV files should go in their own directory.
    
    Tested by: Rico Tzschichholz <ricotz ubuntu com>

 gsk/meson.build                  |   56 +-------------------------------------
 gsk/resources/vulkan/meson.build |   56 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+), 55 deletions(-)
---
diff --git a/gsk/meson.build b/gsk/meson.build
index d96c496..83be577 100644
--- a/gsk/meson.build
+++ b/gsk/meson.build
@@ -68,61 +68,7 @@ if have_vulkan
     'gskvulkanshader.c',
   ])
 
-# FIXME: what's up with these?
-#  gsk_private_vulkan_include_shaders = [
-#    'resources/vulkan/clip.frag.glsl',
-#    'resources/vulkan/clip.vert.glsl',
-#    'resources/vulkan/constants.glsl',
-#    'resources/vulkan/rounded-rect.glsl',
-#  ]
-
-  gsk_private_vulkan_fragment_shaders = [
-    'resources/vulkan/blend.frag',
-    'resources/vulkan/border.frag',
-    'resources/vulkan/color.frag',
-    'resources/vulkan/color-matrix.frag',
-    'resources/vulkan/inset-shadow.frag',
-    'resources/vulkan/linear.frag',
-    'resources/vulkan/outset-shadow.frag',
-  ]
-
-  gsk_private_vulkan_vertex_shaders = [
-    'resources/vulkan/blend.vert',
-    'resources/vulkan/border.vert',
-    'resources/vulkan/color.vert',
-    'resources/vulkan/color-matrix.vert',
-    'resources/vulkan/inset-shadow.vert',
-    'resources/vulkan/linear.vert',
-    'resources/vulkan/outset-shadow.vert',
-  ]
-
-  gsk_private_vulkan_shaders += gsk_private_vulkan_fragment_shaders
-  gsk_private_vulkan_shaders += gsk_private_vulkan_vertex_shaders
-
-  glslc = find_program('glslc', required: false)
-  foreach shader: gsk_private_vulkan_shaders
-    basefn = shader.split('.').get(0)
-    suffix = shader.split('.').get(1)
-
-    stage_arg = suffix == 'frag' ? '-fshader-stage=fragment' : '-fshader-stage=vertex'
-    spv_shader = '@0@.@1@.spv'.format(basefn, suffix)
-
-    if glslc.found()
-      compiled_shader = custom_target(spv_shader,
-                                      input: shader,
-                                      output: spv_shader,
-                                      command: [
-                                        glslc,
-                                        stage_arg,
-                                        '-DCLIP_NONE',
-                                        '-o', '@OUTPUT@'
-                                      ])
-    endif
-    gsk_private_vulkan_compiled_shaders += spv_shader
-    gsk_private_vulkan_compiled_shaders += '@0@-clip.@1@.spv'.format(basefn, suffix)
-    gsk_private_vulkan_compiled_shaders += '@0@-clip-rounded.@1@.spv'.format(basefn, suffix)
-  endforeach
-
+  subdir('resources/vulkan')
 endif # have_vulkan
 
 gsk_resources_xml = configure_file(output: 'gsk.resources.xml',
diff --git a/gsk/resources/vulkan/meson.build b/gsk/resources/vulkan/meson.build
new file mode 100644
index 0000000..d3b01fa
--- /dev/null
+++ b/gsk/resources/vulkan/meson.build
@@ -0,0 +1,56 @@
+# FIXME: what's up with these?
+#gsk_private_vulkan_include_shaders = [
+#  'clip.frag.glsl',
+#  'clip.vert.glsl',
+#  'constants.glsl',
+#  'rounded-rect.glsl',
+#]
+
+gsk_private_vulkan_fragment_shaders = [
+  'blend.frag',
+  'border.frag',
+  'color.frag',
+  'color-matrix.frag',
+  'inset-shadow.frag',
+  'linear.frag',
+  'outset-shadow.frag',
+]
+
+gsk_private_vulkan_vertex_shaders = [
+  'blend.vert',
+  'border.vert',
+  'color.vert',
+  'color-matrix.vert',
+  'inset-shadow.vert',
+  'linear.vert',
+  'outset-shadow.vert',
+]
+
+gsk_private_vulkan_shaders += gsk_private_vulkan_fragment_shaders
+gsk_private_vulkan_shaders += gsk_private_vulkan_vertex_shaders
+
+glslc = find_program('glslc', required: false)
+foreach shader: gsk_private_vulkan_shaders
+  basefn = shader.split('.').get(0)
+  suffix = shader.split('.').get(1)
+
+  stage_arg = suffix == 'frag' ? '-fshader-stage=fragment' : '-fshader-stage=vertex'
+  spv_shader = '@0@.@1@.spv'.format(basefn, suffix)
+
+  if glslc.found()
+    compiled_shader = custom_target(spv_shader,
+                                    input: shader,
+                                    output: spv_shader,
+                                    build_by_default: true,
+                                    command: [
+                                      glslc,
+                                      stage_arg,
+                                      '-DCLIP_NONE',
+                                      '@INPUT@',
+                                      '-o', '@OUTPUT@'
+                                    ])
+  endif
+  gsk_private_vulkan_compiled_shaders += files(spv_shader)
+  gsk_private_vulkan_compiled_shaders += '@0@-clip.@1@.spv'.format(basefn, suffix)
+  gsk_private_vulkan_compiled_shaders += '@0@-clip-rounded.@1@.spv'.format(basefn, suffix)
+endforeach


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]