Jump to content

  • Log In with Google      Sign In   
  • Create Account

rtclawson

Member Since 16 Jan 2013
Offline Last Active Oct 22 2013 10:58 AM

#5022572 texture.LockRectangle() for Direct3d9. Direct3d11 Equivalent?

Posted by rtclawson on 17 January 2013 - 11:05 AM

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.




PARTNERS