mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-08 08:10:30 -10:00
d3d12: fix black menu background in HDR10 mode (menu composite double-encoded)
Narrowed by the observation that scRGB HDR works and only HDR10 shows the black menu background. The two back_buffer->swapchain composites disagreed: - the non-menu game-frame composite documents that in HDR10 mode the back buffer is ALREADY PQ-encoded by the stock HDR pass, so it uses pure passthrough (inverse_tonemap=0, hdr10=0, hdr_mode=0); - the menu/overlay composite instead applied inverse_tonemap=1, hdr10=1 in HDR10 mode - a second PQ encode of already-PQ data, which drives the whole background to black. scRGB was unaffected because its menu path uses hdr_mode=2. My earlier attempt gated the passthrough on SOURCE_HDR10 (core-supplied PQ), but that was too narrow: in HDR10 display mode the back buffer is PQ-encoded regardless of the core's pixel format, because the stock pass encodes it. So the menu composite must pass through for ALL HDR10, matching the game-frame composite exactly. Make the HDR10 branch passthrough; leave the working scRGB branch (hdr_mode=2) untouched. Together with the previous commit (render the core frame into back_buffer when a menu/overlay is up so the composite has content), this restores the dimmed core frame behind the menu in HDR10 mode. Can't run D3D here; the on-hardware check is that HDR10 now shows the background like scRGB already does.
This commit is contained in:
1 parent
c478fd486e
commit
4f1035059a
1 file changed
+6
-13
+6
-13
@@ -6007,24 +6007,17 @@ static bool d3d12_gfx_frame(
|
||||
d3d12->hdr.ubo_values.hdr10 = 0.0f;
|
||||
d3d12->hdr.ubo_values.hdr_mode = 2;
|
||||
}
|
||||
else if (d3d12->flags & D3D12_ST_FLAG_SOURCE_HDR10)
|
||||
else /* HDR10: the back buffer is already PQ-encoded (the stock HDR
|
||||
* pass wrote it), so pass it straight through. Re-encoding it
|
||||
* here (inverse_tonemap/hdr10) is a second PQ encode and drives
|
||||
* the whole menu background to black. This mirrors the
|
||||
* non-menu game-frame composite above. The menu glyphs are
|
||||
* drawn separately as SDR sprites and are unaffected. */
|
||||
{
|
||||
/* The core supplies PQ frames, so the back buffer already holds
|
||||
* PQ-encoded HDR10: pass it through unchanged. Encoding it a
|
||||
* second time (as the SDR-menu path below does) drives the whole
|
||||
* background to black. inverse_tonemap=0, hdr10=0, hdr_mode=0
|
||||
* selects the shader's pure-passthrough branch. The menu glyphs
|
||||
* are drawn separately as SDR sprites and are unaffected. */
|
||||
d3d12->hdr.ubo_values.inverse_tonemap = 0.0f;
|
||||
d3d12->hdr.ubo_values.hdr10 = 0.0f;
|
||||
d3d12->hdr.ubo_values.hdr_mode = 0;
|
||||
}
|
||||
else /* HDR10 */
|
||||
{
|
||||
d3d12->hdr.ubo_values.inverse_tonemap = 1.0f;
|
||||
d3d12->hdr.ubo_values.hdr10 = 1.0f;
|
||||
d3d12->hdr.ubo_values.hdr_mode = 0;
|
||||
}
|
||||
|
||||
{
|
||||
dxgi_hdr_uniform_t* mapped_ubo;
|
||||
|
||||
Reference in new issue
Block a user