edgar-mtz-e / slimdx

Automatically exported from code.google.com/p/slimdx
0 stars 0 forks source link

D3D10: SwapChain.ResizeBuffers() error or RenderTargetView dispose issue #314

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When I call this function and I've created a RenderTargetView from the 
swapchain I get an exception and this message in the DX debug spew:

"DXGI Error: Swapchain cannot be resized unless all outstanding buffer 
references have been released."

I know with absolute certainty that I am releasing the RenderTargetView 
before calling ResizeBuffers (via Dispose()).  That's the only thing I 
have referencing the swapchain buffers, so I don't know what else it could 
be.

I don't know if this is a SlimDX issue or not, and I'm at a loss to figure 
out why this is happening.  The issue doesn't appear to be the fault of 
ResizeBuffers as such, because it looks as though it's acting correctly. 
However it does look like something's sticking around in memory long 
enough to make ResizeBuffers throw that exception.  Shouldn't the 
RenderTargetView be released after a call to Dispose?

I've also tried this in the MiniTri example and I get the same issue.

Original issue reported on code.google.com by tape.wyrm on 31 Jul 2008 at 7:50

GoogleCodeExporter commented 9 years ago
I'll look into it.

Original comment by josh.petrie on 31 Jul 2008 at 3:32

GoogleCodeExporter commented 9 years ago
DXGI.SwapChain.GetBuffer<T>() was dangling a reference to the IUnknown 
recovered 
from the native GetBuffer() call; since the IUnknown was used to call 
FromPointer on 
the appropriate type T (which also increments the reference count), the call to 
Dispose() the texture object that is used to create the RenderTargetView would 
not 
reduce the reference count on the texture to zero.

Thus, the backbuffer texture resource would still be around when 
ResizeBuffers() was 
called, even if the render target view was correctly disposed of.

I believe this is fixed now.

Original comment by josh.petrie on 3 Aug 2008 at 2:51