Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

DX10.1 to DX9Ex RenderTarget texture sharing problem

4: Adsense

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   

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





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.