Sign in to follow this  

IDirect3DSurface9::QueryInterface

This topic is 671 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Greetings.

 

Can someone explain why IDirect3DSurface9 do not support IDirect3DResource9? I mean the call to IDirect3DSurface9::QueryInterface for IDirect3DResource9 fails?

I go deep inside d3d9.dll and it looks like CSurface::QueryInterface (which is responsible for IDirect3DSurface9 afaik) succedded only for IID_IDirect3DSurface9 and IID_IUnknown.

Checked this on my Windows 8.1 with all latest updates, 32 bit dll (WoW) on 64 bit host platform.

 

According the MSDN IDirect3DSurface9 is inherits from IDirect3DResource9 and implement it.

 

I was curious and check WINE implementation of IDirect3DSurface9::QueryInterface - it supports querying of IDirect3DResource9.

 

Thanks in advance.

Edited by vedmysh

Share this post


Link to post
Share on other sites

D3D often breaks the strict rules of COM...

 

I never encounter something like this before, although i worked with Direct3d tightly :( This time it leads to a real problem. Nvidia implementation of OpenCL interop with Direct3D9 have some requirements (according to Khronos specs of cl_nv_d3d9_sharing). Surface (to be accessible in OpenCL) should be a valid IDirect3DSource9 and IDirect3DResource9... I debug the nvopencl.dll - they simply do two QueryInterface. One of them just fails...

Anyway, i will try to use texture instead of surface. Hope Nv will not QI on surface behind the texture interface. Or i just wrap IDirect3DSurface9 in my implementation and reimplement QueryInterface method...

Share this post


Link to post
Share on other sites

Have you tried IDirect3DSurface9::GetContainer() (and then querying for ID3DResource9)?
I used it for a wrapper and it did the trick.

 

Thanks for the idea. But looks like the problem was little deeper than i expected.

I try to fool underlying nv opencl implementation with IDirect3DSurface9 wrapper and reporting IDirect3DResource9 supported but still have an error while interop.

So i just switched to texture (with same dimenstions and format) and used corresponding interop function - that works ok.

Share this post


Link to post
Share on other sites

According to Microsoft's own d3d9.h, IDirect3DSurface9 also inherits from IDirect3DResource9, so if there is something funny happening it must be happening in IDirect3DSurface9's implementation of QueryInterface.

 

As a general rule, in cases like this it's a fairly clear "you shouldn't be doing this" flag from Microsoft.

Share this post


Link to post
Share on other sites

This topic is 671 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this