mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-20 02:20:13 +01:00
clients/simple-vulkan: New Vulkan client example
Example to serve as a reference of a basic Wayland client using Vulkan, contained in a single source file and with a minimal set of dependencies. Features incremental present (similar to swap_buffers_with_damage from EGL) which is not commonly used by other Vulkan demos and is useful to test the compositor. Based on weston-simple-egl. Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
This commit is contained in:
parent
ec52e0cdda
commit
75c37afa62
4 changed files with 2229 additions and 0 deletions
|
|
@ -172,6 +172,47 @@ simple_clients = [
|
|||
},
|
||||
]
|
||||
|
||||
if dep_vulkan.found() and prog_glslang.found()
|
||||
srcs_simple_vulkan_shaders = [
|
||||
'simple_vulkan_vertex_shader.vert',
|
||||
'simple_vulkan_fragment_shader.frag',
|
||||
]
|
||||
|
||||
simple_vulkan_shaders = []
|
||||
foreach s : srcs_simple_vulkan_shaders
|
||||
simple_vulkan_shaders += custom_target(s + '.spv.h',
|
||||
command: [ prog_glslang, '@INPUT@', '--quiet', '--variable-name', '@BASENAME@', '-V', '-x', '-o', '@OUTPUT@' ],
|
||||
input: s,
|
||||
output: '@BASENAME@.spv.h',
|
||||
)
|
||||
endforeach
|
||||
|
||||
simple_clients += {
|
||||
'name': 'vulkan',
|
||||
'sources': [
|
||||
'simple-vulkan.c',
|
||||
simple_vulkan_shaders,
|
||||
fractional_scale_v1_client_protocol_h,
|
||||
fractional_scale_v1_protocol_c,
|
||||
tearing_control_v1_client_protocol_h,
|
||||
tearing_control_v1_protocol_c,
|
||||
viewporter_client_protocol_h,
|
||||
viewporter_protocol_c,
|
||||
xdg_shell_client_protocol_h,
|
||||
xdg_shell_protocol_c,
|
||||
],
|
||||
'dep_objs': [
|
||||
dep_vulkan,
|
||||
dep_libm,
|
||||
dep_libshared,
|
||||
dep_matrix_c,
|
||||
dep_wayland_client,
|
||||
],
|
||||
'deps': [ 'vulkan', 'wayland-cursor' ],
|
||||
'options': [ 'renderer-gl' ]
|
||||
}
|
||||
endif
|
||||
|
||||
foreach t : simple_clients
|
||||
if simple_build_all or simple_clients_enabled.contains(t.get('name'))
|
||||
t_name = 'weston-simple-' + t.get('name')
|
||||
|
|
|
|||
2163
clients/simple-vulkan.c
Normal file
2163
clients/simple-vulkan.c
Normal file
File diff suppressed because it is too large
Load diff
9
clients/simple_vulkan_fragment_shader.frag
Normal file
9
clients/simple_vulkan_fragment_shader.frag
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#version 450 core
|
||||
|
||||
layout(location = 0) in vec4 vVaryingColor;
|
||||
layout(location = 0) out vec4 f_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
f_color = vVaryingColor;
|
||||
}
|
||||
16
clients/simple_vulkan_vertex_shader.vert
Normal file
16
clients/simple_vulkan_vertex_shader.vert
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#version 450 core
|
||||
|
||||
layout(std140, set = 0, binding = 0) uniform block {
|
||||
uniform mat4 rotation;
|
||||
};
|
||||
|
||||
layout(location = 0) in vec4 in_position;
|
||||
layout(location = 1) in vec4 in_color;
|
||||
|
||||
layout(location = 0) out vec4 vVaryingColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = rotation * in_position;
|
||||
vVaryingColor = vec4(in_color.rgba);
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue