mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 13:09:57 -04:00
Fix shadows, colour writes and present pacing on drivers that read Vulkan's undefined cases differently.
A depth-compare read through a sampler whose compare is off now gets the slot's comparing sampler, as the Switch compares there and only NVIDIA's driver did so on its own. Colour components a fragment shader does not write are masked out, as Maxwell leaves them alone. Without mailbox presentation the swapchain takes relaxed FIFO, or immediate, so a late frame no longer halves the frame rate. NX2NAVI_VK_NOOPT=1 builds pipelines without the driver's optimiser, for a driver whose compiler fails on one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -256,13 +256,23 @@ static VkPresentModeKHR pick_present_mode(VkPhysicalDevice pd) {
|
||||
if (n > 16) n = 16;
|
||||
vkGetPhysicalDeviceSurfacePresentModesKHR(pd, g_surface, &n, m);
|
||||
VkPresentModeKHR got = VK_PRESENT_MODE_FIFO_KHR;
|
||||
for (uint32_t i = 0; i < n; i++) if (m[i] == want) got = want;
|
||||
int relaxed = 0, immediate = 0;
|
||||
for (uint32_t i = 0; i < n; i++) {
|
||||
if (m[i] == want) got = want;
|
||||
relaxed |= m[i] == VK_PRESENT_MODE_FIFO_RELAXED_KHR, immediate |= m[i] == VK_PRESENT_MODE_IMMEDIATE_KHR;
|
||||
}
|
||||
// Mailbox missing (several AMD drivers): plain FIFO holds a frame that misses a refresh to the next one, and the
|
||||
// game, paced at 60 on a 60 Hz display, drops to 30 at every slow frame. Relaxed FIFO shows a late frame at once
|
||||
// (a tear that once) and waits for the refresh otherwise; immediate where that is missing too.
|
||||
if (want == VK_PRESENT_MODE_MAILBOX_KHR && got != want)
|
||||
got = relaxed ? VK_PRESENT_MODE_FIFO_RELAXED_KHR : immediate ? VK_PRESENT_MODE_IMMEDIATE_KHR : got;
|
||||
const char *name = got == VK_PRESENT_MODE_MAILBOX_KHR ? "mailbox" : got == VK_PRESENT_MODE_IMMEDIATE_KHR ? "immediate" : "fifo";
|
||||
__atomic_store_n(&g_present_got, name, __ATOMIC_RELEASE);
|
||||
static int logged = -1; // the mode last logged: a change from the menu shows in the log
|
||||
if ((int)got != logged) {
|
||||
logged = (int)got;
|
||||
rt_log("gfx: present mode %s (NX2NAVI_VK_PRESENT=%s)", name, e);
|
||||
rt_log("gfx: present mode %s (NX2NAVI_VK_PRESENT=%s)",
|
||||
got == VK_PRESENT_MODE_FIFO_RELAXED_KHR ? "fifo relaxed" : name, e);
|
||||
}
|
||||
return got;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user