c# – DirectX Invalid Call when ResizeBuffers

c# – DirectX Invalid Call when ResizeBuffers

You need to release all resources associated to your swap chain before to resize it.

So that includes the render view (which you do), but you do addref on the resource when you create your render target view.

Resource.FromSwapChain<Texture2D>(swapChain, 0)

Adds a ref counter to the texture. Since you dont cache it, you cant release it.

So you need to do:

Texture2D resource = Texture2D.FromSwapChain<Texture2D>(swapChain, 0);
renderView = new RenderTargetView(device, resource);

then before to call resize:

if (resource != null) { resource.Dispose(); }

Just tested it on my engine and it works (also you were right with 0s, it works too).

c# – DirectX Invalid Call when ResizeBuffers

Leave a Reply

Your email address will not be published.