Class DX12Texture
Represents a DirectX Texture.
Inherited Members
Namespace: Evergine.DirectX12
Assembly: Evergine.DirectX12.dll
Syntax
public class DX12Texture : Texture, ILoadable, IDependencyObject
Constructors
DX12Texture(DX12GraphicsContext, DataBox[], ref TextureDescription, ref SamplerStateDescription)
Initializes a new instance of the DX12Texture class.
Declaration
public DX12Texture(DX12GraphicsContext context, DataBox[] data, ref TextureDescription description, ref SamplerStateDescription samplerState)
Parameters
| Type | Name | Description |
|---|---|---|
| DX12GraphicsContext | context | The graphics context. |
| DataBox[] | data | The data pointer. |
| TextureDescription | description | The texture description. |
| SamplerStateDescription | samplerState | The sampler state description for this texture. |
Fields
NativeBuffer
The native buffer pointer for staging textures.
Declaration
public ID3D12Resource NativeBuffer
Field Value
| Type | Description |
|---|---|
| ID3D12Resource |
NativeResourceState
The state of the native resource.
Declaration
public ResourceStates NativeResourceState
Field Value
| Type | Description |
|---|---|
| ResourceStates |
NativeTexture
The pointer to the native texture.
Declaration
public ID3D12Resource NativeTexture
Field Value
| Type | Description |
|---|---|
| ID3D12Resource |
Properties
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
ShaderResourceView
Gets the shader resource view.
Declaration
public CpuDescriptorHandle ShaderResourceView { get; }
Property Value
| Type | Description |
|---|---|
| CpuDescriptorHandle |
UnorderedAccessView
Gets the unordered view.
Declaration
public CpuDescriptorHandle UnorderedAccessView { get; }
Property Value
| Type | Description |
|---|---|
| CpuDescriptorHandle |
Methods
CopyTo(ID3D12GraphicsCommandList, 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(ID3D12GraphicsCommandList commandList, uint sourceX, uint sourceY, uint sourceZ, uint sourceMipLevel, uint sourceBaseArray, Texture destination, uint destinationX, uint destinationY, uint destinationZ, uint destinationMipLevel, uint destinationBasedArray, uint width, uint height, uint depth, uint layerCount)
Parameters
| Type | Name | Description |
|---|---|---|
| ID3D12GraphicsCommandList | commandList | The CommandList where commands are executed. |
| 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 | 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
FromDirectXTexture(DX12GraphicsContext, nint, TextureDescription?)
Generates a DXTexture from Vortice Texture2D.
Declaration
public static DX12Texture FromDirectXTexture(DX12GraphicsContext context, nint texturePointer, TextureDescription? textureDescription = null)
Parameters
| Type | Name | Description |
|---|---|---|
| DX12GraphicsContext | context | DX context. |
| nint | texturePointer | DirectX Texture pointer. |
| TextureDescription? | textureDescription | Overridden pixel format. |
Returns
| Type | Description |
|---|---|
| DX12Texture | DXTexture with VorticeTexture as a resource. |
FromDirectXTexture(DX12GraphicsContext, ID3D12Resource, TextureDescription?)
Generates a DXTexture from Vortice Texture2D.
Declaration
public static DX12Texture FromDirectXTexture(DX12GraphicsContext context, ID3D12Resource nativeTexture, TextureDescription? textureDescription = null)
Parameters
| Type | Name | Description |
|---|---|---|
| DX12GraphicsContext | context | DX context. |
| ID3D12Resource | nativeTexture | VorticeTexture instance. |
| TextureDescription? | textureDescription | Overridden pixel format. This only affects the generated TextureDescription. It does not change the source texture format. |
Returns
| Type | Description |
|---|---|
| DX12Texture | DXTexture with VorticeTexture as the resource. |
GetDepthStencilView(uint, uint, uint)
Creates a new DepthStencil view for this texture.
Declaration
public CpuDescriptorHandle GetDepthStencilView(uint firstSlice, uint sliceCount, uint mipSlice)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | firstSlice | The starting slice of the view range. |
| uint | sliceCount | The number of slices in the view range. |
| uint | mipSlice | The mipmap level in the view range. |
Returns
| Type | Description |
|---|---|
| CpuDescriptorHandle | A new DepthStencil view. |
GetRenderTargetView(uint, uint, uint, Format)
Creates a new RenderTargetView for this texture.
Declaration
public CpuDescriptorHandle GetRenderTargetView(uint firstSlice, uint sliceCount, uint mipSlice, Format format = Format.Unknown)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | firstSlice | The starting slice of the view range. |
| uint | sliceCount | The number of slices in the view range. |
| uint | mipSlice | The mipmap level in the view range. |
| Format | format | Force a specific format for the view. It not provided (Format.Unknown), it will use the same format as the texture. |
Returns
| Type | Description |
|---|---|
| CpuDescriptorHandle | A new RenderTargetView instance. |
GetShaderResourceView(uint, uint, uint)
Creates a new ShaderResource view for this texture.
Declaration
public CpuDescriptorHandle GetShaderResourceView(uint firstSlice, uint sliceCount, uint mipSlice)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | firstSlice | The starting slice of the view range. |
| uint | sliceCount | The number of slices in the view range. |
| uint | mipSlice | The mipmap level in the view range. |
Returns
| Type | Description |
|---|---|
| CpuDescriptorHandle | A new ShaderResource view. |
GetUnorderedAccessView(uint, uint)
Creates a new UnorderedAccessView for this texture.
Declaration
public CpuDescriptorHandle GetUnorderedAccessView(uint arraySlice, uint mipSlice)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | arraySlice | The slice in the view range. |
| uint | mipSlice | The mipmap level in the view range. |
Returns
| Type | Description |
|---|---|
| CpuDescriptorHandle | A new UnorderedAccessView. |
ResourceTransition(ID3D12GraphicsCommandList, ResourceStates, uint)
Transitions this texture to another native state.
Declaration
public void ResourceTransition(ID3D12GraphicsCommandList commandList, ResourceStates newResourceState, uint subResource = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| ID3D12GraphicsCommandList | commandList | The command list used to execute the barrier transition. |
| ResourceStates | newResourceState | The new native state for this texture. |
| uint | subResource | The subresource index. |
SetData(ID3D12GraphicsCommandList, nint, uint, uint)
Fills the buffer from a pointer.
Declaration
public void SetData(ID3D12GraphicsCommandList commandList, nint source, uint sourceSizeInBytes, uint subResource = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| ID3D12GraphicsCommandList | commandList | The CommandList where commands are executed. |
| nint | source | The data pointer. |
| uint | sourceSizeInBytes | The size in bytes of the source. |
| uint | subResource | The subresource index. |
ToStaging()
Returns a new Buffer with ResourceUsage set to staging.
Declaration
public DX12Texture ToStaging()
Returns
| Type | Description |
|---|---|
| DX12Texture | New staging Buffer. |