diff options
author | Ross Burton <ross.burton@arm.com> | 2023-06-05 14:52:38 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-06-06 07:41:42 +0100 |
commit | a82397c2b959726e6b4e915608ca6a5ccd61b225 (patch) | |
tree | 9b219554e41e24e8b45b8205e4c94780b9dbea6c | |
parent | 492e59b331ee817c1859d2fd175786d767483eb5 (diff) | |
download | poky-a82397c2b959726e6b4e915608ca6a5ccd61b225.tar.gz |
vulkan-samples: fix build on 32-bit platforms
Backport a patch from upstream to fix the build on 32-bit platforms, and
remove the COMPATIBLE_HOST restriction.
(From OE-Core rev: f4f693ac3ba46373103f749f028ab296e6aeb085)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-graphics/vulkan/vulkan-samples/32bit.patch | 101 | ||||
-rw-r--r-- | meta/recipes-graphics/vulkan/vulkan-samples_git.bb | 2 |
2 files changed, 102 insertions, 1 deletions
diff --git a/meta/recipes-graphics/vulkan/vulkan-samples/32bit.patch b/meta/recipes-graphics/vulkan/vulkan-samples/32bit.patch new file mode 100644 index 0000000000..644c3b6167 --- /dev/null +++ b/meta/recipes-graphics/vulkan/vulkan-samples/32bit.patch | |||
@@ -0,0 +1,101 @@ | |||
1 | From 49761ca63797014223d8e3ff6fb2c0235803c19c Mon Sep 17 00:00:00 2001 | ||
2 | From: asuessenbach <asuessenbach@nvidia.com> | ||
3 | Date: Wed, 3 May 2023 09:50:08 +0200 | ||
4 | Subject: [PATCH] Resolve some Vulkan-Hpp-related issues on Win32. | ||
5 | |||
6 | This patch fixes vulkan-samples compilation on 32-bit hosts. | ||
7 | |||
8 | Upstream-Status: Backport | ||
9 | Signed-off-by: Ross Burton <ross.burton@arm.com> | ||
10 | |||
11 | --- | ||
12 | framework/common/hpp_vk_common.h | 4 ++-- | ||
13 | framework/core/hpp_buffer.cpp | 4 ++-- | ||
14 | framework/core/hpp_buffer.h | 2 +- | ||
15 | framework/core/hpp_image.cpp | 2 +- | ||
16 | samples/api/hpp_texture_loading/hpp_texture_loading.cpp | 2 +- | ||
17 | 5 files changed, 7 insertions(+), 7 deletions(-) | ||
18 | |||
19 | diff --git a/framework/common/hpp_vk_common.h b/framework/common/hpp_vk_common.h | ||
20 | index 39ed3dcde..0cbbe479e 100644 | ||
21 | --- a/framework/common/hpp_vk_common.h | ||
22 | +++ b/framework/common/hpp_vk_common.h | ||
23 | @@ -92,7 +92,7 @@ inline bool is_dynamic_buffer_descriptor_type(vk::DescriptorType descriptor_type | ||
24 | |||
25 | inline vk::ShaderModule load_shader(const std::string &filename, vk::Device device, vk::ShaderStageFlagBits stage) | ||
26 | { | ||
27 | - return vkb::load_shader(filename, device, static_cast<VkShaderStageFlagBits>(stage)); | ||
28 | + return static_cast<vk::ShaderModule>(vkb::load_shader(filename, device, static_cast<VkShaderStageFlagBits>(stage))); | ||
29 | } | ||
30 | |||
31 | inline void set_image_layout(vk::CommandBuffer command_buffer, | ||
32 | @@ -104,7 +104,7 @@ inline void set_image_layout(vk::CommandBuffer command_buffer, | ||
33 | vk::PipelineStageFlags dst_mask = vk::PipelineStageFlagBits::eAllCommands) | ||
34 | { | ||
35 | vkb::set_image_layout(command_buffer, | ||
36 | - image, | ||
37 | + static_cast<VkImage>(image), | ||
38 | static_cast<VkImageLayout>(old_layout), | ||
39 | static_cast<VkImageLayout>(new_layout), | ||
40 | static_cast<VkImageSubresourceRange>(subresource_range), | ||
41 | diff --git a/framework/core/hpp_buffer.cpp b/framework/core/hpp_buffer.cpp | ||
42 | index 8da265acb..e6509b9f4 100644 | ||
43 | --- a/framework/core/hpp_buffer.cpp | ||
44 | +++ b/framework/core/hpp_buffer.cpp | ||
45 | @@ -84,7 +84,7 @@ HPPBuffer::~HPPBuffer() | ||
46 | if (get_handle() && (allocation != VK_NULL_HANDLE)) | ||
47 | { | ||
48 | unmap(); | ||
49 | - vmaDestroyBuffer(get_device().get_memory_allocator(), get_handle(), allocation); | ||
50 | + vmaDestroyBuffer(get_device().get_memory_allocator(), static_cast<VkBuffer>(get_handle()), allocation); | ||
51 | } | ||
52 | } | ||
53 | |||
54 | @@ -93,7 +93,7 @@ VmaAllocation HPPBuffer::get_allocation() const | ||
55 | return allocation; | ||
56 | } | ||
57 | |||
58 | -VkDeviceMemory HPPBuffer::get_memory() const | ||
59 | +vk::DeviceMemory HPPBuffer::get_memory() const | ||
60 | { | ||
61 | return memory; | ||
62 | } | ||
63 | diff --git a/framework/core/hpp_buffer.h b/framework/core/hpp_buffer.h | ||
64 | index 7a243c265..bad47406d 100644 | ||
65 | --- a/framework/core/hpp_buffer.h | ||
66 | +++ b/framework/core/hpp_buffer.h | ||
67 | @@ -55,7 +55,7 @@ class HPPBuffer : public vkb::core::HPPVulkanResource<vk::Buffer> | ||
68 | |||
69 | VmaAllocation get_allocation() const; | ||
70 | const uint8_t *get_data() const; | ||
71 | - VkDeviceMemory get_memory() const; | ||
72 | + vk::DeviceMemory get_memory() const; | ||
73 | |||
74 | /** | ||
75 | * @return Return the buffer's device address (note: requires that the buffer has been created with the VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT usage fla) | ||
76 | diff --git a/framework/core/hpp_image.cpp b/framework/core/hpp_image.cpp | ||
77 | index 00fa89ba7..5e6f27363 100644 | ||
78 | --- a/framework/core/hpp_image.cpp | ||
79 | +++ b/framework/core/hpp_image.cpp | ||
80 | @@ -138,7 +138,7 @@ HPPImage::~HPPImage() | ||
81 | if (get_handle() && memory) | ||
82 | { | ||
83 | unmap(); | ||
84 | - vmaDestroyImage(get_device().get_memory_allocator(), get_handle(), memory); | ||
85 | + vmaDestroyImage(get_device().get_memory_allocator(), static_cast<VkImage>(get_handle()), memory); | ||
86 | } | ||
87 | } | ||
88 | |||
89 | diff --git a/samples/api/hpp_texture_loading/hpp_texture_loading.cpp b/samples/api/hpp_texture_loading/hpp_texture_loading.cpp | ||
90 | index 11a1f24c1..cbdd22773 100644 | ||
91 | --- a/samples/api/hpp_texture_loading/hpp_texture_loading.cpp | ||
92 | +++ b/samples/api/hpp_texture_loading/hpp_texture_loading.cpp | ||
93 | @@ -170,7 +170,7 @@ void HPPTextureLoading::load_texture() | ||
94 | memory_allocate_info = {memory_requirements.size, | ||
95 | get_device()->get_gpu().get_memory_type(memory_requirements.memoryTypeBits, vk::MemoryPropertyFlagBits::eDeviceLocal)}; | ||
96 | texture.device_memory = get_device()->get_handle().allocateMemory(memory_allocate_info); | ||
97 | - VK_CHECK(vkBindImageMemory(get_device()->get_handle(), texture.image, texture.device_memory, 0)); | ||
98 | + get_device()->get_handle().bindImageMemory(texture.image, texture.device_memory, 0); | ||
99 | |||
100 | vk::CommandBuffer copy_command = get_device()->create_command_buffer(vk::CommandBufferLevel::ePrimary, true); | ||
101 | |||
diff --git a/meta/recipes-graphics/vulkan/vulkan-samples_git.bb b/meta/recipes-graphics/vulkan/vulkan-samples_git.bb index 52a9ee75fe..458d1405ae 100644 --- a/meta/recipes-graphics/vulkan/vulkan-samples_git.bb +++ b/meta/recipes-graphics/vulkan/vulkan-samples_git.bb | |||
@@ -9,6 +9,7 @@ SRC_URI = "gitsm://github.com/KhronosGroup/Vulkan-Samples.git;branch=main;protoc | |||
9 | file://debugfix.patch \ | 9 | file://debugfix.patch \ |
10 | file://0001-Do-not-use-LFS64-functions-on-linux-musl.patch;patchdir=third_party/spdlog \ | 10 | file://0001-Do-not-use-LFS64-functions-on-linux-musl.patch;patchdir=third_party/spdlog \ |
11 | file://0001-Deprecate-u8string_view.patch;patchdir=third_party/spdlog \ | 11 | file://0001-Deprecate-u8string_view.patch;patchdir=third_party/spdlog \ |
12 | file://32bit.patch \ | ||
12 | " | 13 | " |
13 | 14 | ||
14 | UPSTREAM_CHECK_COMMITS = "1" | 15 | UPSTREAM_CHECK_COMMITS = "1" |
@@ -18,7 +19,6 @@ UPSTREAM_CHECK_GITTAGREGEX = "These are not the releases you're looking for" | |||
18 | S = "${WORKDIR}/git" | 19 | S = "${WORKDIR}/git" |
19 | 20 | ||
20 | REQUIRED_DISTRO_FEATURES = 'vulkan' | 21 | REQUIRED_DISTRO_FEATURES = 'vulkan' |
21 | COMPATIBLE_HOST = "(x86_64|aarch64|mips64|powerpc64|riscv64|loongarch64).*-linux" | ||
22 | 22 | ||
23 | inherit cmake features_check | 23 | inherit cmake features_check |
24 | 24 | ||