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

D3D1211On12 logs warnings by default #838

Open
MarkSchofield opened this issue Aug 20, 2023 · 2 comments
Open

D3D1211On12 logs warnings by default #838

MarkSchofield opened this issue Aug 20, 2023 · 2 comments
Labels
question sdklayers Direct3D SDK Layer messages

Comments

@MarkSchofield
Copy link

Running the Debug build the 'D3D1211On12' sample under a debugger shows multiple warnings:

D3D12 WARNING: ID3D12Device::CreateCommittedResource: Ignoring InitialState D3D12_RESOURCE_STATE_GENERIC_READ. Buffers are effectively created in state D3D12_RESOURCE_STATE_COMMON. [ STATE_CREATION WARNING #1328: CREATERESOURCE_STATE_IGNORED]
D3D12 WARNING: ID3D12Device::CreateCommittedResource: Ignoring InitialState D3D12_RESOURCE_STATE_GENERIC_READ. Buffers are effectively created in state D3D12_RESOURCE_STATE_COMMON. [ STATE_CREATION WARNING #1328: CREATERESOURCE_STATE_IGNORED]
D2D DEBUG WARNING - A call to deprecated API ID2D1Factory::GetDesktopDpi was made. This is not recommended. Instead, DisplayProperties::LogicalDpi should be used for Windows Store apps and GetDpiForWindow should be used for Win32 apps.
D3D12 WARNING: ID3D12Device::CreateCommittedResource: Ignoring InitialState D3D12_RESOURCE_STATE_COPY_DEST. Buffers are effectively created in state D3D12_RESOURCE_STATE_COMMON. [ STATE_CREATION WARNING #1328: CREATERESOURCE_STATE_IGNORED]
D3D12 WARNING: ID3D12Device::CreateCommittedResource: Ignoring InitialState D3D12_RESOURCE_STATE_GENERIC_READ. Buffers are effectively created in state D3D12_RESOURCE_STATE_COMMON. [ STATE_CREATION WARNING #1328: CREATERESOURCE_STATE_IGNORED]
D3D12 WARNING: ID3D12Device::CreateCommittedResource: Ignoring InitialState D3D12_RESOURCE_STATE_GENERIC_READ. Buffers are effectively created in state D3D12_RESOURCE_STATE_COMMON. [ STATE_CREATION WARNING #1328: CREATERESOURCE_STATE_IGNORED]
D3D12 WARNING: ID3D12Device::CreateCommittedResource: Ignoring InitialState D3D12_RESOURCE_STATE_GENERIC_READ. Buffers are effectively created in state D3D12_RESOURCE_STATE_COMMON. [ STATE_CREATION WARNING #1328: CREATERESOURCE_STATE_IGNORED]

The warnings look like they're caused by the 11-on-12 implementation, not the sample, but it's not clear. It would be great if the sample was 'warning clean', otherwise it's difficult to turn warnings on to help diagnose issues in my own code.

@GameDreamByHuo
Copy link

GameDreamByHuo commented Aug 20, 2023 via email

@amisner2k
Copy link

I can add to the evidence that these warnings do seem to be caused by Direct2D through the 11On12Device implementation.

In my own separate project, I started by manually integrating 11On12 by following the guide on MSDN docs and rendering some text to the screen. After I got it all working, I noticed I got those "Ignoring InitialState" warnings. I get 2 of those warnings always, right off the bat, as soon as the call to create the Direct2D device from the 11On12Device succeeds.

I then continue to get that same warning recurringly over-time just by normal use of DrawText (and DrawEllipse) of the Direct2DDeviceContext object (the warning is generated when EndDraw() is called, but not always, it can take an indeterminate, yet still somewhat regular, amount of subsequent frames before the warning fires).

At first I thought it was something I was doing wrong with my setup, but then I discovered that the same warnings happen initially and recurringly in this sample as well as the Variable Rate Shading sample. The common denominator is Direct2D with 11On12.

I feel like Direct2D needs to be updated to better interop with Direct3D12 via the Direct3D11On12Device (or however the implementation is handled)...so that it creates its committed resources in a way that doesn't generate these warnings.

Seeing these warnings recurringly can give a misimpression of a memory leak (because the warning indicates that committed resources are being allocated continuously), even though I have to assume Direct2D cleans up and deallocates these committed resources on its own over time and that memory won't just grow continuously...I've only been able to very crudely determine that memory was increasing (by watching the Process Memory graph in Visual Studio's Diagnostics window), but only by a couple megabytes, and it didn't seem to increase beyond that, so I get the impression cleanup is happening.

It's clear that Direct2D needs to allocate committed resources in order to do its job of rendering text and drawing shapes...the fact that is has to continue to do that dynamically is the surprising bit. For text, I can understand as you may need to recreate resources to draw different glyphs as the text string changes, but not for shapes (the size and shape never changed)...anyway, I'm not going to fault the implementation, it seems to run fast enough for its purpose...it's just the warning spam that's the only annoyance so far.

Note: The warning itself I think we all understand is quite benign, but having it spammed in the console just via normal use of the Direct2D calls is the problem. The secondary problem is the resulting confusion the warning can cause and the frustration of knowing it's out of your control as it's generated by an external library.

@walbourn walbourn added question sdklayers Direct3D SDK Layer messages labels Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question sdklayers Direct3D SDK Layer messages
Projects
None yet
Development

No branches or pull requests

4 participants