Skip to content

BO3: HDR10 - #224

Draft
XgarhontX wants to merge 5 commits into
Filoppi:mainfrom
XgarhontX:bo3-3
Draft

XgarhontX wants to merge 5 commits into
Filoppi:mainfrom
XgarhontX:bo3-3

Conversation

@XgarhontX

@XgarhontX XgarhontX commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Though no conflicts, it's NOT mergeable!

  • I need changes to core.hpp for this.
  • It's currently wonky and is a suboptimal solution.

Primary Need

  • Overrides to OnPresent() execution for custom Display Composition.

How I'm handling HDR10

  • (This might be how RenoDX does it?)
  • Whenever rgba10a2 backbuffer is used as RTV (i.e. a bunch of UI pixel shaders), swap it out for a rgba16f (or 11/10f) resource so it can draw with blending in gamma & not clip.
  • OnPresent()'s Display Composition will bind that rgba16f as SRV, drawing to original rgba10a2 backbuffer as RTV, which is when PQ finally encodes, ready for HDR10 present.

Changes: game.h

  • A new overridable function.
// This is called every frame on present, just before drawing Display Composition.
virtual void OnBeforeDisplayComposition(ID3D11Device* native_device, ID3D11DeviceContext* native_device_context, DeviceData& device_data) {}

Changes: core.hpp

  • Call the new function right before Display Composition draws in OnPresent().
game->OnBeforeDisplayComposition(native_device, native_device_context, device_data);
DrawCustomPixelShader(native_device_context, device_data.default_depth_stencil_state.get(), device_data.default_blend_state.get(), nullptr, device_data.native_vertex_shaders[CompileTimeStringHash("Copy VS")].get(), device_data.native_pixel_shaders[CompileTimeStringHash("Display Composition")].get(), device_data.display_composition_srv.get(), target_resource_texture_view.get(), target_desc.Width, target_desc.Height, false);

OnBeforeDisplayComposition() example

  • Bad: Since OnPresent() found and bound the new 16f, I have to unbind to rebind it correctly.
  • Bad: There's also a wasted CopyResource() call prior that can't be accessed here.
  • I've already replaced native shaders with my custom Display Composition which reads from SRV10.
    • Also, DEVELOPMENT has option to restore default for Frame Capture debug views.
static void OnBeforeDisplayComposition(ID3D11Device* native_device, ID3D11DeviceContext* native_device_context, DeviceData& device_data, CallOfDutyBlackOps3GameDeviceData& game_device_data)
{
  if (IsHDR10())
  {
     // clear RTV0 (avoid bind conflicts)
     constexpr ID3D11RenderTargetView* rtv0 = nullptr;
     native_device_context->OMSetRenderTargets(1, &rtv0, nullptr);

     // clear SRV0 (avoid bind conflicts)
     constexpr ID3D11ShaderResourceView* srv0 = nullptr;
     native_device_context->PSSetShaderResources(0, 1, &srv0);

     // set our 16f backbuffer to SRV
     native_device_context->PSSetShaderResources(10, 1, &Resources::backbuffer_srv); // DisplayComposition is custom
  }
}

So what's next?

  • Idk how much you want to allow game projects to intercept edit/tweak OnPresent() execution. Stopping inefficiencies like the wasted CopyResource() would need more.
  • The only other way I can think of is subscribing another OnPresent() ReShade event, which makes my mess at least self-contained.

@Filoppi

Filoppi commented Oct 3, 2026

Copy link
Copy Markdown
Owner

I am adding HDR10 to Luma for all games very soon

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.

2 participants