Class DX12Texture
Represent a DirectX Texture.
Inherited Members
Namespace: Evergine.DirectX12
Assembly: Evergine.DirectX12.dll
Syntax
public class DX12Texture : Texture, ILoadable, IDisposable, 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 native resource state.
Declaration
public ResourceStates NativeResourceState
Field Value
Type | Description |
---|---|
ResourceStates |
NativeTexture
The native texture pointer.
Declaration
public ID3D12Resource NativeTexture
Field Value
Type | Description |
---|---|
ID3D12Resource |
Properties
Name
Gets or sets a string identifying this instance. Can be used in graphics debuggers tools.
Declaration
public override string Name { get; set; }
Property Value
Type | Description |
---|---|
string |
Overrides
NativePointer
Gets the native pointer.
Declaration
public override IntPtr NativePointer { get; }
Property Value
Type | Description |
---|---|
IntPtr |
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)
Copy a pixel region from source to 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 execute commands. |
uint | sourceX | U coord source texture. |
uint | sourceY | V coord source texture. |
uint | sourceZ | W coord source texture. |
uint | sourceMipLevel | Source mip level. |
uint | sourceBaseArray | Source array index. |
Texture | destination | Destination texture. |
uint | destinationX | U coord destination texture. |
uint | destinationY | V coord destination texture. |
uint | destinationZ | W coord 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. |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public override void Dispose()
Overrides
FromDirectXTexture(DX12GraphicsContext, IntPtr, TextureDescription?)
Generate a DXTexture from Vortice Texture2D.
Declaration
public static DX12Texture FromDirectXTexture(DX12GraphicsContext context, IntPtr texturePointer, TextureDescription? textureDescription = null)
Parameters
Type | Name | Description |
---|---|---|
DX12GraphicsContext | context | DX context. |
IntPtr | texturePointer | DirectX Texture pointer. |
TextureDescription? | textureDescription | Overrided pixel format. |
Returns
Type | Description |
---|---|
DX12Texture | DXTexture with VorticeTexture as resource. |
FromDirectXTexture(DX12GraphicsContext, ID3D12Resource, TextureDescription?)
Generate 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 | Overrided pixel format. This only affect to the generated TextureDescription. IT does not change the source texture format. |
Returns
Type | Description |
---|---|
DX12Texture | DXTexture with VorticeTexture as resource. |
GetDepthStencilView(uint, uint, uint)
Create a new DepthStencil view for this texture.
Declaration
public CpuDescriptorHandle GetDepthStencilView(uint firstSlice, uint sliceCount, uint mipSlice)
Parameters
Type | Name | Description |
---|---|---|
uint | firstSlice | The start 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)
Create a new rendertargetview for this texture.
Declaration
public CpuDescriptorHandle GetRenderTargetView(uint firstSlice, uint sliceCount, uint mipSlice)
Parameters
Type | Name | Description |
---|---|---|
uint | firstSlice | The start 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 RenderTargetView instance. |
GetShaderResourceView(uint, uint, uint)
Create a new ShaderResource view for this texture.
Declaration
public CpuDescriptorHandle GetShaderResourceView(uint firstSlice, uint sliceCount, uint mipSlice)
Parameters
Type | Name | Description |
---|---|---|
uint | firstSlice | The start 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)
Create 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, int)
Transition this texture to another native state.
Declaration
public void ResourceTransition(ID3D12GraphicsCommandList commandList, ResourceStates newResourceState, int subResource = 0)
Parameters
Type | Name | Description |
---|---|---|
ID3D12GraphicsCommandList | commandList | The commandlist used to execute the barrier transition. |
ResourceStates | newResourceState | The new native state for this texture. |
int | subResource | The subresource index. |
SetData(ID3D12GraphicsCommandList, IntPtr, uint, uint)
Fill the buffer from a pointer.
Declaration
public void SetData(ID3D12GraphicsCommandList commandList, IntPtr source, uint sourceSizeInBytes, uint subResource = 0)
Parameters
Type | Name | Description |
---|---|---|
ID3D12GraphicsCommandList | commandList | The CommandList where execute commands. |
IntPtr | source | The data pointer. |
uint | sourceSizeInBytes | The size in bytes. |
uint | subResource | The subresource index. |
ToStaging()
Return a new Buffer with ResourceUsage set to staging.
Declaration
public DX12Texture ToStaging()
Returns
Type | Description |
---|---|
DX12Texture | New staging Buffer. |