/// <summary> /// Associates an D3D11 render target with the current instance. /// </summary> /// <param name="renderTarget">An valid D3D11 render target. It must be created with the "Shared" flag.</param> internal void SetBackbuffer(Direct3D11.Texture2D renderTarget) { DisposedGuard(); DisposeD3D9Backbuffer(); using (var resource = renderTarget.QueryInterface <DXGI.Resource>()) { var handle = resource.SharedHandle; texture = new Texture(device9, renderTarget.Description.Width, renderTarget.Description.Height, 1, Usage.RenderTarget, Format.A8R8G8B8, Pool.Default, ref handle); } using (var surface = texture.GetSurfaceLevel(0)) { textureSurfaceHandle = surface.NativePointer; TrySetBackbufferPointer(textureSurfaceHandle); } }
internal RenderTarget2D(Direct3D11.Device device, Direct3D11.Texture2D texture, RenderTargetView renderTargetView = null, bool pureRenderTarget = false) : base(device, texture) { this.pureRenderTarget = pureRenderTarget; this.customRenderTargetView = renderTargetView; Initialize(Resource); }
internal DepthStencilBuffer(GraphicsDevice device, Direct3D11.Texture2D texture, DepthFormat depthFormat) : base(device, texture) { DepthFormat = depthFormat; DefaultViewFormat = ComputeViewFormat(DepthFormat, out HasStencil); Initialize(Resource); HasReadOnlyView = InitializeViewsDelayed(out ReadOnlyView); }
internal DepthStencilBuffer(Direct3D11.Device device, Direct3D11.Texture2D texture, DepthFormat depthFormat) : base(device, texture) { DepthFormat = depthFormat; DefaultViewFormat = ComputeViewFormat(DepthFormat, out HasStencil); Initialize(Resource); HasReadOnlyView = InitializeViewsDelayed(); DepthStencilView = new DepthStencilViewSelector(this); }
/// <summary> /// Creates new instance of <see cref="D3D11Image"/> Associates an D3D11 render target with the current instance. /// </summary> /// <param name="device">A valid D3D9 DeviceEx.</param> /// <param name="renderTarget">A valid D3D11 render target. It must be created with the "Shared" flag.</param> public D3D11Image(DeviceEx device, Direct3D11.Texture2D renderTarget) { using (var resource = renderTarget.QueryInterface <DXGI.Resource>()) { var handle = resource.SharedHandle; texture = new Texture(device, renderTarget.Description.Width, renderTarget.Description.Height, 1, Usage.RenderTarget, Format.A8R8G8B8, Pool.Default, ref handle); } using (var surface = texture.GetSurfaceLevel(0)) { textureSurfaceHandle = surface.NativePointer; TrySetBackbufferPointer(textureSurfaceHandle); } this.IsFrontBufferAvailableChanged += HandleIsFrontBufferAvailableChanged; }
/// <summary> /// Creates a new texture from a <see cref="Direct3D11.Texture2D"/>. /// </summary> /// <param name="device">The <see cref="GraphicsDevice"/>.</param> /// <param name="texture">The native texture <see cref="Direct3D11.Texture2D"/>.</param> /// <returns> /// A new instance of <see cref="TextureCube"/> class. /// </returns> /// <msdn-id>ff476521</msdn-id> /// <unmanaged>HRESULT ID3D11Device::CreateTexture2D([In] const D3D11_TEXTURE2D_DESC* pDesc,[In, Buffer, Optional] const D3D11_SUBRESOURCE_DATA* pInitialData,[Out, Fast] ID3D11Texture2D** ppTexture2D)</unmanaged> /// <unmanaged-short>ID3D11Device::CreateTexture2D</unmanaged-short> public static TextureCube New(GraphicsDevice device, Direct3D11.Texture2D texture) { return(new TextureCube(device, texture)); }
internal TextureCube(GraphicsDevice device, Direct3D11.Texture2D texture) : base(device, texture) { Initialize(Resource); }
/// <summary> /// Creates a new <see cref="DepthStencilBuffer"/> from a <see cref="Direct3D11.Texture2D"/>. /// </summary> /// <param name="device">The <see cref="GraphicsDevice"/>.</param> /// <param name="texture">The native texture <see cref="Direct3D11.Texture2D"/>.</param> /// <returns> /// A new instance of <see cref="DepthStencilBuffer"/> class. /// </returns> /// <msdn-id>ff476521</msdn-id> /// <unmanaged>HRESULT ID3D11Device::CreateTexture2D([In] const D3D11_TEXTURE2D_DESC* pDesc,[In, Buffer, Optional] const D3D11_SUBRESOURCE_DATA* pInitialData,[Out, Fast] ID3D11Texture2D** ppTexture2D)</unmanaged> /// <unmanaged-short>ID3D11Device::CreateTexture2D</unmanaged-short> public static DepthStencilBuffer New(GraphicsDevice device, Direct3D11.Texture2D texture) { return(new DepthStencilBuffer(device, texture, ComputeViewFormat(texture.Description.Format))); }
/// <summary> /// Specialised constructor for use only by derived classes. /// </summary> /// <param name="device">The <see cref="GraphicsDevice"/>.</param> /// <param name="texture">The texture.</param> /// <msdn-id>ff476521</msdn-id> /// <unmanaged>HRESULT ID3D11Device::CreateTexture2D([In] const D3D11_TEXTURE2D_DESC* pDesc,[In, Buffer, Optional] const D3D11_SUBRESOURCE_DATA* pInitialData,[Out, Fast] ID3D11Texture2D** ppTexture2D)</unmanaged> /// <unmanaged-short>ID3D11Device::CreateTexture2D</unmanaged-short> protected internal Texture2DBase(GraphicsDevice device, Direct3D11.Texture2D texture) : base(device, texture.Description) { Resource = texture; }
/// <summary> /// Initializes a new instance of the <see cref="Texture2DBase" /> class. /// </summary> /// <param name="device">The <see cref="GraphicsDevice"/>.</param> /// <param name="description2D">The description.</param> /// <param name="dataBoxes">A variable-length parameters list containing data rectangles.</param> /// <msdn-id>ff476521</msdn-id> /// <unmanaged>HRESULT ID3D11Device::CreateTexture2D([In] const D3D11_TEXTURE2D_DESC* pDesc,[In, Buffer, Optional] const D3D11_SUBRESOURCE_DATA* pInitialData,[Out, Fast] ID3D11Texture2D** ppTexture2D)</unmanaged> /// <unmanaged-short>ID3D11Device::CreateTexture2D</unmanaged-short> protected internal Texture2DBase(GraphicsDevice device, Texture2DDescription description2D, DataBox[] dataBoxes) : base(device, description2D) { Resource = new Direct3D11.Texture2D(device, description2D, dataBoxes); }
/// <summary> /// Creates a new <see cref="RenderTargetCube"/> from a <see cref="Direct3D11.Texture2D"/>. /// </summary> /// <param name="device">The <see cref="GraphicsDevice"/>.</param> /// <param name="texture">The native texture <see cref="Direct3D11.Texture2D"/>.</param> /// <returns> /// A new instance of <see cref="RenderTargetCube"/> class. /// </returns> /// <msdn-id>ff476521</msdn-id> /// <unmanaged>HRESULT ID3D11Device::CreateTexture2D([In] const D3D11_TEXTURE2D_DESC* pDesc,[In, Buffer, Optional] const D3D11_SUBRESOURCE_DATA* pInitialData,[Out, Fast] ID3D11Texture2D** ppTexture2D)</unmanaged> /// <unmanaged-short>ID3D11Device::CreateTexture2D</unmanaged-short> public static RenderTargetCube New(GraphicsDevice device, Direct3D11.Texture2D texture) { return(new RenderTargetCube(device, texture)); }
internal RenderTargetCube(Direct3D11.Device device, Direct3D11.Texture2D texture) : base(device, texture) { Initialize(Resource); }
/// <summary> /// Specialised constructor for use only by derived classes. /// </summary> /// <param name="device">The <see cref="GraphicsDevice"/>.</param> /// <param name="texture">The texture.</param> /// <msdn-id>ff476521</msdn-id> /// <unmanaged>HRESULT ID3D11Device::CreateTexture2D([In] const D3D11_TEXTURE2D_DESC* pDesc,[In, Buffer, Optional] const D3D11_SUBRESOURCE_DATA* pInitialData,[Out, Fast] ID3D11Texture2D** ppTexture2D)</unmanaged> /// <unmanaged-short>ID3D11Device::CreateTexture2D</unmanaged-short> protected internal Texture2DBase(GraphicsDevice device, Direct3D11.Texture2D texture) : base(device, texture.Description) { Resource = texture; }
/// <summary> /// Initializes a new instance of the <see cref="Texture2DBase" /> class. /// </summary> /// <param name="device">The <see cref="GraphicsDevice"/>.</param> /// <param name="description2D">The description.</param> /// <param name="dataBoxes">A variable-length parameters list containing data rectangles.</param> /// <msdn-id>ff476521</msdn-id> /// <unmanaged>HRESULT ID3D11Device::CreateTexture2D([In] const D3D11_TEXTURE2D_DESC* pDesc,[In, Buffer, Optional] const D3D11_SUBRESOURCE_DATA* pInitialData,[Out, Fast] ID3D11Texture2D** ppTexture2D)</unmanaged> /// <unmanaged-short>ID3D11Device::CreateTexture2D</unmanaged-short> protected internal Texture2DBase(GraphicsDevice device, Texture2DDescription description2D, DataBox[] dataBoxes) : base(device ,description2D) { Resource = new Direct3D11.Texture2D(device, description2D, dataBoxes); }
/// <summary> /// Creates a new texture from a <see cref="Direct3D11.Texture2D"/>. /// </summary> /// <param name="device">The <see cref="Direct3D11.Device"/>.</param> /// <param name="texture">The native texture <see cref="Direct3D11.Texture2D"/>.</param> /// <returns> /// A new instance of <see cref="Texture2D"/> class. /// </returns> /// <msdn-id>ff476521</msdn-id> /// <unmanaged>HRESULT ID3D11Device::CreateTexture2D([In] const D3D11_TEXTURE2D_DESC* pDesc,[In, Buffer, Optional] const D3D11_SUBRESOURCE_DATA* pInitialData,[Out, Fast] ID3D11Texture2D** ppTexture2D)</unmanaged> /// <unmanaged-short>ID3D11Device::CreateTexture2D</unmanaged-short> public static Texture2D New(Device device, Direct3D11.Texture2D texture) { return(new Texture2D(device, texture)); }
/// <summary> /// Initializes a new instance of the <see cref="Texture2DBase" /> class. /// </summary> /// <param name="device">The <see cref="Direct3D11.Device"/>.</param> /// <param name="description2D">The description.</param> /// <msdn-id>ff476521</msdn-id> /// <unmanaged>HRESULT ID3D11Device::CreateTexture2D([In] const D3D11_TEXTURE2D_DESC* pDesc,[In, Buffer, Optional] const D3D11_SUBRESOURCE_DATA* pInitialData,[Out, Fast] ID3D11Texture2D** ppTexture2D)</unmanaged> /// <unmanaged-short>ID3D11Device::CreateTexture2D</unmanaged-short> protected internal Texture2DBase(Direct3D11.Device device, Texture2DDescription description2D) : base(device, description2D) { Resource = new Direct3D11.Texture2D(device, description2D); }