summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/vulkan
diff options
context:
space:
mode:
authorJussi Kukkonen <jussi.kukkonen@intel.com>2017-07-11 15:26:21 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-17 14:01:37 +0100
commit2d339f752a025325dede17fdaae781f9422aa87f (patch)
tree6c4810a61ae70a0ec8c455ec68bce5229d15a8ad /meta/recipes-graphics/vulkan
parent75b147e8a5a474aa8e3846828211d1718587e470 (diff)
downloadpoky-2d339f752a025325dede17fdaae781f9422aa87f.tar.gz
vulkan-demos: Add recipe
Sascha Willems collection of Vulkan demos is useful as a smoke testing tool. * Add patch to install binaries and data. * Add patch to fix build on X86 * Use a combination of patch and do_install_append to avoid some 3D models with unclear licensing. (From OE-Core rev: 88a6fa37e7ec2e68cdb2374f2a5371a6f44b3d67) Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-graphics/vulkan')
-rw-r--r--meta/recipes-graphics/vulkan/vulkan-demos/0001-Don-t-build-demos-with-questionably-licensed-data.patch91
-rw-r--r--meta/recipes-graphics/vulkan/vulkan-demos/0001-Fix-build-on-x86.patch41
-rw-r--r--meta/recipes-graphics/vulkan/vulkan-demos/0001-Support-installing-demos-support-out-of-tree-builds.patch85
-rw-r--r--meta/recipes-graphics/vulkan/vulkan-demos_git.bb36
4 files changed, 253 insertions, 0 deletions
diff --git a/meta/recipes-graphics/vulkan/vulkan-demos/0001-Don-t-build-demos-with-questionably-licensed-data.patch b/meta/recipes-graphics/vulkan/vulkan-demos/0001-Don-t-build-demos-with-questionably-licensed-data.patch
new file mode 100644
index 0000000000..d32c8f2803
--- /dev/null
+++ b/meta/recipes-graphics/vulkan/vulkan-demos/0001-Don-t-build-demos-with-questionably-licensed-data.patch
@@ -0,0 +1,91 @@
1From 55770fb07c42fe410cf8d09f8f5976babc89b9ef Mon Sep 17 00:00:00 2001
2From: Jussi Kukkonen <jussi.kukkonen@intel.com>
3Date: Tue, 4 Jul 2017 17:13:45 +0300
4Subject: [PATCH] Don't build demos with questionably licensed data
5
6Some of the models don't have open source compatible licenses:
7don't build demos using those. Also don't build demos that need
8resources that are not included.
9
10ssao:
11scenerendering:
12 Sibenik model, no license found
13
14deferred:
15deferredmultisampling:
16deferredshadows:
17 armor model, CC-BY-3.0
18
19vulkanscene:
20imgui:
21shadowmapping:
22 vulkanscene model, no license found
23
24indirectdraw:
25 plant model, no license found
26
27hdr:
28pbribl:
29pbrtexture:
30 Require external Vulkan Asset Pack
31
32Upstream-Status: Inappropriate [configuration]
33Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
34---
35 CMakeLists.txt | 13 -------------
36 1 file changed, 13 deletions(-)
37
38diff --git a/CMakeLists.txt b/CMakeLists.txt
39index 4958fff..0f9d3e4 100644
40--- a/CMakeLists.txt
41+++ b/CMakeLists.txt
42@@ -150,17 +150,11 @@ set(EXAMPLES
43 computeparticles
44 computeshader
45 debugmarker
46- deferred
47- deferredmultisampling
48- deferredshadows
49 displacement
50 distancefieldfonts
51 dynamicuniformbuffer
52 gears
53 geometryshader
54- hdr
55- imgui
56- indirectdraw
57 instancing
58 mesh
59 multisampling
60@@ -170,20 +164,14 @@ set(EXAMPLES
61 parallaxmapping
62 particlefire
63 pbrbasic
64- pbribl
65- pbrtexture
66 pipelines
67 pushconstants
68 radialblur
69 raytracing
70- scenerendering
71 screenshot
72- shadowmapping
73- shadowmappingomni
74 skeletalanimation
75 specializationconstants
76 sphericalenvmapping
77- ssao
78 subpasses
79 terraintessellation
80 tessellation
81@@ -196,7 +184,6 @@ set(EXAMPLES
82 texturesparseresidency
83 triangle
84 viewportarray
85- vulkanscene
86 )
87
88 buildExamples()
89--
902.13.2
91
diff --git a/meta/recipes-graphics/vulkan/vulkan-demos/0001-Fix-build-on-x86.patch b/meta/recipes-graphics/vulkan/vulkan-demos/0001-Fix-build-on-x86.patch
new file mode 100644
index 0000000000..681b3422d9
--- /dev/null
+++ b/meta/recipes-graphics/vulkan/vulkan-demos/0001-Fix-build-on-x86.patch
@@ -0,0 +1,41 @@
1From b0495efb6c3ea3a530fcbaddac86da57ecce5a66 Mon Sep 17 00:00:00 2001
2From: Jussi Kukkonen <jussi.kukkonen@intel.com>
3Date: Mon, 10 Jul 2017 13:11:12 +0300
4Subject: [PATCH] Fix build on x86
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9| func_common.inl:193:51: error: wrong number of template arguments
10| (5, should be 6) struct compute_sign<T, P, vecType, false, Aligned>
11
12The fix is backported from the upstream glm project.
13
14Upstream-Status: Pending [https://github.com/SaschaWillems/Vulkan/issues/356]
15Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
16---
17 external/glm/glm/detail/func_common.inl | 4 ++--
18 1 file changed, 2 insertions(+), 2 deletions(-)
19
20diff --git a/external/glm/glm/detail/func_common.inl b/external/glm/glm/detail/func_common.inl
21index cafaed5..2dd94e1 100644
22--- a/external/glm/glm/detail/func_common.inl
23+++ b/external/glm/glm/detail/func_common.inl
24@@ -190,12 +190,12 @@ namespace detail
25
26 # if GLM_ARCH == GLM_ARCH_X86
27 template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
28- struct compute_sign<T, P, vecType, false, Aligned>
29+ struct compute_sign<L, T, P, vecType, false, Aligned>
30 {
31 GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x)
32 {
33 T const Shift(static_cast<T>(sizeof(T) * 8 - 1));
34- vecType<L, T, P> const y(vecType<typename make_unsigned<T>::type, P>(-x) >> typename make_unsigned<T>::type(Shift));
35+ vecType<L, T, P> const y(vecType<L, typename make_unsigned<T>::type, P>(-x) >> typename make_unsigned<T>::type(Shift));
36
37 return (x >> Shift) | y;
38 }
39--
402.1.4
41
diff --git a/meta/recipes-graphics/vulkan/vulkan-demos/0001-Support-installing-demos-support-out-of-tree-builds.patch b/meta/recipes-graphics/vulkan/vulkan-demos/0001-Support-installing-demos-support-out-of-tree-builds.patch
new file mode 100644
index 0000000000..4addea3bf1
--- /dev/null
+++ b/meta/recipes-graphics/vulkan/vulkan-demos/0001-Support-installing-demos-support-out-of-tree-builds.patch
@@ -0,0 +1,85 @@
1From edca667684764cfcc0460e448e834fadf623a887 Mon Sep 17 00:00:00 2001
2From: Jussi Kukkonen <jussi.kukkonen@intel.com>
3Date: Mon, 3 Jul 2017 14:49:18 +0300
4Subject: [PATCH] Support installing demos, support out-of-tree builds
5
6This is especially useful for cross-compile situation where testing
7happens on target.
8
9-DRESOURCE_INSTALL_DIR=<path> decides where data is installed (and
10where the binaries will load the data from): if it's left empty,
11then nothing will be installed and binaries will load the data from
12CMAKE_SOURCE_DIR.
13
14Binaries are now correctly built in CMAKE_BINARY_DIR.
15
16Upstream-Status: Submitted [https://github.com/SaschaWillems/Vulkan/pull/352]
17Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
18---
19 CMakeLists.txt | 15 ++++++++++++++-
20 base/vulkanexamplebase.cpp | 2 +-
21 2 files changed, 15 insertions(+), 2 deletions(-)
22
23diff --git a/CMakeLists.txt b/CMakeLists.txt
24index b9886bc..4958fff 100644
25--- a/CMakeLists.txt
26+++ b/CMakeLists.txt
27@@ -16,6 +16,8 @@ include_directories(base)
28 OPTION(USE_D2D_WSI "Build the project using Direct to Display swapchain" OFF)
29 OPTION(USE_WAYLAND_WSI "Build the project using Wayland swapchain" OFF)
30
31+set(RESOURCE_INSTALL_DIR "" CACHE PATH "Path to install resources to (leave empty for running uninstalled)")
32+
33 # Use FindVulkan module added with CMAKE 3.7
34 if (NOT CMAKE_VERSION VERSION_LESS 3.7.0)
35 message(STATUS "Using module to find Vulkan")
36@@ -108,6 +110,10 @@ function(buildExample EXAMPLE_NAME)
37 add_executable(${EXAMPLE_NAME} ${MAIN_CPP} ${SOURCE} ${SHADERS})
38 target_link_libraries(${EXAMPLE_NAME} ${Vulkan_LIBRARY} ${ASSIMP_LIBRARIES} ${WAYLAND_CLIENT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
39 endif(WIN32)
40+
41+ if(RESOURCE_INSTALL_DIR)
42+ install(TARGETS ${EXAMPLE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
43+ endif()
44 endfunction(buildExample)
45
46 # Build all examples
47@@ -117,6 +123,13 @@ function(buildExamples)
48 endforeach(EXAMPLE)
49 endfunction(buildExamples)
50
51+if(RESOURCE_INSTALL_DIR)
52+ add_definitions(-DVK_EXAMPLE_DATA_DIR=\"${RESOURCE_INSTALL_DIR}/\")
53+ install(DIRECTORY data/ DESTINATION ${RESOURCE_INSTALL_DIR}/)
54+else()
55+ add_definitions(-DVK_EXAMPLE_DATA_DIR=\"${CMAKE_SOURCE_DIR}/data/\")
56+endif()
57+
58 # Compiler specific stuff
59 IF(MSVC)
60 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
61@@ -128,7 +141,7 @@ ELSE(WIN32)
62 link_libraries(${XCB_LIBRARIES} ${Vulkan_LIBRARY})
63 ENDIF(WIN32)
64
65-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/")
66+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/")
67
68 set(EXAMPLES
69 bloom
70diff --git a/base/vulkanexamplebase.cpp b/base/vulkanexamplebase.cpp
71index 647368a..a0f28a5 100644
72--- a/base/vulkanexamplebase.cpp
73+++ b/base/vulkanexamplebase.cpp
74@@ -84,7 +84,7 @@ const std::string VulkanExampleBase::getAssetPath()
75 #if defined(__ANDROID__)
76 return "";
77 #else
78- return "./../data/";
79+ return VK_EXAMPLE_DATA_DIR;
80 #endif
81 }
82 #endif
83--
842.13.2
85
diff --git a/meta/recipes-graphics/vulkan/vulkan-demos_git.bb b/meta/recipes-graphics/vulkan/vulkan-demos_git.bb
new file mode 100644
index 0000000000..fcd9e7b7c8
--- /dev/null
+++ b/meta/recipes-graphics/vulkan/vulkan-demos_git.bb
@@ -0,0 +1,36 @@
1DESCRIPTION = "Collection of Vulkan examples"
2LICENSE = "MIT"
3DEPENDS = "zlib"
4
5LIC_FILES_CHKSUM = "file://LICENSE.md;md5=dcf473723faabf17baa9b5f2207599d0 \
6 file://triangle/triangle.cpp;endline=12;md5=bccd1bf9cadd9e10086cf7872157e4fa"
7
8SRC_URI = "git://github.com/SaschaWillems/Vulkan.git \
9 file://0001-Support-installing-demos-support-out-of-tree-builds.patch \
10 file://0001-Don-t-build-demos-with-questionably-licensed-data.patch \
11 file://0001-Fix-build-on-x86.patch \
12"
13SRCREV = "18df00c7b4677b0889486e16977857aa987947e2"
14UPSTREAM_CHECK_GITTAGREGEX = "These are not the releases you're looking for"
15S = "${WORKDIR}/git"
16
17inherit cmake distro_features_check
18DEPENDS = "vulkan assimp"
19
20do_install_append () {
21 # Remove assets that have uncertain licenses
22 rm ${D}${datadir}/vulkan-demos/models/armor/* \
23 ${D}${datadir}/vulkan-demos/models/sibenik/* \
24 ${D}${datadir}/vulkan-demos/models/vulkanscene* \
25 ${D}${datadir}/vulkan-demos/models/plants.dae \
26 ${D}${datadir}/vulkan-demos/textures/texturearray_plants*
27}
28
29EXTRA_OECMAKE = "-DRESOURCE_INSTALL_DIR=${datadir}/vulkan-demos"
30
31ANY_OF_DISTRO_FEATURES = "x11 wayland"
32
33# Can only pick one of [wayland,xcb]
34PACKAGECONFIG = "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland', 'xcb' ,d)}"
35PACKAGECONFIG[wayland] = "-DUSE_WAYLAND_WSI=ON, -DUSE_WAYLAND_WSI=OFF, wayland"
36PACKAGECONFIG[xcb] = ",,libxcb"