/// <summary> /// Function to perform the creation of a specific kind of view. /// </summary> /// <returns>The view that was created.</returns> private protected override D3D11.ResourceView OnCreateNativeView() { Graphics.Log.Print($"Render Target 3D View '{Texture.Name}': Creating D3D11 render target view.", LoggingLevel.Simple); var desc = new D3D11.RenderTargetViewDescription1 { Format = (Format)Format, Dimension = D3D11.RenderTargetViewDimension.Texture3D, Texture3D = { DepthSliceCount = DepthSliceCount, FirstDepthSlice = StartDepthSlice, MipSlice = MipSlice } }; MipWidth = (Width >> MipSlice).Max(1); MipHeight = (Height >> MipSlice).Max(1); Bounds = new DX.Rectangle(0, 0, Width, Height); Graphics.Log.Print($"Render Target 3D View '{Texture.Name}': {Texture.ResourceType} -> Mip slice: {MipSlice}, Starting depth slide: {StartDepthSlice}, Depth slice count: {DepthSliceCount}", LoggingLevel.Verbose); Native = new D3D11.RenderTargetView1(Texture.Graphics.D3DDevice, Texture.D3DResource, desc) { DebugName = $"'{Texture.Name}'_D3D11RenderTargetView1_3D" }; return(Native); }
/// <summary> /// Function to perform the creation of a specific kind of view. /// </summary> /// <returns>The view that was created.</returns> private protected override D3D11.ResourceView OnCreateNativeView() { Graphics.Log.Print($"Render Target 2D View '{Texture.Name}': Creating D3D11 render target view.", LoggingLevel.Simple); D3D11.RenderTargetViewDescription1 desc = GetDesc2D(!Texture.MultisampleInfo.Equals(GorgonMultisampleInfo.NoMultiSampling)); if (desc.Dimension == D3D11.RenderTargetViewDimension.Unknown) { throw new GorgonException(GorgonResult.CannotCreate, Resources.GORGFX_ERR_VIEW_CANNOT_BIND_UNKNOWN_RESOURCE); } MipWidth = (Width >> MipSlice).Max(1); MipHeight = (Height >> MipSlice).Max(1); Bounds = new DX.Rectangle(0, 0, Width, Height); Graphics.Log.Print($"Render Target 2D View '{Texture.Name}': {Texture.ResourceType} -> Mip slice: {MipSlice}, Array Index: {ArrayIndex}, Array Count: {ArrayCount}", LoggingLevel.Verbose); Native = new D3D11.RenderTargetView1(Texture.Graphics.D3DDevice, Texture.D3DResource, desc) { DebugName = $"'{Texture.Name}'_D3D11RenderTargetView1_2D" }; return(Native); }