Skip to content

vulkan: clamp framebuffers to device limits on macOS - #775

Open
shpontex wants to merge 1 commit into
Eglantine-Community:nx2-experimentalfrom
shpontex:fix/macos-oot-framebuffer-limits
Open

shpontex wants to merge 1 commit into
Eglantine-Community:nx2-experimentalfrom
shpontex:fix/macos-oot-framebuffer-limits

Conversation

@shpontex

@shpontex shpontex commented Nov 8, 2026

Copy link
Copy Markdown
  • I have read and followed the Contribution Guidelines.
  • I have read and followed the AI Policy.
  • I have read and followed the Coding Guidelines to the best of my ability.
  • I have put [HUMANMADE] in the title if the pr was human-mande

Summary

On macOS/MoltenVK, Ocarina of Time crashed after the intro with Lost VkDevice /
Internal Error. Attachment-less draws used a 32768x32768 framebuffer from the
surface clip; Apple GPUs only allow 16384. This clamps framebuffer width/height/layers
to the device limits, and pads the Vulkan stream buffer by 64 KiB so Metal constant-buffer
reads near the end stay in bounds.

Ported from Lichii#427 / diagnosis in Lichii#237.

Assisted-by: Cursor (ported Lichii#427 / diagnosed crash)

Type of change

  • Bug fix
  • Game compatibility / game-support
  • Performance
  • New feature
  • Refactor / cleanup
  • CI / build
  • Documentation

Related issues

Related to #732
Based on zortos293/Lichii#427

Testing

  • Tested on Windows
  • Tested on Linux
  • Tested on macOS
  • Tested on NVIDIA
  • Tested on AMD
  • Tested on Intel

Games tested:

The Legend of Zelda: Ocarina of Time (0400486024DEC000) on Apple M2 Pro / MoltenVK:
no longer crashes after the intro into 3D. FPS still low (~5), expected on current macOS.

Checklist

  • I built it locally and it compiles without new warnings
  • I did not add any copyrighted game data, keys or firmware
  • Docs updated if needed
  • I added AI Disclosure if one was used

Screenshots / logs

Before: abort with
VK_ERROR_OUT_OF_DEVICE_MEMORY: Lost VkDevice ... Internal Error (0000010c)
after the intro.

After: reaches 3D gameplay without device loss.

OoT leaves attachment-less draws at 32768x32768; Apple GPUs max out at
16384 and Metal loses the device after the intro. Also pad the stream
buffer by 64 KiB so Metal cbuf reads near the end stay in bounds.

Assisted-by: Cursor (ported Lichii#427 / diagnosed crash)
@github-actions
github-actions Bot changed the base branch from nx2 to nx2-experimental November 8, 2026 15:06
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

Retargeted to nx2-experimental for pre-build testing. It will be promoted to nx2 after validation.

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.

1 participant