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 |
GlobalAccessFlags
The current access flags for this texture. This is a global value that represents the access flags for the whole texture, and is used when there is no more specific information for the subresources.
Declaration
public VkAccessFlags? GlobalAccessFlags
Field Value
| Type | Description |
|---|---|
| VkAccessFlags? |
GlobalLayout
The current layouts for this texture. This is a global value that represents the layout for the whole texture, and is used when there is no more specific information for the subresources.
Declaration
public VkImageLayout? GlobalLayout
Field Value
| Type | Description |
|---|---|
| VkImageLayout? |
GlobalStageFlags
The current stage flags for this texture. This is a global value that represents the stage flags for the whole texture, and is used when there is no more specific information for the subresources.
Declaration
public VkPipelineStageFlags? GlobalStageFlags
Field Value
| Type | Description |
|---|---|
| VkPipelineStageFlags? |
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 |
SubResourceAccessFlags
The current access flags for this texture. There is one for each subresource.
Declaration
public VkAccessFlags[] SubResourceAccessFlags
Field Value
| Type | Description |
|---|---|
| VkAccessFlags[] |
SubResourceLayouts
The current layouts for this texture. There is one for each subresource.
Declaration
public VkImageLayout[] SubResourceLayouts
Field Value
| Type | Description |
|---|---|
| VkImageLayout[] |
SubResourceStageFlags
The current stage flags for this texture. There is one for each subresource.
Declaration
public VkPipelineStageFlags[] SubResourceStageFlags
Field Value
| Type | Description |
|---|---|
| VkPipelineStageFlags[] |
Properties
DefaultView
Gets a default TextureView for this Texture.
Declaration
public override TextureView DefaultView { get; }
Property Value
| Type | Description |
|---|---|
| TextureView |
Overrides
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. |
GetAspectMask()
Get the aspectMask for this texture.
Declaration
public VkImageAspectFlags GetAspectMask()
Returns
| Type | Description |
|---|---|
| VkImageAspectFlags | The aspect Mask. |
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. |
SetImageState(VkImageLayout?, VkAccessFlags?, VkPipelineStageFlags?, uint, uint, uint, uint)
Sets the image state flags without actually doing any barriers.
Declaration
public void SetImageState(VkImageLayout? layout = null, VkAccessFlags? accessFlags = null, VkPipelineStageFlags? stageFlags = null, uint firstMip = 0, uint numMips = 4294967295, uint firstLayer = 0, uint numLayers = 4294967295)
Parameters
| Type | Name | Description |
|---|---|---|
| VkImageLayout? | layout | The image layout. |
| VkAccessFlags? | accessFlags | The access flags. |
| VkPipelineStageFlags? | stageFlags | The stage flags. |
| uint | firstMip | The first mip. |
| uint | numMips | The number of mips. |
| uint | firstLayer | The first layer. |
| uint | numLayers | The number of layers. |
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. |