mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 21:39:58 -04:00
Change a setting with the mouse only on the two framed arrows beside its value, and switch HDR without a restart.
In the settings menu a click anywhere on a row stepped its setting to the next value, and the left arrow stood left of the value's text, so it moved whenever a value of another width came up: clicking the left arrow through a list landed on the row at the second click and stepped the other way. Each stepper now has its arrows in white frames at fixed places, the left one the width of the row's widest value from the right one, and the mouse changes the value on those frames only; a click on the rest of the row selects it. On and off rows have the same arrows. An arrow at the end of its values is drawn faint and does nothing, and a button held on an arrow repeats as a held key does. A, Enter and left and right work as before. NX2NAVI_MENU_TEST_CLICK clicks rows by their setting's name during a menu test run. On an RX 7900 XT at 3232x1352 the arrows stepped the performance overlay one value a click and stopped at both ends, and clicks on the body of four rows changed nothing. HDR between off and the tone mapper now follows the menu. The HDR path is set up at every start (vk_hdr_armed): the swapchain colour space and metadata extensions, the tonemap splice and the settings in the support buffer, with the spliced tonemap returning the game's own SDR result while the swapchain is SDR. A change of the setting makes the swapchain again in the other format. On the same card a run that started with HDR off went to an HDR10 swapchain and back, and one that started with HDR on went to SDR and back, with the picture right in each state. The game's native HDR still waits for a restart, as the game asks about the display once, and the row says so. NX2NAVI_HDR_LIVE = 0 leaves the HDR path out of a run that starts with HDR off. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -238,7 +238,8 @@ int gfx_window_focused(void) { return g_focused; }
|
||||
unsigned gfx_window_focus_messages(void) { return (unsigned)g_focus_msgs; }
|
||||
|
||||
// Present path (g_pl held): a settings change (cfg_version) reaches the window thread, which applies a changed size or
|
||||
// fullscreen; a changed NX2NAVI_VK_PRESENT rebuilds the swapchain at this present.
|
||||
// fullscreen; a changed NX2NAVI_VK_PRESENT or NX2NAVI_HDR rebuilds the swapchain at this present.
|
||||
static int g_sc_hdr_wanted; // vk_hdr_wanted when the swapchain was made (create_swapchain)
|
||||
static void window_settings_live(void) {
|
||||
static unsigned seen;
|
||||
static int started;
|
||||
@@ -253,6 +254,9 @@ static void window_settings_live(void) {
|
||||
if (started) plat_xchg32(&g_dirty, 1);
|
||||
}
|
||||
if (started && vk_fg_wanted() != vk_fg_active()) plat_xchg32(&g_dirty, 1); // frame generation switched: its own swapchain
|
||||
// HDR switched in the menu: a swapchain of the other format. Compared with what the swapchain was made for, not
|
||||
// with what it got: on a display without HDR10 the setting stays on and the swapchain SDR, and that is settled.
|
||||
if (started && vk_hdr_wanted() != g_sc_hdr_wanted) plat_xchg32(&g_dirty, 1);
|
||||
ov_operation_mode_live();
|
||||
if (started) gfx_window_apply_settings();
|
||||
started = 1;
|
||||
@@ -362,7 +366,8 @@ static int create_swapchain(void) {
|
||||
if (!nf) return plat_xchg32(&g_dirty, 1), 0;
|
||||
// UNORM: the blit writes the bytes the game wrote (no sRGB encode). NX2NAVI_HDR: HDR10 when the surface offers it.
|
||||
VkSurfaceFormatKHR sf = fmts[0];
|
||||
int hdr = vk_hdr_surface_format(fmts, nf, &sf), found = hdr;
|
||||
g_sc_hdr_wanted = vk_hdr_wanted();
|
||||
int hdr = g_sc_hdr_wanted && vk_hdr_surface_format(fmts, nf, &sf), found = hdr;
|
||||
for (uint32_t i = 0; i < nf && !found; i++)
|
||||
if (fmts[i].format == VK_FORMAT_B8G8R8A8_UNORM && fmts[i].colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR) { sf = fmts[i]; found = 1; }
|
||||
for (uint32_t i = 0; i < nf && !found; i++)
|
||||
@@ -428,6 +433,10 @@ static int create_swapchain(void) {
|
||||
drop_swapchain_locked(c);
|
||||
g_sc = made;
|
||||
g_sc_fmt = sf.format;
|
||||
static int hdr_was = -1; // the log says when a later swapchain is of the other kind (the menu's HDR row)
|
||||
if (hdr_was >= 0 && hdr_was != hdr)
|
||||
rt_log("gfx: the swapchain is now %s (format %d)", hdr ? "HDR10" : "SDR", (int)sf.format);
|
||||
hdr_was = hdr;
|
||||
g_sc_hdr = hdr;
|
||||
vk_hdr_set_active(hdr);
|
||||
if (hdr) vk_hdr_metadata(g_sc, 1);
|
||||
|
||||
Reference in New Issue
Block a user