wpiyong
2007-06-14 15:34:51 UTC
Calling IDirect3DDevice9::StretchRect failed with return value
D3DERR_INVALIDCALL. In the project, I am using VMR9 custom allocator
presenter based on the sample code VMR9Allocator. The project required
to do some image processing in pixel shader, and so before pixel
shader processing, I need first to manipulate the pixel data in video
texture. In VMR9Allocator, there are two ways to create the video
texture, one is to create VMR9AllocFlag_TextureSurface by calling
AllocateSurfaceHelper, and in PresentImage, calling GetContainer to
get the video texture. I tried this method, but I could not call
IDirect3DTexture9::LockRect. I do not know how VMR9 create the video
texture, I mean USAGE and POOL of the texture. So I tried the second
method create private texture by calling CreateTexture with parameters
USAGE: D3DUSAGE_DYNAMIC, POOL: D3DPOOL_DEFAULT. I do not know how to
create the surface, so I just use AllocateSurfaceHelper with
information of lpAllocInfo->dwFlags |= VMR9AllocFlag_TextureSurface.
In PresentImage, GetSurfaceLevel is called to get the private texture
surface, but the call to StretchRect failed. I also tried to change
the setting in AllocateSurfaceHelper dwFlags to
VMR9AllocFlag_OffScreenSurface, video frames are played in another
window, but this time PresentImage never been called (looks like using
default allocator presenter). Can anyone help me with this problem? I
read DX document and searched on line for more than one week, but no
results. I also found some sample codes creating private video
texture, but they are not using VMR9. Thanks for your help.
D3DERR_INVALIDCALL. In the project, I am using VMR9 custom allocator
presenter based on the sample code VMR9Allocator. The project required
to do some image processing in pixel shader, and so before pixel
shader processing, I need first to manipulate the pixel data in video
texture. In VMR9Allocator, there are two ways to create the video
texture, one is to create VMR9AllocFlag_TextureSurface by calling
AllocateSurfaceHelper, and in PresentImage, calling GetContainer to
get the video texture. I tried this method, but I could not call
IDirect3DTexture9::LockRect. I do not know how VMR9 create the video
texture, I mean USAGE and POOL of the texture. So I tried the second
method create private texture by calling CreateTexture with parameters
USAGE: D3DUSAGE_DYNAMIC, POOL: D3DPOOL_DEFAULT. I do not know how to
create the surface, so I just use AllocateSurfaceHelper with
information of lpAllocInfo->dwFlags |= VMR9AllocFlag_TextureSurface.
In PresentImage, GetSurfaceLevel is called to get the private texture
surface, but the call to StretchRect failed. I also tried to change
the setting in AllocateSurfaceHelper dwFlags to
VMR9AllocFlag_OffScreenSurface, video frames are played in another
window, but this time PresentImage never been called (looks like using
default allocator presenter). Can anyone help me with this problem? I
read DX document and searched on line for more than one week, but no
results. I also found some sample codes creating private video
texture, but they are not using VMR9. Thanks for your help.