views:

133

answers:

1

Hi all,

I'm struggling with this problem for a week.. I hope I can state the problem clear enough:

So, I setup my custom allocator/presenter and in InitializeDevice() I create the textures for VMR9

Then, VMR9 calls my PresentImage() function everytime it has a new frame.

I display render this texture onto a quad and Present() it. If Present() returns D3DERR_DEVICELOST then I PostMessage() to my WndProc() to signal a device reset.

Then my WndProc() calls ResetDevice() on my custom object. ResetDevice() frees all DEFAULT_POOL resources and calls Reset() on the device. Now let's pause for a moment


At this point Direct3d gives me an error telling me that I still hold references to some DEFAULT_POOL surfaces... Which I'm pretty sure I do not because I'm freeing the only texture I allocated. This problem is a mystery as far as I know... There are numerous unanswered forum posts regarding this issue dating back to even 2003..


Let's change lanes. In this forum post

http://www.eggheadcafe.com/software/aspnet/29909616/i-did-some-more-e...

it's said that you should stop the graph, disconnect all the pins of the VMR9, reset the device then reconnect and run the graph again.

When I do that I get another Direct3d complaint: Direct3D9: (ERROR) :Failure trying to create a texture Direct3D9: (ERROR) :Texture width is larger than what the device supports. CreateTexture failed.

I traced the problem to some point where I see that in some function deep in VMR9 calculates the next power of 2 of the width before creating some textures (apart from the ones I successfully create in my A/P). And while tracing I realized this:

My video width is 640. The next power of 2 of 640 is 1024. And I see that this value somehow becomes 10240. Although I don't even set the allocation width to 1024. I just pass 640 as my video card doesn't require pow2 texture sizes.

This is where I stuck..

Is there anybody who knows something about resetting/refreshing the device with VMR9 ?? Please help.

Thanks in advance.

Fatih

A: 

Since you have a custom allocator/presenter I assume you're using IVMRSurfaceAllocatorNotify9::AllocateSurfaceHelper(); and this method could potentionally allocate multiple surfaces, are you sure all of them are released before the device is reset?