mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-21 13:36:39 +00:00
vulkan: also support glslang as a shader compiler
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6980>
This commit is contained in:
parent
346df4cb3f
commit
5b471311c5
11 changed files with 77 additions and 26 deletions
|
@ -23,10 +23,11 @@ vulkan_sources = files(
|
|||
)
|
||||
vulkan_plugin_enums = []
|
||||
|
||||
glslc = find_program('glslc', required: get_option('vulkan'))
|
||||
if not glslc.found()
|
||||
glslc = find_program('glslc', required: false)
|
||||
glslang = find_program('glslang', required: false)
|
||||
if not glslc.found() and not glslang.found()
|
||||
if get_option('vulkan').enabled()
|
||||
error('GStreamer Vulkan plugin required via options, but glslc was not found.')
|
||||
error('GStreamer Vulkan plugin required via options, but glslc or glslang was not found.')
|
||||
else
|
||||
subdir_done()
|
||||
endif
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#version 450 core
|
||||
|
||||
#extension GL_GOOGLE_include_directive : enable
|
||||
|
||||
#include "color_convert_generic.glsl"
|
||||
#include "upsample_ayuv.glsl"
|
||||
#include "swizzle.glsl"
|
||||
|
|
|
@ -16,19 +16,36 @@ gst_vulkan_shader_sources = [
|
|||
bin2array = find_program('bin2array.py')
|
||||
|
||||
# FIXME: meson compiler class instead?
|
||||
glslc_build_options = []
|
||||
optimization = get_option('optimization')
|
||||
if get_option('debug')
|
||||
glslc_build_options += ['-g']
|
||||
endif
|
||||
if get_option('werror')
|
||||
glslc_build_options += ['-Werror']
|
||||
endif
|
||||
if optimization == 's'
|
||||
glslc_build_options += ['-Os']
|
||||
endif
|
||||
if optimization in ['1', '2', '3']
|
||||
glslc_build_options += ['-O']
|
||||
if glslc.found()
|
||||
glslc_build_options = []
|
||||
optimization = get_option('optimization')
|
||||
if get_option('debug')
|
||||
glslc_build_options += ['-g']
|
||||
endif
|
||||
if get_option('werror')
|
||||
glslc_build_options += ['-Werror']
|
||||
endif
|
||||
if optimization == 's'
|
||||
glslc_build_options += ['-Os']
|
||||
endif
|
||||
if optimization in ['1', '2', '3']
|
||||
glslc_build_options += ['-O']
|
||||
endif
|
||||
elif glslang.found()
|
||||
glslang_build_options = []
|
||||
optimization = get_option('optimization')
|
||||
if get_option('debug')
|
||||
glslang_build_options += ['-g']
|
||||
endif
|
||||
if optimization == 's'
|
||||
glslang_build_options += ['-Os']
|
||||
endif
|
||||
if optimization == '0'
|
||||
glslang_build_options += ['-Od']
|
||||
endif
|
||||
else
|
||||
error('No glslc or glslang!')
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
vulkan_compiled_shader_sources = []
|
||||
|
@ -36,21 +53,36 @@ foreach shader: gst_vulkan_shader_sources
|
|||
basefn = shader.split('.').get(0)
|
||||
suffix = shader.split('.').get(1)
|
||||
|
||||
stage_arg = suffix == 'frag' ? '-fshader-stage=fragment' : '-fshader-stage=vertex'
|
||||
basename = '@0@.@1@'.format(basefn, suffix)
|
||||
spv_shader = basename + '.spv'
|
||||
c_shader_source = basename + '.c'
|
||||
c_shader_header = basename + '.h'
|
||||
|
||||
compiled_shader = custom_target(spv_shader,
|
||||
input: shader,
|
||||
output: spv_shader,
|
||||
depfile: '@PLAINNAME@.d',
|
||||
command: [glslc] + glslc_build_options + [stage_arg,
|
||||
'--target-env=vulkan1.0',
|
||||
'-MD', '-MF', '@DEPFILE@',
|
||||
'@INPUT@',
|
||||
'-o', '@OUTPUT@'])
|
||||
if glslc.found()
|
||||
stage_arg = suffix == 'frag' ? '-fshader-stage=fragment' : '-fshader-stage=vertex'
|
||||
compiled_shader = custom_target(spv_shader,
|
||||
input: shader,
|
||||
output: spv_shader,
|
||||
depfile: '@PLAINNAME@.d',
|
||||
command: [glslc] + glslc_build_options + [stage_arg,
|
||||
'--target-env=vulkan1.0',
|
||||
'-MD', '-MF', '@DEPFILE@',
|
||||
'@INPUT@',
|
||||
'-o', '@OUTPUT@'])
|
||||
elif glslang.found()
|
||||
compiled_shader = custom_target(spv_shader,
|
||||
input: shader,
|
||||
output: spv_shader,
|
||||
depfile: '@PLAINNAME@.d',
|
||||
command: [glslang] + glslang_build_options + [
|
||||
'-V100',
|
||||
'-I' + meson.current_source_dir(),
|
||||
'--target-env', 'vulkan1.0',
|
||||
'--depfile', '@DEPFILE@',
|
||||
'--quiet',
|
||||
'@INPUT@',
|
||||
'-o', '@OUTPUT@'])
|
||||
endif
|
||||
|
||||
c_shader = custom_target (c_shader_source,
|
||||
input: compiled_shader,
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#version 450 core
|
||||
|
||||
#extension GL_GOOGLE_include_directive : enable
|
||||
|
||||
#include "color_convert_generic.glsl"
|
||||
#include "upsample_nv12.glsl"
|
||||
#include "swizzle.glsl"
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#version 450 core
|
||||
|
||||
#extension GL_GOOGLE_include_directive : enable
|
||||
|
||||
#include "color_convert_generic.glsl"
|
||||
#include "swizzle.glsl"
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#version 450 core
|
||||
|
||||
#extension GL_GOOGLE_include_directive : enable
|
||||
|
||||
#include "color_convert_generic.glsl"
|
||||
#include "swizzle.glsl"
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#version 450 core
|
||||
|
||||
#extension GL_GOOGLE_include_directive : enable
|
||||
|
||||
#include "color_convert_generic.glsl"
|
||||
#include "swizzle.glsl"
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#version 450 core
|
||||
|
||||
#extension GL_GOOGLE_include_directive : enable
|
||||
|
||||
#include "swizzle.glsl"
|
||||
|
||||
layout(location = 0) in vec2 inTexCoord;
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#version 450 core
|
||||
|
||||
#extension GL_GOOGLE_include_directive : enable
|
||||
|
||||
#include "swizzle.glsl"
|
||||
|
||||
layout(location = 0) in vec2 inTexCoord;
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#version 450 core
|
||||
|
||||
#extension GL_GOOGLE_include_directive : enable
|
||||
|
||||
#include "view_defines.h"
|
||||
#include "swizzle.glsl"
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#version 450 core
|
||||
|
||||
#extension GL_GOOGLE_include_directive : enable
|
||||
|
||||
#include "color_convert_generic.glsl"
|
||||
#include "upsample_yuy2.glsl"
|
||||
#include "swizzle.glsl"
|
||||
|
|
Loading…
Reference in a new issue