imgui icon indicating copy to clipboard operation
imgui copied to clipboard

DX12 backend can't render into a multisampled frame buffer

Open zixin96 opened this issue 1 year ago • 3 comments

Version/Branch of Dear ImGui:

Version 1.90.8, Branch: master (no modifications)

Back-ends:

imgui_impl_win32.cpp + imgui_impl_dx12.cpp

Compiler, OS:

Windows 11 + MSVC 2022

Details:

Similar to this closed issue https://github.com/ocornut/imgui/issues/2705#issue-475051495, I think DX12 backend can't render into a multisampled frame buffer too. I tried to incorporate IMGUI into my dx12 MSAA demo that got these kinds of errors: D3D12 ERROR: ID3D12CommandList::DrawIndexedInstanced: The render target sample desc in slot 0 does not match that specified by the current pipeline state.(pipeline state = count 1 quality 0, render target view = count 4 quality 0, ID3D12Resource* = 0x000001B5709919C0:'MSAA Render Target') [ EXECUTION ERROR #614: RENDER_TARGET_SAMPLE_DESC_MISMATCH_PIPELINE_STATE]. A quick search reveals that SampleDesc.Count is set to 1 for all its occurrences in imgui_impl_dx12.cpp. Is this something we'd like to do? Thanks.

zixin96 avatar Jun 18 '24 17:06 zixin96

Can you confirm which occurrences of SamplerDesc.Count are required to be changed?

We should probably start converging toward a similar solution as the Vulkan backend, where user on Init provide a struct with various information needed to match your render target. But we need to take account of the fact that secondary viewports created (in the docking branch) may use a different set of settings (those may always be Count == 1).

ocornut avatar Jun 18 '24 18:06 ocornut

Ping @zixin96

Can you confirm which occurrences of SamplerDesc.Count are required to be changed?

ocornut avatar Jul 22 '24 12:07 ocornut

Hello, Im using VS2022 and DX12. I can confirm this problem still exists on v1.91.9. I just integrated MSAA into my 3d engine, and when I use ImGui render, I get the same error in the output. Disabling ImGui, this error dissapear. I think that for ImGui there should be a way to add/change the ability to define and change the number of samples for MSAA if its enabled, something like (mMsaaEnabled ? mMsaaSampleCount : 1);,

Btw. I have to thank you for this incredibly great tool! Keep working on this!! <3

3dEngineGuy avatar Mar 15 '25 19:03 3dEngineGuy

I also just ran into this, it should be this line I think: https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_dx12.cpp#L655

Colliflower avatar Aug 04 '25 21:08 Colliflower