ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
57.81k stars 9.91k forks source link

DX12 backend can't render into a multisampled frame buffer #7708

Open zixin96 opened 2 weeks ago

zixin96 commented 2 weeks ago

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.

ocornut commented 2 weeks ago

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).