Sunday, July 28, 2024

emulators/snes9x: fix build on ILP32 arches (was: Re: UPDATE emulators/snes9x 1.63 from MAINTAINER)

On Mon, Jul 22, 2024 at 11:27:42AM GMT, Stuart Henderson wrote:
> On 2024/07/09 21:47, Lucas Gabriel Vuotto wrote:
> > Hey ports@,
> >
> > Freshly out of the oven, here is an update for snes9x to its latest
> > version.
>
> Build fails on i386, and probably all ILP32 arches.
>
> /pobj/snes9x-1.63/snes9x-1.63/gtk/src/gtk_display_driver_vulkan.cpp:69:54: error: assigning to
> 'VkDescriptorPool' (aka 'unsigned long long') from incompatible type 'vk::DescriptorPool'
> init_info.DescriptorPool = imgui_descriptor_pool.get();
> ~~~~~~~~~~~~~~~~~~~~~~^~~~~
> /pobj/snes9x-1.63/snes9x-1.63/gtk/src/gtk_display_driver_vulkan.cpp:74:5: error: no matching function for call
> to 'ImGui_ImplVulkan_Init' ImGui_ImplVulkan_Init(&init_info, context->swapchain->get_render_pass());
> ^~~~~~~~~~~~~~~~~~~~~ /pobj/snes9x-1.63/snes9x-1.63/gtk/../external/imgui/imgui_impl_vulkan.h:67:29: note: candidate function not
> viable: no known conversion from 'vk::RenderPass' to 'VkRenderPass' (aka 'unsigned long long') for 2nd argument
> IMGUI_IMPL_API bool ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info, VkRenderPass render_pass);
> ^
> 2 errors generated.
> ninja: build stopped: subcommand failed.

Hi Stuart,

This patch makes it build in a vmd-backed i386, meaning that I only
compile-tested it. I do have a macppc laying around and I'll try giving
it a shot in there, but that will take me some more time. amd64 still
builds and runs.

I'm attempting to upstream the patch at [0]. I don't know if I should
reference the PR in the patch message. If that's the case, feel free to
edit it before commiting.

[0]: https://github.com/snes9xgit/snes9x/pull/940

Lucas


diff 776d4c09005a00012fddb385579422d478fecedd 4c7d93f92c47400c01860a76c61d8ec47c7ba890
commit - 776d4c09005a00012fddb385579422d478fecedd
commit + 4c7d93f92c47400c01860a76c61d8ec47c7ba890
blob - 8deaf932393ae14037dd58cd5102cc6717529fa6
blob + 2186e3b056142c97b59fa8d7419055e1d6eb1e4d
--- emulators/snes9x/Makefile
+++ emulators/snes9x/Makefile
@@ -5,6 +5,7 @@ BROKEN-hppa = ICE/failure on filter/hq2x.cpp
GH_ACCOUNT = snes9xgit
GH_PROJECT = snes9x
GH_TAGNAME = 1.63
+REVISION = 0

CATEGORIES = emulators games

blob - /dev/null
blob + dbc18180095569cba00697094054cf14926d2429 (mode 644)
--- /dev/null
+++ emulators/snes9x/patches/patch-gtk_src_gtk_display_driver_vulkan_cpp
@@ -0,0 +1,21 @@
+Fix build in ILP32. See
+https://github.com/KhronosGroup/Vulkan-Hpp#cc-interop-for-handles for details.
+
+Index: gtk/src/gtk_display_driver_vulkan.cpp
+--- gtk/src/gtk_display_driver_vulkan.cpp.orig
++++ gtk/src/gtk_display_driver_vulkan.cpp
+@@ -66,12 +66,12 @@ bool S9xVulkanDisplayDriver::init_imgui()
+ init_info.Device = context->device;;
+ init_info.QueueFamily = context->graphics_queue_family_index;
+ init_info.Queue = context->queue;
+- init_info.DescriptorPool = imgui_descriptor_pool.get();
++ init_info.DescriptorPool = static_cast<VkDescriptorPool>(imgui_descriptor_pool.get());
+ init_info.Subpass = 0;
+ init_info.MinImageCount = context->swapchain->get_num_frames();
+ init_info.ImageCount = context->swapchain->get_num_frames();
+ init_info.MSAASamples = VK_SAMPLE_COUNT_1_BIT;
+- ImGui_ImplVulkan_Init(&init_info, context->swapchain->get_render_pass());
++ ImGui_ImplVulkan_Init(&init_info, static_cast<VkRenderPass>(context->swapchain->get_render_pass()));
+
+ auto cmd = context->begin_cmd_buffer();
+ ImGui_ImplVulkan_CreateFontsTexture(cmd);

No comments:

Post a Comment