using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace SharpDX.Direct3D12
{
///
///
Describes a portion of a texture for the purpose of texture copies.
///
///
///
Use this structure with CopyTextureRegion.
///
///
/// dn903818
/// D3D12_TEXTURE_COPY_LOCATION
/// D3D12_TEXTURE_COPY_LOCATION
public partial struct TextureCopyLocation
{
///
/// No documentation.
///
///
/// ID3D12Resource* pResource
/// ID3D12Resource pResource
private System.IntPtr PResource;
///
/// No documentation.
///
///
/// D3D12_TEXTURE_COPY_TYPE Type
/// D3D12_TEXTURE_COPY_TYPE Type
public SharpDX.Direct3D12.TextureCopyType Type;
private Union union;
///
/// No documentation.
///
///
/// D3D12_PLACED_SUBRESOURCE_FOOTPRINT PlacedFootprint
/// D3D12_PLACED_SUBRESOURCE_FOOTPRINT PlacedFootprint
public SharpDX.Direct3D12.PlacedSubResourceFootprint PlacedFootprint
{
get { return union.PlacedFootprint; }
set { union.PlacedFootprint = value; }
}
///
/// No documentation.
///
///
/// unsigned int SubresourceIndex
/// unsigned int SubresourceIndex
public int SubresourceIndex
{
get { return union.SubResourceIndex; }
set { union.SubResourceIndex = value; }
}
///
/// Creates a new resource copy that is represented by a subresource index
///
/// A valid Direct3D12 Resource
/// Sub resource index
public TextureCopyLocation(SharpDX.Direct3D12.Resource resource, int subResourceIndex) : this()
{
Type = TextureCopyType.SubResourceIndex;
PResource = resource != null ? resource.NativePointer : IntPtr.Zero;
SubresourceIndex = subResourceIndex;
}
///
/// Creates a new resource copy that is represented by a resource footprint
///
/// A valid Direct3D12 Resource
/// Placement footprint for the resource copy operation
public TextureCopyLocation(SharpDX.Direct3D12.Resource resource, PlacedSubResourceFootprint placedFootprint) : this()
{
Type = TextureCopyType.PlacedFootprint;
PResource = resource != null ? resource.NativePointer : IntPtr.Zero;
PlacedFootprint = placedFootprint;
}
///
/// Because this union contains pointers, it is aligned on 8 bytes boundary, making the field ResourceBarrier.Type
/// to be aligned on 8 bytes instead of 4 bytes, so we can't use directly Explicit layout on ResourceBarrier
///
[StructLayout(LayoutKind.Explicit, Pack = 0)]
private partial struct Union
{
[FieldOffset(0)]
public SharpDX.Direct3D12.PlacedSubResourceFootprint PlacedFootprint;
[FieldOffset(0)]
public int SubResourceIndex;
}
}
}