I decided to configure the texture using option 2. The following gives me an INVALIDARGS error in the Texture2D constructor. Could it be that I have not configured the device correctly?
Texture2DDescription description = new Texture2DDescription
{
ArraySize = 1,
Format = _format,
Width = _width,
Height = _height,
OptionFlags = ResourceOptionFlags.None,
Usage = ResourceUsage.Dynamic,
BindFlags = BindFlags.ShaderResource,
CpuAccessFlags = CpuAccessFlags.Write,
SampleDescription = new SlimDX.DXGI.SampleDescription(1, 0),
MipLevels = _levelCount,
};
_texture = new SlimDX.Direct3D11.Texture2D(_device, description);
Here is the device creation code:
Device device;
SlimDX.DXGI.SwapChainDescription swapDesc = new SlimDX.DXGI.SwapChainDescription
{
BufferCount = 1,
Flags = SlimDX.DXGI.SwapChainFlags.AllowModeSwitch,
IsWindowed = true,
ModeDescription = new SlimDX.DXGI.ModeDescription(0, 0, new SlimDX.Rational(60, 1), SlimDX.DXGI.Format.R8G8B8A8_UNorm),
OutputHandle = handle,
SampleDescription = new SlimDX.DXGI.SampleDescription(1, 0),
SwapEffect = SlimDX.DXGI.SwapEffect.Discard,
Usage = SlimDX.DXGI.Usage.RenderTargetOutput
};
Device.CreateWithSwapChain(DriverType.Hardware, DeviceCreationFlags.Debug, swapDesc, out device, out _swapChain);
I am new to this stuff. The answer may be obvious.