I'm using SlimDX to create a texture consisting of 13046 different DataRectangles. Here's my code. It's breaking on the Texture2D constructor with "E_INVALIDARG: An invalid parameter was passed to the returning function (-2147024809)." inParms is just a struct containing handle to a Panel.
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);
}