Sign in to follow this  

DX10.1 to DX9Ex RenderTarget texture sharing problem

This topic is 1420 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

I share RenderTarget Texture from DX10.1 to DX9Ex to draw it in WPF.

Everithing works perfectly on Windows 7 + GeForce GTS450/GTS560(and many other configurations). But on Windows Server 2008 + Nvidia NVS 300 I got an "An invalid parameter was passed to the returning function" exception in line:

sharedTexture = new Texture(D3DDevice, Texture.Description.Width, Texture.Description.Height, 1, 
                 Usage.RenderTarget, format, Pool.Default, ref handle);

if I remove last parameter "ref handle" - no exception and everthing is running(but with blank screen). Latest drivers, SlimDX and DirectX are installed. Nvidia NVS 300 supports DirectX 10.1.

 

 

D3D10.1 device initialization:

device = new Device(DriverType.Hardware, DeviceCreationFlags.BgraSupport , FeatureLevel.Level_10_1);

D3D10.1 shared texture initialization:

var renderTexDescShared = new Texture2DDescription()
{
      BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
      Format = Format.B8G8R8A8_UNorm,
      Width = windowWidth,
      Height = windowHeight,
      MipLevels = 1,
      SampleDescription = new SampleDescription(1, 0),
      Usage = ResourceUsage.Default,
      OptionFlags = ResourceOptionFlags.Shared,
      CpuAccessFlags = CpuAccessFlags.None,
      ArraySize = 1
};
SharedTexture = new Texture2D(device, renderTexDescShared);

D3D9Ex device initialization:

D3DContext = new Direct3DEx();

PresentParameters presentparams = new PresentParameters();
presentparams.Windowed = true;
presentparams.SwapEffect = SwapEffect.Copy;
presentparams.DeviceWindowHandle = GetDesktopWindow();
presentparams.PresentationInterval = PresentInterval.Immediate;

D3DDevice = new DeviceEx(D3DContext, 0, DeviceType.Hardware, IntPtr.Zero, 
      CreateFlags.HardwareVertexProcessing | CreateFlags.Multithreaded | CreateFlags.FpuPreserve, 
      presentparams);

D3D9Ex texture:

SlimDX.DXGI.Resource resource = new SlimDX.DXGI.Resource(SharedTexture);
IntPtr handle = resource.SharedHandle;
sharedTexture = new Texture(D3DDevice, Texture.Description.Width, Texture.Description.Height, 1, 
                Usage.RenderTarget, format, Pool.Default, ref handle);

Share this post


Link to post
Share on other sites

This topic is 1420 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