microsoft / D3D11On12

The Direct3D11-On-12 mapping layer
MIT License
274 stars 33 forks source link

DXGI_ERROR_ACCESS_DENIED on SwapChainForComposition #25

Closed tom-huntington closed 1 year ago

tom-huntington commented 2 years ago

I switched from a hwnd SwapChain to a composition SwapChain and started getting a semi non-reproducible device removal bug, which usually happens in the first few frames.

Debug output:

After Present D3D12: Removing Device. After MoveToNextFrame D3D12 ERROR: ID3D12Device::RemoveDevice: Device removal has been triggered for the following reason (DXGI_ERROR_ACCESS_DENIED: The application attempted to use a resource it does not access to. This could be, for example, rendering to a texture while only having read access.). [ EXECUTION ERROR #232: DEVICE_REMOVAL_PROCESS_AT_FAULT]

The only resources I might not have access to are the swap chain buffers, so it seems like there is a bug. This doesn't happen if I comment out my D2D draw calls, but does still happen even if I am not rendering to the swap chain buffers but some secondary resource.

Also, could I get some guidance on how to recover? Present always returns 0, only on the next call to EndDraw do I get a non-zero hresult D2DERR_RECREATE_TARGET.

tom-huntington commented 2 years ago

https://discord.com/channels/590611987420020747/590965902564917258/1010601814447628418