/// <summary> /// Create a texture view from this texture. /// A texture view is defined as a child texture, from a sub-range of their parent texture. /// For example, the initial layer and mipmap level of the view can be defined, so the texture /// will start at the given layer/level of the parent texture. /// </summary> /// <param name="info">Child texture information</param> /// <param name="sizeInfo">Child texture size information</param> /// <param name="firstLayer">Start layer of the child texture on the parent texture</param> /// <param name="firstLevel">Start mipmap level of the child texture on the parent texture</param> /// <returns>The child texture</returns> public Texture CreateView(TextureInfo info, SizeInfo sizeInfo, int firstLayer, int firstLevel) { Texture texture = new Texture( _context, info, sizeInfo, _firstLayer + firstLayer, _firstLevel + firstLevel); TextureCreateInfo createInfo = TextureManager.GetCreateInfo(info, _context.Capabilities); texture.HostTexture = HostTexture.CreateView(createInfo, firstLayer, firstLevel); _viewStorage.AddView(texture); return(texture); }
/// <summary> /// Create a texture view from this texture. /// A texture view is defined as a child texture, from a sub-range of their parent texture. /// For example, the initial layer and mipmap level of the view can be defined, so the texture /// will start at the given layer/level of the parent texture. /// </summary> /// <param name="info">Child texture information</param> /// <param name="sizeInfo">Child texture size information</param> /// <param name="range">Physical memory ranges where the texture data is located</param> /// <param name="firstLayer">Start layer of the child texture on the parent texture</param> /// <param name="firstLevel">Start mipmap level of the child texture on the parent texture</param> /// <returns>The child texture</returns> public Texture CreateView(TextureInfo info, SizeInfo sizeInfo, MultiRange range, int firstLayer, int firstLevel) { Texture texture = new Texture( _context, info, sizeInfo, range, FirstLayer + firstLayer, FirstLevel + firstLevel, ScaleFactor, ScaleMode); TextureCreateInfo createInfo = TextureManager.GetCreateInfo(info, _context.Capabilities, ScaleFactor); texture.HostTexture = HostTexture.CreateView(createInfo, firstLayer, firstLevel); _viewStorage.AddView(texture); return(texture); }