【发布时间】:2014-06-11 16:38:48
【问题描述】:
我正在使用 SlimDX 创建一个由 13046 个不同 DataRectangle 组成的纹理。这是我的代码。它使用“E_INVALIDARG:将无效参数传递给返回函数(-2147024809)”破坏了 Texture2D 构造函数。 inParms 只是一个包含面板句柄的结构。
public Renderer(Parameters inParms, ref DataRectangle[] inShapes)
{
Texture2DDescription description = new Texture2DDescription()
{
Width = 500,
Height = 500,
MipLevels = 1,
ArraySize = inShapes.Length,
Format = Format.R32G32B32_Float,
SampleDescription = new SampleDescription(1, 0),
Usage = ResourceUsage.Default,
BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
CpuAccessFlags = CpuAccessFlags.None,
OptionFlags = ResourceOptionFlags.None
};
SwapChainDescription chainDescription = new SwapChainDescription()
{
BufferCount = 1,
IsWindowed = true,
Usage = Usage.RenderTargetOutput,
ModeDescription = new ModeDescription(0, 0, new Rational(60, 1), Format.R8G8B8A8_UNorm),
SampleDescription = new SampleDescription(1, 0),
Flags = SwapChainFlags.None,
OutputHandle = inParms.Handle,
SwapEffect = SwapEffect.Discard
};
Device.CreateWithSwapChain(DriverType.Hardware, DeviceCreationFlags.None, chainDescription, out mDevice, out mSwapChain);
Texture2D texture = new Texture2D(Device, description, inShapes);
}
【问题讨论】:
标签: directx-11 texture2d slimdx