I'm trying to create a render target texture to be shared between two devices using slimDX. Unfortunately I get the following error (Windbg) every time I try to create the texture using the August 2009 release of SlimDX. I'm using debug august 2009 directx libraries.
Direct3D9: (ERROR) :Device is not capable of sharing resource. CreateTexture fails.
Direct3D9: (ERROR) :Failure trying to create a texture
D3D9 Helper: IDirect3DDevice9::CreateTexture failed: D3DERR_INVALIDCALL
(2708.924): CLR exception - code e0434f4d (first chance)
(2708.924): CLR exception - code e0434f4d (!!! second chance !!!)
I'm having trouble finding a lot of documentation on the shared handle feature, so this is a bit frustrating. Here is my code to create the device:
_presentParam = new PresentParameters();
_presentParam.PresentationInterval = PresentInterval.Immediate;
_presentParam.Windowed = true;
_presentParam.DeviceWindowHandle = _control.Handle;
_presentParam.SwapEffect = SwapEffect.Discard;
_presentParam.PresentFlags = PresentFlags.LockableBackBuffer | PresentFlags.Video | PresentFlags.DiscardDepthStencil | PresentFlags.DeviceClip;
_presentParam.BackBufferCount = 1;
_presentParam.EnableAutoDepthStencil = true;
_presentParam.AutoDepthStencilFormat = Format.D16;
_presentParam.BackBufferWidth = _backbufferSize.Width;
_presentParam.BackBufferHeight = _backbufferSize.Height;
_presentParam.BackBufferFormat = _format;
Direct3D _direct3D = new Direct3D();
_device = new Device(
_direct3D,
_adapter,
DeviceType.Hardware,
_control.Handle,
CreateFlags.Multithreaded | CreateFlags.HardwareVertexProcessing,
_presentParam
);
And here is my code to create the texture.. the offending line of code that fails is _prv = new Texture(...
Width = 1024; Height = 200;
public IntPtr _ptr_prvtexture;
_prvtexture = new Texture(_device, Width, Height, 1, Usage.RenderTarget, Format.A8R8G8B8, Pool.Default, out _ptr_prvtexture);
Is it a device creation parameter error? Something wrong with the texture creation? My video card is a GeForce 9800 GT. I'm not sure what is causing the error. - Michael Tanczos