尝试在32位NVidia Quadro M1000M上为DirectX 9创建新纹理时获取SharpDXException无效参数

问题描述 投票:1回答:1

我创建了一个使用SharpDX通过WPF渲染的控件。该代码可以在大多数计算机,视频卡和配置​​中正常运行。

但是,当使用该组件的应用程序针对X86编译并在NVIDIA Quadro M1000M或AMD Radeon R5 430中使用时,我遇到了问题。如果该应用程序在x64中进行编译,则一切正常。

这是我正在使用的:

 format = SharpDX.Direct3D9.Format.A8R8G8B8;
 //target.Description.Width = 10,  target.Description.Height = 10.
 this.renderTarget = new SharpDX.Direct3D9.Texture(WPFImageSource.device, target.Description.Width, target.Description.Height, 1, Usage.RenderTarget, format, Pool.Default, ref handle);

任何想法都会受到欢迎。编辑:这是例外详细信息:

Exception Setup D3D Enviroment: SharpDX.SharpDXException: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.

   at SharpDX.Result.CheckError() in C:\projects\sharpdx\Source\SharpDX\Result.cs:line 195
   at SharpDX.Direct3D9.Device.CreateTexture(Int32 width, Int32 height, Int32 levels, Int32 usage, Format format, Pool pool, Texture textureOut, IntPtr sharedHandleRef) in C:\projects\sharpdx\Source\SharpDX.Direct3D9\Generated\Interfaces.cs:line 5089
   at SharpDX.Direct3D9.Texture..ctor(Device device, Int32 width, Int32 height, Int32 levelCount, Usage usage, Format format, Pool pool, IntPtr& sharedHandle) in C:\projects\sharpdx\Source\SharpDX.Direct3D9\Texture.cs:line 65
   at EV3D.Rendering.WPFImageSource.SetRenderTarget(Texture2D target) in D:\projects\ev3dsdk\EVRenderer_WPF\WPFImageSource.cs:line 118
Exception Setup D3D Enviroment: SharpDX.SharpDXException: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.

   at EV3D.Rendering.WPFImageSource.SetRenderTarget(Texture2D target) in D:\projects\ev3dsdk\EVRenderer_WPF\WPFImageSource.cs:line 131
   at EV3D.Rendering.EVRenderContext.CreateAndBindTargets() in D:\projects\ev3dsdk\EVRenderer_WPF\EVRenderContext.cs:line 420
   at EV3D.Rendering.EVRenderContext.StartD3D() in D:\projects\ev3dsdk\EVRenderer_WPF\EVRenderContext.cs:line 276

我创建了一个使用SharpDX渲染WPF的控件。该代码在大多数计算机,视频卡和配置​​中都能正常运行。但是,使用该组件的应用程序编译时出现问题...

textures nvidia sharpdx direct3d9
1个回答
0
投票

我终于弄清楚了这个问题。我们正在创建两个设备上下文,一个用于DX11,另一个用于DX9,以便能够通过WPF进行渲染。但是,当为DX9创建设备时,我一直传递适配器索引0,但是当我们创建DX11设备时,我选择的“最佳适配器”不一定相同。因此,您可以想象为什么会发生这种情况。

© www.soinside.com 2019 - 2024. All rights reserved.