From: Ross Burton <[email protected]>

Backport a patch from upstream to fix the build on 32-bit platforms, and
remove the COMPATIBLE_HOST restriction.

Signed-off-by: Ross Burton <[email protected]>
---
 .../vulkan/vulkan-samples/32bit.patch         | 101 ++++++++++++++++++
 .../vulkan/vulkan-samples_git.bb              |   2 +-
 2 files changed, 102 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-graphics/vulkan/vulkan-samples/32bit.patch

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 00000000000..644c3b61670
--- /dev/null
+++ b/meta/recipes-graphics/vulkan/vulkan-samples/32bit.patch
@@ -0,0 +1,101 @@
+From 49761ca63797014223d8e3ff6fb2c0235803c19c Mon Sep 17 00:00:00 2001
+From: asuessenbach <[email protected]>
+Date: Wed, 3 May 2023 09:50:08 +0200
+Subject: [PATCH] Resolve some Vulkan-Hpp-related issues on Win32.
+
+This patch fixes vulkan-samples compilation on 32-bit hosts.
+
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <[email protected]>
+
+---
+ framework/common/hpp_vk_common.h                        | 4 ++--
+ framework/core/hpp_buffer.cpp                           | 4 ++--
+ framework/core/hpp_buffer.h                             | 2 +-
+ framework/core/hpp_image.cpp                            | 2 +-
+ samples/api/hpp_texture_loading/hpp_texture_loading.cpp | 2 +-
+ 5 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/framework/common/hpp_vk_common.h 
b/framework/common/hpp_vk_common.h
+index 39ed3dcde..0cbbe479e 100644
+--- a/framework/common/hpp_vk_common.h
++++ b/framework/common/hpp_vk_common.h
+@@ -92,7 +92,7 @@ inline bool 
is_dynamic_buffer_descriptor_type(vk::DescriptorType descriptor_type
+ 
+ inline vk::ShaderModule load_shader(const std::string &filename, vk::Device 
device, vk::ShaderStageFlagBits stage)
+ {
+-      return vkb::load_shader(filename, device, 
static_cast<VkShaderStageFlagBits>(stage));
++      return static_cast<vk::ShaderModule>(vkb::load_shader(filename, device, 
static_cast<VkShaderStageFlagBits>(stage)));
+ }
+ 
+ inline void set_image_layout(vk::CommandBuffer         command_buffer,
+@@ -104,7 +104,7 @@ inline void set_image_layout(vk::CommandBuffer         
command_buffer,
+                              vk::PipelineStageFlags    dst_mask = 
vk::PipelineStageFlagBits::eAllCommands)
+ {
+       vkb::set_image_layout(command_buffer,
+-                            image,
++                            static_cast<VkImage>(image),
+                             static_cast<VkImageLayout>(old_layout),
+                             static_cast<VkImageLayout>(new_layout),
+                             
static_cast<VkImageSubresourceRange>(subresource_range),
+diff --git a/framework/core/hpp_buffer.cpp b/framework/core/hpp_buffer.cpp
+index 8da265acb..e6509b9f4 100644
+--- a/framework/core/hpp_buffer.cpp
++++ b/framework/core/hpp_buffer.cpp
+@@ -84,7 +84,7 @@ HPPBuffer::~HPPBuffer()
+       if (get_handle() && (allocation != VK_NULL_HANDLE))
+       {
+               unmap();
+-              vmaDestroyBuffer(get_device().get_memory_allocator(), 
get_handle(), allocation);
++              vmaDestroyBuffer(get_device().get_memory_allocator(), 
static_cast<VkBuffer>(get_handle()), allocation);
+       }
+ }
+ 
+@@ -93,7 +93,7 @@ VmaAllocation HPPBuffer::get_allocation() const
+       return allocation;
+ }
+ 
+-VkDeviceMemory HPPBuffer::get_memory() const
++vk::DeviceMemory HPPBuffer::get_memory() const
+ {
+       return memory;
+ }
+diff --git a/framework/core/hpp_buffer.h b/framework/core/hpp_buffer.h
+index 7a243c265..bad47406d 100644
+--- a/framework/core/hpp_buffer.h
++++ b/framework/core/hpp_buffer.h
+@@ -55,7 +55,7 @@ class HPPBuffer : public 
vkb::core::HPPVulkanResource<vk::Buffer>
+ 
+       VmaAllocation  get_allocation() const;
+       const uint8_t *get_data() const;
+-      VkDeviceMemory get_memory() const;
++      vk::DeviceMemory get_memory() const;
+ 
+       /**
+        * @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)
+diff --git a/framework/core/hpp_image.cpp b/framework/core/hpp_image.cpp
+index 00fa89ba7..5e6f27363 100644
+--- a/framework/core/hpp_image.cpp
++++ b/framework/core/hpp_image.cpp
+@@ -138,7 +138,7 @@ HPPImage::~HPPImage()
+       if (get_handle() && memory)
+       {
+               unmap();
+-              vmaDestroyImage(get_device().get_memory_allocator(), 
get_handle(), memory);
++              vmaDestroyImage(get_device().get_memory_allocator(), 
static_cast<VkImage>(get_handle()), memory);
+       }
+ }
+ 
+diff --git a/samples/api/hpp_texture_loading/hpp_texture_loading.cpp 
b/samples/api/hpp_texture_loading/hpp_texture_loading.cpp
+index 11a1f24c1..cbdd22773 100644
+--- a/samples/api/hpp_texture_loading/hpp_texture_loading.cpp
++++ b/samples/api/hpp_texture_loading/hpp_texture_loading.cpp
+@@ -170,7 +170,7 @@ void HPPTextureLoading::load_texture()
+               memory_allocate_info  = {memory_requirements.size,
+                                        
get_device()->get_gpu().get_memory_type(memory_requirements.memoryTypeBits, 
vk::MemoryPropertyFlagBits::eDeviceLocal)};
+               texture.device_memory = 
get_device()->get_handle().allocateMemory(memory_allocate_info);
+-              VK_CHECK(vkBindImageMemory(get_device()->get_handle(), 
texture.image, texture.device_memory, 0));
++              get_device()->get_handle().bindImageMemory(texture.image, 
texture.device_memory, 0);
+ 
+               vk::CommandBuffer copy_command = 
get_device()->create_command_buffer(vk::CommandBufferLevel::ePrimary, true);
+ 
diff --git a/meta/recipes-graphics/vulkan/vulkan-samples_git.bb 
b/meta/recipes-graphics/vulkan/vulkan-samples_git.bb
index 52a9ee75fe9..458d1405aee 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
            file://debugfix.patch \
            
file://0001-Do-not-use-LFS64-functions-on-linux-musl.patch;patchdir=third_party/spdlog
 \
            
file://0001-Deprecate-u8string_view.patch;patchdir=third_party/spdlog \
+           file://32bit.patch \
            "
 
 UPSTREAM_CHECK_COMMITS = "1"
@@ -18,7 +19,6 @@ UPSTREAM_CHECK_GITTAGREGEX = "These are not the releases 
you're looking for"
 S = "${WORKDIR}/git"
 
 REQUIRED_DISTRO_FEATURES = 'vulkan'
-COMPATIBLE_HOST = 
"(x86_64|aarch64|mips64|powerpc64|riscv64|loongarch64).*-linux"
 
 inherit cmake features_check
 
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#182381): 
https://lists.openembedded.org/g/openembedded-core/message/182381
Mute This Topic: https://lists.openembedded.org/mt/99340727/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to