mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 05:01:09 +00:00
meson: add vulkan bits
This commit is contained in:
parent
3ac88fa6b6
commit
95979f4d2f
@ -14,6 +14,8 @@ G_BEGIN_DECLS
|
|||||||
#mesondefine GDK_WINDOWING_BROADWAY
|
#mesondefine GDK_WINDOWING_BROADWAY
|
||||||
#mesondefine GDK_WINDOWING_WAYLAND
|
#mesondefine GDK_WINDOWING_WAYLAND
|
||||||
|
|
||||||
|
#mesondefine GDK_RENDERING_VULKAN
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GDKCONFIG_H__ */
|
#endif /* __GDKCONFIG_H__ */
|
||||||
|
@ -114,6 +114,7 @@ gdk_x_sources = files([
|
|||||||
'x11/gdkscreen-x11.h',
|
'x11/gdkscreen-x11.h',
|
||||||
'x11/gdkselection-x11.c',
|
'x11/gdkselection-x11.c',
|
||||||
'x11/gdkvisual-x11.c',
|
'x11/gdkvisual-x11.c',
|
||||||
|
'x11/gdkvulkancontext-x11.c',
|
||||||
'x11/gdkwindow-x11.c',
|
'x11/gdkwindow-x11.c',
|
||||||
'x11/gdkwindow-x11.h',
|
'x11/gdkwindow-x11.h',
|
||||||
'x11/gdkx.h',
|
'x11/gdkx.h',
|
||||||
@ -169,6 +170,7 @@ gdk_wayland_sources = files([
|
|||||||
'wayland/gdkscreen-wayland.c',
|
'wayland/gdkscreen-wayland.c',
|
||||||
'wayland/gdkseat-wayland.h',
|
'wayland/gdkseat-wayland.h',
|
||||||
'wayland/gdkselection-wayland.c',
|
'wayland/gdkselection-wayland.c',
|
||||||
|
'wayland/gdkvulkancontext-wayland.c',
|
||||||
'wayland/gdkwayland.h',
|
'wayland/gdkwayland.h',
|
||||||
'wayland/gdkwaylanddevice.h',
|
'wayland/gdkwaylanddevice.h',
|
||||||
'wayland/gdkwaylanddisplay.h',
|
'wayland/gdkwaylanddisplay.h',
|
||||||
@ -299,14 +301,16 @@ cdata.set('GTK_MINOR_VERSION', gtk_minor_version)
|
|||||||
cdata.set('GTK_MICRO_VERSION', gtk_micro_version)
|
cdata.set('GTK_MICRO_VERSION', gtk_micro_version)
|
||||||
|
|
||||||
|
|
||||||
|
gdkconfig_cdata = configuration_data()
|
||||||
|
gdkconfig_cdata.set('GDK_WINDOWING_X11', x11_enabled)
|
||||||
|
gdkconfig_cdata.set('GDK_WINDOWING_WAYLAND', wayland_enabled)
|
||||||
|
gdkconfig_cdata.set('GDK_WINDOWING_BROADWAY', broadway_enabled)
|
||||||
|
gdkconfig_cdata.set('GDK_RENDERING_VULKAN', have_vulkan)
|
||||||
|
|
||||||
if x11_enabled cdata.set('GDK_WINDOWING_X11', '') endif
|
|
||||||
if wayland_enabled cdata.set('GDK_WINDOWING_WAYLAND', '') endif
|
|
||||||
if broadway_enabled cdata.set('GDK_WINDOWING_BROADWAY', '') endif
|
|
||||||
gdkconfig = configure_file(
|
gdkconfig = configure_file(
|
||||||
input : 'gdkconfig.h.meson',
|
input : 'gdkconfig.h.meson',
|
||||||
output : 'gdkconfig.h',
|
output : 'gdkconfig.h',
|
||||||
configuration : cdata,
|
configuration : gdkconfig_cdata,
|
||||||
install_dir: 'include/gtk-4.0/gdk/' # XXX ???
|
install_dir: 'include/gtk-4.0/gdk/' # XXX ???
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -331,7 +335,8 @@ gdk_deps = [
|
|||||||
epoxy_dep,
|
epoxy_dep,
|
||||||
fontconfig_dep,
|
fontconfig_dep,
|
||||||
giounix_dep,
|
giounix_dep,
|
||||||
pangocairo_dep
|
pangocairo_dep,
|
||||||
|
vulkan_lib
|
||||||
]
|
]
|
||||||
|
|
||||||
gdk_sources = [
|
gdk_sources = [
|
||||||
|
@ -19,36 +19,84 @@ gsk_private_sources = files([
|
|||||||
'gskshaderbuilder.c',
|
'gskshaderbuilder.c',
|
||||||
])
|
])
|
||||||
|
|
||||||
# FIXME: do we need this variable?
|
# FIXME: install gsk_public_headers ?
|
||||||
gsk_sources = gsk_public_sources + gsk_private_sources
|
gsk_public_headers = files([
|
||||||
|
|
||||||
gsk_headers = files([
|
|
||||||
'gskenums.h',
|
'gskenums.h',
|
||||||
'gskrenderer.h',
|
'gskrenderer.h',
|
||||||
'gskrendernode.h',
|
'gskrendernode.h',
|
||||||
|
'gskroundedrect.h',
|
||||||
|
'gsktexture.h',
|
||||||
'gsktypes.h',
|
'gsktypes.h',
|
||||||
'gskcairorendererprivate.h',
|
|
||||||
'gskdebugprivate.h',
|
|
||||||
'gskgldriverprivate.h',
|
|
||||||
'gskglprofilerprivate.h',
|
|
||||||
'gskglrendererprivate.h',
|
|
||||||
'gskprivate.h',
|
|
||||||
'gskprofilerprivate.h',
|
|
||||||
'gskrendererprivate.h',
|
|
||||||
'gskrendernodeprivate.h',
|
|
||||||
'gskshaderbuilderprivate.h',
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
if have_vulkan
|
||||||
|
gsk_private_sources += files([
|
||||||
|
'gskvulkanblendpipeline.c',
|
||||||
|
'gskvulkanborderpipeline.c',
|
||||||
|
'gskvulkanboxshadowpipeline.c',
|
||||||
|
'gskvulkanbuffer.c',
|
||||||
|
'gskvulkanclip.c',
|
||||||
|
'gskvulkancolorpipeline.c',
|
||||||
|
'gskvulkancommandpool.c',
|
||||||
|
'gskvulkaneffectpipeline.c',
|
||||||
|
'gskvulkanlineargradientpipeline.c',
|
||||||
|
'gskvulkanimage.c',
|
||||||
|
'gskvulkanmemory.c',
|
||||||
|
'gskvulkanpipeline.c',
|
||||||
|
'gskvulkanpushconstants.c',
|
||||||
|
'gskvulkanrender.c',
|
||||||
|
'gskvulkanrenderer.c',
|
||||||
|
'gskvulkanrenderpass.c',
|
||||||
|
'gskvulkanshader.c',
|
||||||
|
])
|
||||||
|
|
||||||
|
# FIXME: vulkan shaders
|
||||||
|
#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_vertex_shaders)
|
||||||
|
#gsk_private_vulkan_compiled_shaders =',
|
||||||
|
# '$(gsk_private_vulkan_fragment_shaders:.frag=.frag.spv)',
|
||||||
|
# '$(gsk_private_vulkan_vertex_shaders:.vert=.vert.spv)',
|
||||||
|
# '$(gsk_private_vulkan_fragment_shaders:.frag=-clip.frag.spv)',
|
||||||
|
# '$(gsk_private_vulkan_vertex_shaders:.vert=-clip.vert.spv)',
|
||||||
|
# '$(gsk_private_vulkan_fragment_shaders:.frag=-clip-rounded.frag.spv)',
|
||||||
|
# '$(gsk_private_vulkan_vertex_shaders:.vert=-clip-rounded.vert.spv)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# FIXME: do we need this variable?
|
||||||
|
gsk_sources = gsk_public_sources + gsk_private_sources
|
||||||
|
|
||||||
gskenum_h = custom_target(
|
gskenum_h = custom_target(
|
||||||
'gskenum_h',
|
'gskenum_h',
|
||||||
output : 'gskenumtypes.h',
|
output : 'gskenumtypes.h',
|
||||||
input : gsk_headers,
|
input : gsk_public_headers,
|
||||||
command : [mkenum, perl, glib_mkenums, meson.current_source_dir() + '/gskenumtypes.h.template', '@OUTPUT@', '@INPUT@'])
|
command : [mkenum, perl, glib_mkenums, meson.current_source_dir() + '/gskenumtypes.h.template', '@OUTPUT@', '@INPUT@'])
|
||||||
|
|
||||||
gskenum_c = custom_target(
|
gskenum_c = custom_target(
|
||||||
'gskenum_c',
|
'gskenum_c',
|
||||||
output : 'gskenumtypes.c',
|
output : 'gskenumtypes.c',
|
||||||
input : gsk_headers,
|
input : gsk_public_headers,
|
||||||
depends : gskenum_h,
|
depends : gskenum_h,
|
||||||
command : [mkenum, perl, glib_mkenums, meson.current_source_dir() + '/gskenumtypes.c.template', '@OUTPUT@', '@INPUT@'])
|
command : [mkenum, perl, glib_mkenums, meson.current_source_dir() + '/gskenumtypes.c.template', '@OUTPUT@', '@INPUT@'])
|
||||||
|
|
||||||
@ -74,7 +122,7 @@ libgsk = static_library(
|
|||||||
sources: [gsk_sources, gskenum_h, gskresources],
|
sources: [gsk_sources, gskenum_h, gskresources],
|
||||||
dependencies: gsk_deps,
|
dependencies: gsk_deps,
|
||||||
include_directories: [confinc],
|
include_directories: [confinc],
|
||||||
c_args: ['-DGSK_COMPILATION'],
|
c_args: ['-DGSK_COMPILATION', '-DG_LOG_DOMAIN="Gsk"'],
|
||||||
)
|
)
|
||||||
|
|
||||||
libgsk_dep = declare_dependency(
|
libgsk_dep = declare_dependency(
|
||||||
|
20
meson.build
20
meson.build
@ -271,6 +271,26 @@ if mlib.found()
|
|||||||
cdata.set('HAVE_LIBM', 1)
|
cdata.set('HAVE_LIBM', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Check for Vulkan support
|
||||||
|
# TODO: move to gsk subfolder maybe? Or will it be used elsewhere too?
|
||||||
|
have_vulkan = false
|
||||||
|
vulkan_lib = []
|
||||||
|
enable_vulkan = get_option('enable-vulkan')
|
||||||
|
if enable_vulkan != 'no'
|
||||||
|
vulkan_lib = cc.find_library('vulkan', required : false)
|
||||||
|
if vulkan_lib.found() and cc.has_function('vkCreateInstance', dependencies : vulkan_lib) and cc.has_header('vulkan/vulkan.h')
|
||||||
|
glslc = find_program('glslc', required : false)
|
||||||
|
if glslc.found()
|
||||||
|
have_vulkan = true
|
||||||
|
# FIXME: -lvulkan needs to go into gtk+-4.0.pc (GDK_EXTRA_LIBS)
|
||||||
|
else
|
||||||
|
error('Need glslc for Vulkan support. See https://github.com/google/shaderc or compile with -Denable-vulkan=no')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
message('Vulkan support explicitly disabled')
|
||||||
|
endif
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
input : 'config.h.meson',
|
input : 'config.h.meson',
|
||||||
output: 'config.h',
|
output: 'config.h',
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
option('enable-x11-backend', type: 'boolean', value: 'true')
|
option('enable-x11-backend', type: 'boolean', value: 'true')
|
||||||
option('enable-wayland-backend', type: 'boolean', value: 'true')
|
option('enable-wayland-backend', type: 'boolean', value: 'true')
|
||||||
option('enable-broadway-backend', type: 'boolean', value: 'false')
|
option('enable-broadway-backend', type: 'boolean', value: 'false')
|
||||||
|
option('enable-vulkan', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto')
|
||||||
|
Loading…
Reference in New Issue
Block a user