Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix D3D12 Debug Layer warning if scissor rect is 0 width or 0 height #3472

Closed
wants to merge 1 commit into from
Closed

Conversation

StoneWolf
Copy link
Contributor

In the event where the scissor rect is 0 width or 0 height, don't call Draw, as it generates warnings if the D3D12 Debug Layer is enabled, and nothing would have been drawn anyway.

Here's the warning that was being emitted:
D3D12 WARNING: ID3D12CommandList::DrawIndexedInstanced: Viewport: 0 is non-empty while the corresponding scissor rectangle is empty. Nothing will be written to the render target when this viewport is selected. In D3D12, scissor testing is always enabled. [ EXECUTION WARNING #695: DRAW_EMPTY_SCISSOR_RECTANGLE]

In the event where the scissor rect is 0 width or 0 height, don't call Draw, as it generates warnings if the D3D12 Debug Layer is enabled, and nothing would have been drawn anyway.
@ocornut
Copy link
Owner

ocornut commented Sep 15, 2020 via email

@StoneWolf
Copy link
Contributor Author

StoneWolf commented Sep 15, 2020

I managed to create a simple repro. I should add that the bug happens on all three versions I tested (v1.78, latest zip from master and latest zip from the docking branch).

Easiest way to reproduce the bug is by using your example_win32_directx12 project:
In main.cpp, add after ImGui::NewFrame():

if (ImGui::Begin("Repro"))
{
    ImGui::BeginChild("Repro", ImVec2(150, 0), true);
    ImGui::EndChild();
}
ImGui::End();

Then drag the window all the way down and you should see the warnings appear. BeginChild/EndChild seem to be the culprits, since commenting them makes the warning go away.

ocornut added a commit that referenced this pull request Sep 16, 2020
…face is enabled. (#3462, #3472) + misc comments & minor fixes.
ocornut pushed a commit that referenced this pull request Sep 16, 2020
…dth or 0 height. (#3472, #3462)

In the event where the scissor rect is 0 width or 0 height, don't call Draw, as it generates warnings if the D3D12 Debug Layer is enabled, and nothing would have been drawn anyway.
@ocornut
Copy link
Owner

ocornut commented Sep 16, 2020

Thank you @StoneWolf this is now merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants