@@ -350,6 +350,7 @@ typedef struct
350350 {
351351 dxgi_hdr_uniform_t ubo_values ;
352352 D3D11Buffer ubo ;
353+ float menu_nits ;
353354 float max_output_nits ;
354355 float min_output_nits ;
355356 float max_cll ;
@@ -411,7 +412,6 @@ typedef struct
411412#ifdef HAVE_DXGI_HDR
412413 unsigned hdr_mode ;
413414 float paper_white_nits ;
414- float max_nits ;
415415 unsigned expand_gamut ;
416416 float scanlines ;
417417 unsigned subpixel_layout ;
@@ -1576,13 +1576,12 @@ static void d3d11_render_overlay(d3d11_video_t *d3d11)
15761576#endif
15771577
15781578#ifdef HAVE_DXGI_HDR
1579- static void d3d11_set_hdr_max_nits (void * data , float max_nits )
1579+ static void d3d11_set_hdr_menu_nits (void * data , float menu_nits )
15801580{
15811581 D3D11_MAPPED_SUBRESOURCE mapped_ubo ;
15821582 d3d11_video_t * d3d11 = (d3d11_video_t * )data ;
15831583
1584- d3d11 -> hdr .max_output_nits = max_nits ;
1585- d3d11 -> hdr .ubo_values .max_nits = max_nits ;
1584+ d3d11 -> hdr .menu_nits = menu_nits ;
15861585
15871586 d3d11 -> context -> lpVtbl -> Map (
15881587 d3d11 -> context , (D3D11Resource )d3d11 -> hdr .ubo , 0 , D3D11_MAP_WRITE_NO_OVERWRITE , 0 , & mapped_ubo );
@@ -1591,20 +1590,6 @@ static void d3d11_set_hdr_max_nits(void *data, float max_nits)
15911590 * ubo = d3d11 -> hdr .ubo_values ;
15921591 }
15931592 d3d11 -> context -> lpVtbl -> Unmap (d3d11 -> context , (D3D11Resource )d3d11 -> hdr .ubo , 0 );
1594-
1595- /* Do NOT update display HDR metadata here. max_nits is an internal
1596- * shader parameter (InverseTonemap target), not the actual mastering
1597- * display luminance. Sending it as MaxMasteringLuminance causes the
1598- * display's tone mapper to switch modes every time the user moves the
1599- * slider, producing color shifts and delays. */
1600-
1601- if (d3d11 -> shader_preset )
1602- {
1603- for (unsigned i = 0 ; i < d3d11 -> shader_preset -> passes ; i ++ )
1604- {
1605- d3d11 -> pass [i ].max_nits = max_nits ;
1606- }
1607- }
16081593}
16091594
16101595static void d3d11_set_hdr_paper_white_nits (void * data , float paper_white_nits )
@@ -1989,7 +1974,6 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const
19891974#ifdef HAVE_DXGI_HDR
19901975 & d3d11 -> pass [i ].hdr_mode , /* HDRMode */
19911976 & d3d11 -> pass [i ].paper_white_nits ,/* PaperWhiteNits */
1992- & d3d11 -> pass [i ].max_nits , /* MaxNits */
19931977 & d3d11 -> pass [i ].scanlines , /* Scanlines */
19941978 & d3d11 -> pass [i ].subpixel_layout , /* SubpixelLayout */
19951979 & d3d11 -> pass [i ].expand_gamut , /* ExpandGamut */
@@ -2632,7 +2616,7 @@ static void *d3d11_gfx_init(const video_info_t* video,
26322616 DXGICreateFactory1 (& d3d11 -> factory );
26332617#endif
26342618#ifdef HAVE_DXGI_HDR
2635- d3d11 -> hdr .max_output_nits = settings -> floats . video_hdr_max_nits ;
2619+ d3d11 -> hdr .max_output_nits = 1000.0f ;
26362620 d3d11 -> hdr .min_output_nits = 0.001f ;
26372621 d3d11 -> hdr .max_cll = 0.0f ;
26382622 d3d11 -> hdr .max_fall = 0.0f ;
@@ -2738,8 +2722,8 @@ static void *d3d11_gfx_init(const video_info_t* video,
27382722 d3d11 -> hdr .ubo_values .source_size .height = 0.0f ;
27392723 d3d11 -> hdr .ubo_values .output_size .width = d3d11 -> frame .output_size .x ;
27402724 d3d11 -> hdr .ubo_values .output_size .height = d3d11 -> frame .output_size .y ;
2741- d3d11 -> hdr .ubo_values . max_nits =
2742- settings -> floats .video_hdr_max_nits ;
2725+ d3d11 -> hdr .menu_nits =
2726+ settings -> floats .video_hdr_menu_nits ;
27432727 d3d11 -> hdr .ubo_values .paper_white_nits =
27442728 settings -> floats .video_hdr_paper_white_nits ;
27452729 d3d11 -> hdr .ubo_values .scanlines =
@@ -3688,7 +3672,6 @@ static bool d3d11_gfx_frame(
36883672 if (d3d11 -> flags & D3D11_ST_FLAG_HDR_ENABLE )
36893673 {
36903674 d3d11 -> pass [i ].paper_white_nits = settings -> floats .video_hdr_paper_white_nits ;
3691- d3d11 -> pass [i ].max_nits = settings -> floats .video_hdr_max_nits ;
36923675 d3d11 -> pass [i ].scanlines = settings -> bools .video_hdr_scanlines ? 1.0f : 0.0f ;
36933676 d3d11 -> pass [i ].subpixel_layout = settings -> uints .video_hdr_subpixel_layout ;
36943677 d3d11 -> pass [i ].expand_gamut = settings -> uints .video_hdr_expand_gamut ;
@@ -4171,9 +4154,13 @@ static bool d3d11_gfx_frame(
41714154 const float prev_inverse_tonemap = d3d11 -> hdr .ubo_values .inverse_tonemap ;
41724155 const float prev_hdr10 = d3d11 -> hdr .ubo_values .hdr10 ;
41734156 const unsigned prev_hdr_mode = d3d11 -> hdr .ubo_values .hdr_mode ;
4157+ const float prev_paper_white_nits = d3d11 -> hdr .ubo_values .paper_white_nits ;
41744158
41754159 d3d11 -> hdr .ubo_values .scanlines = 0.0f ;
41764160
4161+ /* Menu/overlay composite: use menu_nits for SDR menu brightness */
4162+ d3d11 -> hdr .ubo_values .paper_white_nits = d3d11 -> hdr .menu_nits ;
4163+
41774164 if (video_info -> hdr_mode == 2 ) /* scRGB: menu source is SDR */
41784165 {
41794166 d3d11 -> hdr .ubo_values .inverse_tonemap = 0.0f ;
@@ -4203,6 +4190,7 @@ static bool d3d11_gfx_frame(
42034190 d3d11 -> hdr .ubo_values .inverse_tonemap = prev_inverse_tonemap ;
42044191 d3d11 -> hdr .ubo_values .hdr10 = prev_hdr10 ;
42054192 d3d11 -> hdr .ubo_values .hdr_mode = prev_hdr_mode ;
4193+ d3d11 -> hdr .ubo_values .paper_white_nits = prev_paper_white_nits ;
42064194 }
42074195
42084196 context -> lpVtbl -> VSSetConstantBuffers (context , 0 , 1 , & d3d11 -> hdr .ubo );
@@ -4698,13 +4686,13 @@ static const video_poke_interface_t d3d11_poke_interface = {
46984686 NULL , /* get_current_software_framebuffer */
46994687 d3d11_get_hw_render_interface ,
47004688#ifdef HAVE_DXGI_HDR
4701- d3d11_set_hdr_max_nits ,
4689+ d3d11_set_hdr_menu_nits ,
47024690 d3d11_set_hdr_paper_white_nits ,
47034691 d3d11_set_hdr_expand_gamut ,
47044692 d3d11_set_hdr_scanlines ,
47054693 d3d11_set_hdr_subpixel_layout
47064694#else
4707- NULL, /* set_hdr_max_nits */
4695+ NULL, /* set_hdr_menu_nits */
47084696 NULL , /* set_hdr_paper_white_nits */
47094697 NULL , /* set_hdr_expand_gamut */
47104698 NULL , /* set_hdr_scanlines */
0 commit comments