Skip to content

Conversation

@pato98115
Copy link
Contributor

@pato98115 pato98115 commented Dec 8, 2025

Issue #485

Summary

This PR completes the macOS port with full Cocoa windowing, keyboard/mouse input, and clipboard support. The editor is now fully functional on macOS with native platform integration.

Changes by Component

Windowing (Cocoa)

  • Added: cocoa_window.h / cocoa_window.m (NSWindow/NSView, CAMetalLayer, event polling, clipboard, cursor, asset loading, resize handling, SharedMem integration)
  • Modified: window.darwin.go (all windowing methods, cgo directives)
  • Added: window.darwin.vk.go (Vulkan surface creation)
  • Deleted: cgo_stub_darwin.m, window_darwin.go

Input System

  • Modified: keyboard.darwin.go (full macOS key mapping, Cmd→Ctrl remap)
  • Added: cocoa_window.m (modifier key detection, mouse/keyboard event processing)

File System & Dialogs

  • Modified: directory_darwin.go (directory ops)
  • Added: file_browser_overlay.go (native dialogs via osascript)

Vulkan/MoltenVK

  • Modified: vk_default_loader.c (dynamic MoltenVK loading)
  • Modified: vulkan_darwin.go (surface creation)
  • Modified: shared_mem.h, windowing.h (macOS compatibility)

Documentation

  • Modified: build_from_source.md (macOS build instructions)

Technical Details

  • Memory management: autoreleasepool, CFBridgingRetain/Release, associated objects
  • Event system: SharedMem, event queue, SET_HANDLE event, WindowDelegate
  • Platform: Cmd→Ctrl, NSCursor, NSPasteboard, NSBundle

Testing Status

  • All editor features verified: windowing, input, clipboard, dialogs, Vulkan

Current Limitations

  • Not yet implemented: fullscreen, cursor lock, raw mouse input, border manipulation

Testing Instructions:

  1. Install Xcode Command Line Tools
  2. Install Vulkan SDK
  3. Set DYLD_LIBRARY_PATH
  4. Build: cd src && CGO_ENABLED=1 go build -tags="editor" -o ../bin/kaiju
  5. Run: ../bin/kaiju

Dependencies:

  • macOS 10.15+
  • Vulkan SDK + MoltenVK
  • Xcode Command Line Tools

Closes #485

…size support

Replaces stub darwin implementation with full Cocoa/AppKit windowing system including mouse events, coordinate conversion, NSWindowDelegate-based resize handling, and DPI calculations to match Windows functionality
… editor

- Add NSEventTypeFlagsChanged handler for modifier key detection (Cmd, Ctrl, Shift, Alt)
- Map macOS Command keys to Ctrl in keyboard mapping for clipboard shortcuts
- Implement Cocoa windowing functions:
  - Clipboard operations (copy/paste with NSPasteboard)
  - Window management (position, size, title, focus, destruction)
  - Cursor variants (standard, I-beam, resize cursors)
  - Cursor visibility controls (show/hide)
  - Asset loading from application bundle
- Implement file browser native dialogs using osascript
- Fix directory operations for macOS (getcwd, file exists checks)
- Add comprehensive macOS build documentation including Vulkan SDK setup and Soloud build instructions

This enables full editor functionality on macOS with proper keyboard shortcuts (Cmd+C/V/X), clipboard integration, and native windowing behavior.
#if defined(_WIN32) || defined(_WIN64)
#include "win32.h"
#elif defined(__android__)
#elif defined(__ANDROID__)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is still a draft, but thought I'd drop this in case it was missed:

This is likely defined by the NDK, we could also make this:

#elif defined(__android__) || defined(__ANDROID__)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeap this is still a draft I'm implementing what is left for the cursor and the window stuff but I will add this too 👍

@pato98115
Copy link
Contributor Author

I'm sure this needs some polish but the best way to do this will be keep iterating actually doing games. Also idk why the tests are failing, tomorrow I will run it in a linux machine to test it

/******************************************************************************/

#if (defined(__linux__) || defined(__unix__)) && !defined(__ANDROID__)
#if (defined(__linux__) || defined(__unix__)) && !defined(__android__) || defined(__ANDROID__)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this directive will still trigger when __ANDROID__ is defined.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you! this is my bad doing some find and replace all. I will fix it in the next commit

/*
#cgo darwin CFLAGS: -DVK_USE_PLATFORM_MACOS_MVK -Wno-deprecated-declarations
#cgo darwin LDFLAGS: -F/Library/Frameworks -framework Cocoa -framework IOKit -framework IOSurface -framework QuartzCore -framework Metal -lvulkan
#cgo darwin LDFLAGS: -F/Library/Frameworks -framework Cocoa -framework IOKit -framework IOSurface -framework QuartzCore -framework Metal -L/usr/local/lib -lMoltenVK -Wl,-rpath,/usr/local/lib

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, the LDFLAGS are hardcoded. What if the developer could specify the include and library paths via CGO_CFLAGS and CGO_LDFLAGS (for example, using $VULKAN_SDK), since the Vulkan SDK might be installed in a non-standard location? This would make the build process more flexible and portable.

Example build command:
CGO_CFLAGS="-I$VULKAN_SDK/include" CGO_LDFLAGS="-L$VULKAN_SDK/lib -lMoltenVK -Wl,-rpath,$VULKAN_SDK/lib" go build -tags editor -o kaiju-editor .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can still use the env vars if you need to. Having those defaults in the go file looks sensible to me, especially since macos is standardized.

@nikpivkin
Copy link

Hi @pato98115 ! Great job!

I get the following error when building on macos arm:

rendering/vulkan/types.go:3591:31: could not determine what C.VkAccelerationStructureNVX refers to
rendering/vulkan/types.go:2878:32: could not determine what C.VkIndirectCommandsLayoutNVX refers to
rendering/vulkan/types.go:2875:21: could not determine what C.VkObjectTableNVX refers to

I'm hardly familiar with the Vulkan SDK, is NVX some kind of extension? I created dummy types for macos and the build/launch of the editor was successful.

@BrentFarris BrentFarris mentioned this pull request Dec 11, 2025
@BrentFarris
Copy link
Contributor

BrentFarris commented Dec 12, 2025

The physics library is prepared to go into the master branch, but this means y'all would need to build bullet3. I've updated the build instructions to include win/linux build steps. It'll likely be very similar to the soloud build.

Sorry for this coming in now, but I figured it'd probably be good to have the physics library ready on mac too for the merge.

@BrentFarris
Copy link
Contributor

BrentFarris commented Dec 12, 2025

Additional note, this caps-lock PR has been merged. That shouldn't require anything from the Mac port. However, there is 1 function in there that needs to be filled out (on Win, Mac, and Android still) to get the current state of the toggle keys at window creation.

@mikenye
Copy link
Contributor

mikenye commented Dec 16, 2025

Great work on your efforts to get this running on macOS!

I've managed to build and run Kaiju in debug mode on macOS 15.6.1 on arm64 by following the instructions here.

I've noticed a bug that occurs on window resize. The window goes unresponsive for a few seconds while many messages are written to the log, before it panics.

In the attached logs:

  • The first 17 lines of the log are when Kaiju is first run. While mousing over the Kaiju windows, the buttons behave correctly (update their image when moused over)
  • The window is then resized, either dragging the handles at the edge of the window, or double-clicking the title bar to maximise.
  • Lines 18 onward happen immediately after the window resize.
  • Finally, it panics on line 4966 (panic message also below).

Panic message:

panic: failed to allocate descriptor sets

goroutine 4 [running, locked to thread]:
kaiju/klib.MustReturn2[...]({0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, ...)
	/Users/mikenye/Development/github.com/pato98115/kaiju/src/klib/checks.go:63 +0x104
kaiju/rendering.(*RenderPass).setupSubpass(0x14000518b08, 0x14000232230, 0x14000282008, {0x1087b5038, 0x14000070180}, 0x1)
	/Users/mikenye/Development/github.com/pato98115/kaiju/src/rendering/vk_render_pass.go:115 +0x3d4
kaiju/rendering.(*RenderPass).Recontstruct(0x14000518b08, 0x14000282008)
	/Users/mikenye/Development/github.com/pato98115/kaiju/src/rendering/vk_render_pass.go:441 +0xed0
kaiju/rendering.(*Vulkan).remakeSwapChain(0x14000282008, {0x1087aaec0, 0x14000128408})
	/Users/mikenye/Development/github.com/pato98115/kaiju/src/rendering/renderer.vk.go:373 +0x660
kaiju/rendering.(*Vulkan).ReadyFrame(0x14000282008, {0x1087aaec0, 0x14000128408}, {0x1087ba2c0, 0x14000003a40}, {0x1087ba2c0, 0x14000003c00}, {0x140001c0008, 0x0, 0x14}, ...)
	/Users/mikenye/Development/github.com/pato98115/kaiju/src/rendering/renderer.vk.go:438 +0xc0
kaiju/engine.(*Host).Render(0x140001cc008)
	/Users/mikenye/Development/github.com/pato98115/kaiju/src/engine/host.go:487 +0x174
kaiju/engine/host_container.(*Container).Run(0x1400017e690, 0x3b0, 0x1f4, 0xffffffffffffffff, 0xffffffffffffffff, {0x0, 0x0})
	/Users/mikenye/Development/github.com/pato98115/kaiju/src/engine/host_container/host_container.go:96 +0x44c
created by kaiju/bootstrap.bootstrapLoop in goroutine 22
	/Users/mikenye/Development/github.com/pato98115/kaiju/src/bootstrap/bootstrap_game.go:90 +0x174

My system info:

Hardware Overview:

  Model Name:	MacBook Pro
  Model Identifier:	Mac16,1
  Model Number:	MCX04X/A
  Chip:	Apple M4
  Total Number of Cores:	10 (4 performance and 6 efficiency)
  Memory:	24 GB
  System Firmware Version:	11881.140.96
  OS Loader Version:	11881.140.96

Is there anything I can do to help resolve this?

kaiju_macos_output.log

@mikenye
Copy link
Contributor

mikenye commented Dec 16, 2025

Furthermore, when quitting, either in a project or at the main menu, it seems to hang at Waiting for host cleanup....

@pato98115
Copy link
Contributor Author

Hi @mikenye 👋
Thanks for trying it out — I really appreciate it.

I’ll take a look at this today after work and see if I can reproduce the issue on my side. I’m currently fixing parts of cocoa_window.m because I realized I was handling OS interactions incorrectly (I was accessing AppKit outside the main thread). I also discovered that macOS follows a different interaction model than Windows — Windows is polling-based, while macOS is event-driven — so I suspect the issue you’re seeing is related to that.

Once I push these changes, it would be great if you could try building again and let me know if the problem still happens — that would help a lot. And if you’re familiar with Objective-C, feel free to take a look at the Cocoa file and suggest improvements as well 🙂

@mikenye
Copy link
Contributor

mikenye commented Dec 16, 2025

Hi @pato98115,

Unfortunately my knowledge is limited to Go and Python, so I’m not sure I can be much help with the Objective-C code, I’m afraid. :(

However, I’ve submitted a PR to your working branch that adds macOS testing to the CI pipeline:
pato98115#2

Hopefully this is useful to you and the wider project.

I’ve also tested the workflow here:
https://github.com/mikenye/kaiju-testing/actions/runs/20268400061

It appears to be working correctly. I had to detach the fork so that I could test the action independently.

@mikenye
Copy link
Contributor

mikenye commented Dec 27, 2025

Hi all,

I have updated pato98115#2 which resolves the "crash on resize" issue discussed above.

For transparency: the additional commits from pato98115@92f5300 onwards were done with the assitance of OpenAI's Codex, so I would appreciate a review by a more experienced developer.

As discussed in the updated PR, there are still some issues with visual corrution on window resize that I am investigating but so far have been unable to pinpoint the issue.

  • During "slow" resize operations, there are some minor visual glitches
  • During "fast" resize operations, there are severe visual glitches

A screen recording is attached to this comment demonstrating the behaviour.

Screen.Recording.2025-12-27.at.11.22.25.am.mp4

@mikenye
Copy link
Contributor

mikenye commented Dec 27, 2025

Hi @pato98115 ! Great job!

I get the following error when building on macos arm:

rendering/vulkan/types.go:3591:31: could not determine what C.VkAccelerationStructureNVX refers to
rendering/vulkan/types.go:2878:32: could not determine what C.VkIndirectCommandsLayoutNVX refers to
rendering/vulkan/types.go:2875:21: could not determine what C.VkObjectTableNVX refers to

I'm hardly familiar with the Vulkan SDK, is NVX some kind of extension? I created dummy types for macos and the build/launch of the editor was successful.

Can you try building this fork & branch to see if your issue is fixed: https://github.com/mikenye/kaiju/tree/feat/mac-os-run ?

@struckchure
Copy link

Hi @pato98115 ! Great job!
I get the following error when building on macos arm:

rendering/vulkan/types.go:3591:31: could not determine what C.VkAccelerationStructureNVX refers to
rendering/vulkan/types.go:2878:32: could not determine what C.VkIndirectCommandsLayoutNVX refers to
rendering/vulkan/types.go:2875:21: could not determine what C.VkObjectTableNVX refers to

I'm hardly familiar with the Vulkan SDK, is NVX some kind of extension? I created dummy types for macos and the build/launch of the editor was successful.

Can you try building this fork & branch to see if your issue is fixed: https://github.com/mikenye/kaiju/tree/feat/mac-os-run ?

[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
panic: failed to allocate descriptor sets

goroutine 21 [running, locked to thread]:
kaiju/klib.MustReturn2[...]({0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, ...)
	/Users/mohammed/projects/kaiju/src/klib/checks.go:63 +0x104
kaiju/rendering.(*RenderPass).setupSubpass(0x140000e0c08, 0x140000c7110, 0x140001c4008, {0x10b289cb8, 0x140000cc038}, 0x1)
	/Users/mohammed/projects/kaiju/src/rendering/vk_render_pass.go:115 +0x3d4
kaiju/rendering.(*RenderPass).Recontstruct(0x140000e0c08, 0x140001c4008)
	/Users/mohammed/projects/kaiju/src/rendering/vk_render_pass.go:441 +0xec0
kaiju/rendering.(*Vulkan).remakeSwapChain(0x140001c4008, {0x10b27fc80, 0x140000fc008})
	/Users/mohammed/projects/kaiju/src/rendering/renderer.vk.go:373 +0x540
kaiju/rendering.(*Vulkan).ReadyFrame(0x140001c4008, {0x10b27fc80, 0x140000fc008}, {0x10b28eee0, 0x140000a28c0}, {0x10b28eee0, 0x140000a2a80}, {0x14000300008, 0x0, 0x14}, ...)
	/Users/mohammed/projects/kaiju/src/rendering/renderer.vk.go:438 +0x98
kaiju/engine.(*Host).Render(0x140000fa008)
	/Users/mohammed/projects/kaiju/src/engine/host.go:487 +0x158
kaiju/engine/host_container.(*Container).Run(0x140000ba360, 0x3b0, 0x1f4, 0xffffffffffffffff, 0xffffffffffffffff, {0x0, 0x0})
	/Users/mohammed/projects/kaiju/src/engine/host_container/host_container.go:96 +0x434
created by kaiju/bootstrap.bootstrapLoop in goroutine 3
	/Users/mohammed/projects/kaiju/src/bootstrap/bootstrap_game.go:90 +0x174

I got this after pulling your updates, it works well until i tried to resize, it just crashed

I'm on Apple M4, 2024

@mikenye
Copy link
Contributor

mikenye commented Dec 28, 2025

[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
panic: failed to allocate descriptor sets

goroutine 21 [running, locked to thread]:
kaiju/klib.MustReturn2[...]({0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, ...)
	/Users/mohammed/projects/kaiju/src/klib/checks.go:63 +0x104
kaiju/rendering.(*RenderPass).setupSubpass(0x140000e0c08, 0x140000c7110, 0x140001c4008, {0x10b289cb8, 0x140000cc038}, 0x1)
	/Users/mohammed/projects/kaiju/src/rendering/vk_render_pass.go:115 +0x3d4
kaiju/rendering.(*RenderPass).Recontstruct(0x140000e0c08, 0x140001c4008)
	/Users/mohammed/projects/kaiju/src/rendering/vk_render_pass.go:441 +0xec0
kaiju/rendering.(*Vulkan).remakeSwapChain(0x140001c4008, {0x10b27fc80, 0x140000fc008})
	/Users/mohammed/projects/kaiju/src/rendering/renderer.vk.go:373 +0x540
kaiju/rendering.(*Vulkan).ReadyFrame(0x140001c4008, {0x10b27fc80, 0x140000fc008}, {0x10b28eee0, 0x140000a28c0}, {0x10b28eee0, 0x140000a2a80}, {0x14000300008, 0x0, 0x14}, ...)
	/Users/mohammed/projects/kaiju/src/rendering/renderer.vk.go:438 +0x98
kaiju/engine.(*Host).Render(0x140000fa008)
	/Users/mohammed/projects/kaiju/src/engine/host.go:487 +0x158
kaiju/engine/host_container.(*Container).Run(0x140000ba360, 0x3b0, 0x1f4, 0xffffffffffffffff, 0xffffffffffffffff, {0x0, 0x0})
	/Users/mohammed/projects/kaiju/src/engine/host_container/host_container.go:96 +0x434
created by kaiju/bootstrap.bootstrapLoop in goroutine 3
	/Users/mohammed/projects/kaiju/src/bootstrap/bootstrap_game.go:90 +0x174

I got this after pulling your updates, it works well until i tried to resize, it just crashed

I'm on Apple M4, 2024

Thanks for letting me know. I thought I’d fixed the resize crash but I guess not.

I’ll have to leave it to the professionals. :-)

@nikpivkin
Copy link

Hi @pato98115 ! Great job!
I get the following error when building on macos arm:

rendering/vulkan/types.go:3591:31: could not determine what C.VkAccelerationStructureNVX refers to
rendering/vulkan/types.go:2878:32: could not determine what C.VkIndirectCommandsLayoutNVX refers to
rendering/vulkan/types.go:2875:21: could not determine what C.VkObjectTableNVX refers to

I'm hardly familiar with the Vulkan SDK, is NVX some kind of extension? I created dummy types for macos and the build/launch of the editor was successful.

Can you try building this fork & branch to see if your issue is fixed: mikenye/kaiju@feat/mac-os-run ?

Yes, it solves my problem!

@struckchure
Copy link

struckchure commented Dec 29, 2025

Hi @pato98115 ! Great job!
I get the following error when building on macos arm:

rendering/vulkan/types.go:3591:31: could not determine what C.VkAccelerationStructureNVX refers to
rendering/vulkan/types.go:2878:32: could not determine what C.VkIndirectCommandsLayoutNVX refers to
rendering/vulkan/types.go:2875:21: could not determine what C.VkObjectTableNVX refers to

I'm hardly familiar with the Vulkan SDK, is NVX some kind of extension? I created dummy types for macos and the build/launch of the editor was successful.

Can you try building this fork & branch to see if your issue is fixed: https://github.com/mikenye/kaiju/tree/feat/mac-os-run ?

[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
[mvk-error] VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain does not match the VkSwapchain that is in use by the surface
panic: failed to allocate descriptor sets

goroutine 21 [running, locked to thread]:
kaiju/klib.MustReturn2[...]({0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, ...)
	/Users/mohammed/projects/kaiju/src/klib/checks.go:63 +0x104
kaiju/rendering.(*RenderPass).setupSubpass(0x140000e0c08, 0x140000c7110, 0x140001c4008, {0x10b289cb8, 0x140000cc038}, 0x1)
	/Users/mohammed/projects/kaiju/src/rendering/vk_render_pass.go:115 +0x3d4
kaiju/rendering.(*RenderPass).Recontstruct(0x140000e0c08, 0x140001c4008)
	/Users/mohammed/projects/kaiju/src/rendering/vk_render_pass.go:441 +0xec0
kaiju/rendering.(*Vulkan).remakeSwapChain(0x140001c4008, {0x10b27fc80, 0x140000fc008})
	/Users/mohammed/projects/kaiju/src/rendering/renderer.vk.go:373 +0x540
kaiju/rendering.(*Vulkan).ReadyFrame(0x140001c4008, {0x10b27fc80, 0x140000fc008}, {0x10b28eee0, 0x140000a28c0}, {0x10b28eee0, 0x140000a2a80}, {0x14000300008, 0x0, 0x14}, ...)
	/Users/mohammed/projects/kaiju/src/rendering/renderer.vk.go:438 +0x98
kaiju/engine.(*Host).Render(0x140000fa008)
	/Users/mohammed/projects/kaiju/src/engine/host.go:487 +0x158
kaiju/engine/host_container.(*Container).Run(0x140000ba360, 0x3b0, 0x1f4, 0xffffffffffffffff, 0xffffffffffffffff, {0x0, 0x0})
	/Users/mohammed/projects/kaiju/src/engine/host_container/host_container.go:96 +0x434
created by kaiju/bootstrap.bootstrapLoop in goroutine 3
	/Users/mohammed/projects/kaiju/src/bootstrap/bootstrap_game.go:90 +0x174

I got this after pulling your updates, it works well until i tried to resize, it just crashed

I'm on Apple M4, 2024

This worked, i just tried adding ld flags and enabling cgo

@mikenye

@mikenye
Copy link
Contributor

mikenye commented Dec 29, 2025

This worked, i just tried adding ld flags and enabling cgo

@mikenye

That’s great!

@mikenye
Copy link
Contributor

mikenye commented Dec 29, 2025

This worked, i just tried adding ld flags and enabling cgo

@mikenye

Are you seeing the glitches when resizing as-per here: #489 (comment) ?

@struckchure
Copy link

This worked, i just tried adding ld flags and enabling cgo
@mikenye

Are you seeing the glitches when resizing as-per here: #489 (comment) ?

Yes, it's like that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add MacOS support

6 participants