/// <summary> /// Initializes a new instance of the <see cref="RenderTarget2D"/> class. /// </summary> /// <param name="device">The device.</param> /// <param name="name">The name of this texture.</param> /// <param name="description">The description.</param> /// <param name="initialize">if set to <c>true</c> [initialize].</param> internal RenderTarget(GraphicsDevice device, Texture texture, ViewType viewType, int arraySlize, int mipSlice, PixelFormat viewFormat = PixelFormat.None) : base(device) { texture.AddReferenceInternal(); Texture = texture; Description = texture.Description; resourceId = texture.ResourceId; Width = Math.Max(1, Description.Width >> mipSlice); Height = Math.Max(1, Description.Height >> mipSlice); ViewType = viewType; ArraySlice = arraySlize; MipLevel = mipSlice; ViewFormat = viewFormat == PixelFormat.None ? Description.Format : viewFormat; }