Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


DX10.1 to DX9Ex RenderTarget texture sharing problem


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 Feuerrader   Members   -  Reputation: 104

Like
0Likes
Like

Posted 26 February 2014 - 01:47 AM

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);


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS