Class VKTexture
This class represents a native texture object in Metal.
Inherited Members
Namespace: Evergine.Vulkan
Assembly: Evergine.Vulkan.dll
Syntax
public class VKTexture : Texture, ILoadable, IDependencyObject
Constructors
VKTexture(VKGraphicsContext, DataBox[], ref TextureDescription)
Initializes a new instance of the VKTexture class.
Declaration
public VKTexture(VKGraphicsContext context, DataBox[] data, ref TextureDescription description)
Parameters
| Type | Name | Description |
|---|---|---|
| VKGraphicsContext | context | The graphics context. |
| DataBox[] | data | The data pointer. |
| TextureDescription | description | The texture description. |
VKTexture(VKGraphicsContext, DataBox[], ref TextureDescription, ref SamplerStateDescription)
Initializes a new instance of the VKTexture class.
Declaration
public VKTexture(VKGraphicsContext context, DataBox[] data, ref TextureDescription description, ref SamplerStateDescription samplerState)
Parameters
| Type | Name | Description |
|---|---|---|
| VKGraphicsContext | context | The graphics context. |
| DataBox[] | data | The data pointer. |
| TextureDescription | description | The texture description. |
| SamplerStateDescription | samplerState | The sampler state description for this texture. |
Fields
BufferMemory
The native buffer memory linked with the native buffer.
Declaration
public VkDeviceMemory BufferMemory
Field Value
| Type | Description |
|---|---|
| VkDeviceMemory |
Format
The native pixel format of this texture.
Declaration
public VkFormat Format
Field Value
| Type | Description |
|---|---|
| VkFormat |
ImageLayouts
The native image layouts for this texture.
Declaration
public VkImageLayout[] ImageLayouts
Field Value
| Type | Description |
|---|---|
| VkImageLayout[] |
ImageMemory
The native Vulkan memory linked with the native image.
Declaration
public VkDeviceMemory ImageMemory
Field Value
| Type | Description |
|---|---|
| VkDeviceMemory |
MemoryRequirements
The memory requirements for this texture.
Declaration
public VkMemoryRequirements MemoryRequirements
Field Value
| Type | Description |
|---|---|
| VkMemoryRequirements |
NativeBuffer
The native Vulkan buffer object used for staging textures.
Declaration
public VkBuffer NativeBuffer
Field Value
| Type | Description |
|---|---|
| VkBuffer |
NativeImage
The native Vulkan image object.
Declaration
public VkImage NativeImage
Field Value
| Type | Description |
|---|---|
| VkImage |
Properties
ImageView
Gets the Vulkan image view.
Declaration
public VkImageView ImageView { get; }
Property Value
| Type | Description |
|---|---|
| VkImageView |
Name
Gets or sets a string identifying this instance. Can be used in graphics debugger tools.
Declaration
public override string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Overrides
NativePointer
Gets the native pointer.
Declaration
public override nint NativePointer { get; }
Property Value
| Type | Description |
|---|---|
| nint |
Overrides
Methods
Blit(VkCommandBuffer, uint, uint, uint, uint, uint, Texture, uint, uint, uint, uint, uint, uint)
Copies a pixel region from source to destination texture with format conversion and prepares it for presentation in a swapchain.
Declaration
public void Blit(VkCommandBuffer commandBuffer, uint sourceX, uint sourceY, uint sourceZ, uint sourceMipLevel, uint sourceBaseArray, Texture destination, uint destinationX, uint destinationY, uint destinationZ, uint destinationMipLevel, uint destinationBasedArray, uint layerCount)
Parameters
| Type | Name | Description |
|---|---|---|
| VkCommandBuffer | commandBuffer | The command buffer where execution occurs. |
| uint | sourceX | U-coordinate of the source texture. |
| uint | sourceY | V-coordinate of the source texture. |
| uint | sourceZ | W-coordinate of the source texture. |
| uint | sourceMipLevel | Source mip level. |
| uint | sourceBaseArray | Source array index. |
| Texture | destination | Destination texture. |
| uint | destinationX | U-coordinate of the destination texture. |
| uint | destinationY | V-coordinate of the destination texture. |
| uint | destinationZ | W-coordinate of the destination texture. |
| uint | destinationMipLevel | Destination mip level. |
| uint | destinationBasedArray | Destination array index. |
| uint | layerCount | Destination layer count. |
CopyTo(VkCommandBuffer, uint, uint, uint, uint, uint, Texture, uint, uint, uint, uint, uint, uint, uint, uint, uint)
Copies a pixel region from the source to the destination texture.
Declaration
public void CopyTo(VkCommandBuffer commandBuffer, uint sourceX, uint sourceY, uint sourceZ, uint sourceMipLevel, uint sourceBaseArray, Texture destination, uint destinationX, uint destinationY, uint destinationZ, uint destinationMipLevel, uint destinationBaseArray, uint width, uint height, uint depth, uint layerCount)
Parameters
| Type | Name | Description |
|---|---|---|
| VkCommandBuffer | commandBuffer | The command buffer to execute. |
| uint | sourceX | U coordinate of the source texture. |
| uint | sourceY | V coordinate of the source texture. |
| uint | sourceZ | W coordinate of the source texture. |
| uint | sourceMipLevel | Source mip level. |
| uint | sourceBaseArray | Source array index. |
| Texture | destination | Destination texture. |
| uint | destinationX | U coordinate of the destination texture. |
| uint | destinationY | V coordinate of the destination texture. |
| uint | destinationZ | W coordinate of the destination texture. |
| uint | destinationMipLevel | Destination mip level. |
| uint | destinationBaseArray | Destination array index. |
| uint | width | Destination width. |
| uint | height | Destination height. |
| uint | depth | Destination depth. |
| uint | layerCount | Destination layer count. |
Destroy()
Destroy graphics native resources.
Declaration
protected override void Destroy()
Overrides
FromVulkanImage(VKGraphicsContext, ref TextureDescription, VkImage, bool)
Creates a new texture from a VKImage.
Declaration
public static VKTexture FromVulkanImage(VKGraphicsContext context, ref TextureDescription description, VkImage image, bool ownResources = true)
Parameters
| Type | Name | Description |
|---|---|---|
| VKGraphicsContext | context | The graphics context. |
| TextureDescription | description | The texture description. |
| VkImage | image | The Vulkan image already created. |
| bool | ownResources | The image resources are owned by the created VKTexture instance, and can destroy and manage it. |
Returns
| Type | Description |
|---|---|
| VKTexture | A new VKTexture. |
SetData(VkCommandBuffer, nint, uint, uint)
Fills the buffer from a pointer.
Declaration
public void SetData(VkCommandBuffer commandBuffer, nint source, uint sourceSizeInBytes, uint subResource = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| VkCommandBuffer | commandBuffer | The command buffer. |
| nint | source | The data pointer. |
| uint | sourceSizeInBytes | The size in bytes. |
| uint | subResource | The subresource index. |
SetImageLayout(uint, VkImageLayout)
A new image layout based on the subResource.
Declaration
public void SetImageLayout(uint subResource, VkImageLayout layout)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | subResource | The subResource index. |
| VkImageLayout | layout | The new layout state. |
SetImageLayout(uint, uint, VkImageLayout)
A new image layout.
Declaration
public void SetImageLayout(uint mipLevel, uint arrayLevel, VkImageLayout layout)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | mipLevel | The mipLevel of this texture. |
| uint | arrayLevel | The arrayLevel of this texture. |
| VkImageLayout | layout | The new layout to set. |
TransitionImageLayout(VkCommandBuffer, VkImageLayout, uint, uint, uint, uint)
Transition the images linked with this texture to a VKImageLayout state.
Declaration
public void TransitionImageLayout(VkCommandBuffer command, VkImageLayout newLayout, uint baseMipLevel, uint levelCount, uint baseArrayLayer, uint layerCount)
Parameters
| Type | Name | Description |
|---|---|---|
| VkCommandBuffer | command | The command buffer to execute. |
| VkImageLayout | newLayout | The new state layout. |
| uint | baseMipLevel | The start mip level. |
| uint | levelCount | The number of mip levels. |
| uint | baseArrayLayer | The start array layer. |
| uint | layerCount | The number of array layers. |