Ejemplo n.º 1
0
    private void CopyUnsafe(GraphicsTextureView destination, GraphicsBufferView source)
    {
        var d3d12DestinationTextureCopyLocation = new D3D12_TEXTURE_COPY_LOCATION(destination.Resource.D3D12Resource, Sub: destination.D3D12SubresourceIndex);

        var d3d12SourceTextureCopyLocation = new D3D12_TEXTURE_COPY_LOCATION(source.Resource.D3D12Resource, in destination.D3D12PlacedSubresourceFootprints[0]);

        d3d12SourceTextureCopyLocation.PlacedFootprint.Offset = source.ByteOffset;

        D3D12GraphicsCommandList->CopyTextureRegion(&d3d12DestinationTextureCopyLocation, DstX: 0, DstY: 0, DstZ: 0, &d3d12SourceTextureCopyLocation, pSrcBox: null);
    }
Ejemplo n.º 2
0
    /// <summary>Copies the contents from a buffer view to a texture view.</summary>
    /// <param name="destination">The destination texture view.</param>
    /// <param name="source">The source buffer view.</param>
    /// <exception cref="ArgumentNullException"><paramref name="destination" /> is <c>null</c>.</exception>
    /// <exception cref="ArgumentNullException"><paramref name="source" /> is <c>null</c>.</exception>
    /// <exception cref="ArgumentOutOfRangeException">The size <paramref name="destination" /> is less than the size of <paramref name="source" />.</exception>
    /// <exception cref="ObjectDisposedException">The copy context has been disposed.</exception>
    public void Copy(GraphicsTextureView destination, GraphicsBufferView source)
    {
        ThrowIfDisposed();

        ThrowIfNull(destination);
        ThrowIfNull(source);

        ThrowIfNotInInsertBounds(source.ByteLength, destination.ByteLength);

        CopyUnsafe(destination, source);
    }