Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    Buffer Class

    Namespace: Stride.Graphics
    Assembly: Stride.Graphics.dll

    All-in-One Buffer class linked SharpDX.Direct3D11.Buffer.

    System.Object → DisposeBase → ComponentBase → GraphicsResourceBase → GraphicsResource → Buffer
    Derived from Buffer: Buffer<T>

    [DataSerializer(typeof(BufferSerializer))]
    [DataSerializerGlobal(typeof(ReferenceSerializer<Buffer>), null, DataSerializerGenericMode.None, false, false, Profile = "Content")]
    [ContentSerializer(typeof(DataContentSerializer<Buffer>))]
    public class Buffer : GraphicsResource, IDisposable, IComponent, IReferencable, ICollectorHolder
    Remarks

    This class is able to create constant buffers, indexelementCountrtex buffers, structured buffer, raw buffers, argument buffers.

    Name Description
    Constructors
    Buffer()
    Buffer(GraphicsDevice)

    Initializes a new instance of the Buffer class.

    Fields
    elementCount
    Properties
    Description

    Gets the description of this buffer.

    ElementCount

    Gets the number of elements.

    Flags

    Buffer flags describing the type of buffer.

    InitialCounterOffset

    The initial Append/Consume buffer counter offset. A value of -1 indicates the current offset should be kept. Any other values set the hidden counter for that Appendable/Consumable Buffer. This value is only relevant for Buffers which have the 'Append' or 'Counter' flag, otherwise it is ignored. The value get's initialized to -1.

    SizeInBytes

    Gets the size of the buffer in bytes.

    StructureByteStride

    The size of the structure (in bytes) when it represents a structured/typed buffer.

    Usage

    Value that identifies how the buffer is to be read from and written to.

    ViewFlags

    Gets the type of this buffer view.

    ViewFormat

    Gets the format of this buffer view.

    Methods
    Clone()

    Clones this instance.

    GetData(CommandList, Buffer, DataPointer)

    Copies the content of this buffer from GPU memory to a CPU memory using a specific staging resource.

    GetData<TData>(CommandList)

    Gets the content of this buffer to an array of data.

    GetData<TData>(CommandList, ref TData)

    Copies the content of this buffer to an array of data.

    GetData<TData>(CommandList, TData[])

    Copies the content of this buffer to an array of data.

    GetData<TData>(CommandList, Buffer, ref TData)

    Copies the content of this buffer from GPU memory to an array of data on CPU memory using a specific staging resource.

    GetData<TData>(CommandList, Buffer, TData[])

    Copies the content of this buffer from GPU memory to an array of data on CPU memory using a specific staging resource.

    InitializeFromImpl(BufferDescription, BufferFlags, PixelFormat, IntPtr)

    Initializes a new instance of the Buffer class.

    New(GraphicsDevice, BufferDescription, PixelFormat)

    Creates a new Buffer instance.

    New(GraphicsDevice, DataPointer, Int32, BufferFlags, GraphicsResourceUsage)

    Creates a new Buffer instance.

    New(GraphicsDevice, DataPointer, Int32, BufferFlags, PixelFormat, GraphicsResourceUsage)

    Creates a new Buffer instance.

    New(GraphicsDevice, Byte[], Int32, BufferFlags, PixelFormat, GraphicsResourceUsage)

    Creates a new Buffer instance from a byte array.

    New(GraphicsDevice, Int32, BufferFlags, GraphicsResourceUsage)

    Creates a new Buffer instance.

    New(GraphicsDevice, Int32, BufferFlags, PixelFormat, GraphicsResourceUsage)

    Creates a new Buffer instance.

    New(GraphicsDevice, Int32, Int32, BufferFlags, GraphicsResourceUsage)

    Creates a new Buffer instance.

    New(GraphicsDevice, Int32, Int32, BufferFlags, PixelFormat, GraphicsResourceUsage)

    Creates a new Buffer instance.

    New<T>(GraphicsDevice, ref T, BufferFlags, GraphicsResourceUsage)

    Creates a new Buffer instance.

    New<T>(GraphicsDevice, ref T, BufferFlags, PixelFormat, GraphicsResourceUsage)

    Creates a new Buffer instance.

    New<T>(GraphicsDevice, T[], BufferFlags, GraphicsResourceUsage)

    Creates a new Buffer instance.

    New<T>(GraphicsDevice, T[], BufferFlags, PixelFormat, GraphicsResourceUsage)

    Creates a new Buffer instance.

    New<T>(GraphicsDevice, Int32, BufferFlags, GraphicsResourceUsage)

    Creates a new Buffer instance.

    OnDestroyed()
    OnNameChanged()
    OnRecreate()

    Called when graphics device has been recreated.

    Recreate(IntPtr)

    Explicitly recreate buffer with given data. Usually called after a GraphicsDevice reset.

    Recreate<T>(T[])

    Explicitly recreate buffer with given data. Usually called after a GraphicsDevice reset.

    RecreateWith(IntPtr)

    Reload Buffer from given data if GraphicsDevice has been reset.

    RecreateWith<T>(T[])

    Reload Buffer from given data if GraphicsDevice has been reset.

    SetData(CommandList, DataPointer, Int32)

    Copies the content an array of data on CPU memory to this buffer into GPU memory.

    SetData<TData>(CommandList, ref TData, Int32)

    Copies the content an array of data on CPU memory to this buffer into GPU memory.

    SetData<TData>(CommandList, TData[], Int32)

    Copies the content an array of data on CPU memory to this buffer into GPU memory.

    ToStaging()

    Return an equivalent staging texture CPU read-writable from this instance.

    | Improve this Doc View Source

    Constructors


    Buffer()

    public Buffer()

    Buffer(GraphicsDevice)

    Initializes a new instance of the Buffer class.

    protected Buffer(GraphicsDevice device)
    Parameters
    Type Name Description
    GraphicsDevice device

    The GraphicsDevice.

    | Improve this Doc View Source

    Fields


    elementCount

    protected int elementCount
    Field Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    Properties


    Description

    Gets the description of this buffer.

    public BufferDescription Description { get; }
    Property Value
    Type Description
    BufferDescription

    ElementCount

    Gets the number of elements.

    public int ElementCount { get; protected set; }
    Property Value
    Type Description
    System.Int32
    Remarks

    This value is valid for structured buffers, raw buffers and index buffers that are used as a SharedResourceView.


    Flags

    Buffer flags describing the type of buffer.

    public BufferFlags Flags { get; }
    Property Value
    Type Description
    BufferFlags

    InitialCounterOffset

    The initial Append/Consume buffer counter offset. A value of -1 indicates the current offset should be kept. Any other values set the hidden counter for that Appendable/Consumable Buffer. This value is only relevant for Buffers which have the 'Append' or 'Counter' flag, otherwise it is ignored. The value get's initialized to -1.

    public int InitialCounterOffset { get; set; }
    Property Value
    Type Description
    System.Int32

    SizeInBytes

    Gets the size of the buffer in bytes.

    public int SizeInBytes { get; }
    Property Value
    Type Description
    System.Int32

    The size of the buffer in bytes.


    StructureByteStride

    The size of the structure (in bytes) when it represents a structured/typed buffer.

    public int StructureByteStride { get; }
    Property Value
    Type Description
    System.Int32

    Usage

    Value that identifies how the buffer is to be read from and written to.

    public GraphicsResourceUsage Usage { get; }
    Property Value
    Type Description
    GraphicsResourceUsage

    ViewFlags

    Gets the type of this buffer view.

    public BufferFlags ViewFlags { get; }
    Property Value
    Type Description
    BufferFlags

    ViewFormat

    Gets the format of this buffer view.

    public PixelFormat ViewFormat { get; }
    Property Value
    Type Description
    PixelFormat
    | Improve this Doc View Source

    Methods


    Clone()

    Clones this instance.

    public Buffer Clone()
    Returns
    Type Description
    Buffer

    A clone of this instance

    Remarks

    This method will not copy the content of the buffer to the clone


    GetData(CommandList, Buffer, DataPointer)

    Copies the content of this buffer from GPU memory to a CPU memory using a specific staging resource.

    public void GetData(CommandList commandList, Buffer stagingTexture, DataPointer toData)
    Parameters
    Type Name Description
    CommandList commandList
    Buffer stagingTexture

    The staging buffer used to transfer the buffer.

    DataPointer toData

    To data pointer.

    Remarks

    This method is only working when called from the main thread that is accessing the main GraphicsDevice.

    Exceptions
    Type Condition
    System.ArgumentException

    When strides is different from optimal strides, and TData is not the same size as the pixel format, or Width * Height != toData.Length


    GetData<TData>(CommandList)

    Gets the content of this buffer to an array of data.

    public TData[] GetData<TData>(CommandList commandList)
        where TData : struct
    Parameters
    Type Name Description
    CommandList commandList
    Returns
    Type Description
    TData[]
    Type Parameters
    Name Description
    TData

    The type of the T data.

    Remarks

    This method is only working when called from the main thread that is accessing the main GraphicsDevice. This method creates internally a stagging resource if this texture is not already a stagging resouce, copies to it and map it to memory. Use method with explicit staging resource for optimal performances.


    GetData<TData>(CommandList, ref TData)

    Copies the content of this buffer to an array of data.

    public void GetData<TData>(CommandList commandList, ref TData toData)
        where TData : struct
    Parameters
    Type Name Description
    CommandList commandList
    TData toData

    The destination buffer to receive a copy of the texture datas.

    Type Parameters
    Name Description
    TData

    The type of the T data.

    Remarks

    This method is only working when called from the main thread that is accessing the main GraphicsDevice. This method creates internally a stagging resource if this texture is not already a stagging resouce, copies to it and map it to memory. Use method with explicit staging resource for optimal performances.


    GetData<TData>(CommandList, TData[])

    Copies the content of this buffer to an array of data.

    public void GetData<TData>(CommandList commandList, TData[] toData)
        where TData : struct
    Parameters
    Type Name Description
    CommandList commandList
    TData[] toData

    The destination buffer to receive a copy of the texture datas.

    Type Parameters
    Name Description
    TData

    The type of the T data.

    Remarks

    This method is only working when called from the main thread that is accessing the main GraphicsDevice. This method creates internally a stagging resource if this texture is not already a stagging resouce, copies to it and map it to memory. Use method with explicit staging resource for optimal performances.


    GetData<TData>(CommandList, Buffer, ref TData)

    Copies the content of this buffer from GPU memory to an array of data on CPU memory using a specific staging resource.

    public void GetData<TData>(CommandList commandList, Buffer stagingTexture, ref TData toData)
        where TData : struct
    Parameters
    Type Name Description
    CommandList commandList
    Buffer stagingTexture

    The staging buffer used to transfer the buffer.

    TData toData

    To data.

    Type Parameters
    Name Description
    TData

    The type of the T data.

    Remarks

    This method is only working when called from the main thread that is accessing the main GraphicsDevice.

    Exceptions
    Type Condition
    System.ArgumentException

    When strides is different from optimal strides, and TData is not the same size as the pixel format, or Width * Height != toData.Length


    GetData<TData>(CommandList, Buffer, TData[])

    Copies the content of this buffer from GPU memory to an array of data on CPU memory using a specific staging resource.

    public void GetData<TData>(CommandList commandList, Buffer stagingTexture, TData[] toData)
        where TData : struct
    Parameters
    Type Name Description
    CommandList commandList
    Buffer stagingTexture

    The staging buffer used to transfer the buffer.

    TData[] toData

    To data.

    Type Parameters
    Name Description
    TData

    The type of the T data.

    Remarks

    This method is only working when called from the main thread that is accessing the main GraphicsDevice.

    Exceptions
    Type Condition
    System.ArgumentException

    When strides is different from optimal strides, and TData is not the same size as the pixel format, or Width * Height != toData.Length


    InitializeFromImpl(BufferDescription, BufferFlags, PixelFormat, IntPtr)

    Initializes a new instance of the Buffer class.

    protected Buffer InitializeFromImpl(BufferDescription description, BufferFlags viewFlags, PixelFormat viewFormat, IntPtr dataPointer)
    Parameters
    Type Name Description
    BufferDescription description

    The description.

    BufferFlags viewFlags

    Type of the buffer.

    PixelFormat viewFormat

    The view format.

    System.IntPtr dataPointer

    The data pointer.

    Returns
    Type Description
    Buffer

    New(GraphicsDevice, BufferDescription, PixelFormat)

    Creates a new Buffer instance.

    public static Buffer New(GraphicsDevice device, BufferDescription description, PixelFormat viewFormat = PixelFormat.None)
    Parameters
    Type Name Description
    GraphicsDevice device

    The GraphicsDevice.

    BufferDescription description

    The description of the buffer.

    PixelFormat viewFormat

    View format used if the buffer is used as a shared resource view.

    Returns
    Type Description
    Buffer

    An instance of a new Buffer


    New(GraphicsDevice, DataPointer, Int32, BufferFlags, GraphicsResourceUsage)

    Creates a new Buffer instance.

    public static Buffer New(GraphicsDevice device, DataPointer dataPointer, int elementSize, BufferFlags bufferFlags, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
    Parameters
    Type Name Description
    GraphicsDevice device

    The GraphicsDevice.

    DataPointer dataPointer

    The data pointer.

    System.Int32 elementSize

    Size of the element.

    BufferFlags bufferFlags

    The buffer flags to specify the type of buffer.

    GraphicsResourceUsage usage

    The usage.

    Returns
    Type Description
    Buffer

    An instance of a new Buffer


    New(GraphicsDevice, DataPointer, Int32, BufferFlags, PixelFormat, GraphicsResourceUsage)

    Creates a new Buffer instance.

    public static Buffer New(GraphicsDevice device, DataPointer dataPointer, int elementSize, BufferFlags bufferFlags, PixelFormat viewFormat, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
    Parameters
    Type Name Description
    GraphicsDevice device

    The GraphicsDevice.

    DataPointer dataPointer

    The data pointer.

    System.Int32 elementSize

    Size of the element.

    BufferFlags bufferFlags

    The buffer flags to specify the type of buffer.

    PixelFormat viewFormat

    The view format must be specified if the buffer is declared as a shared resource view.

    GraphicsResourceUsage usage

    The usage.

    Returns
    Type Description
    Buffer

    An instance of a new Buffer


    New(GraphicsDevice, Byte[], Int32, BufferFlags, PixelFormat, GraphicsResourceUsage)

    Creates a new Buffer instance from a byte array.

    public static Buffer New(GraphicsDevice device, byte[] initialValue, int elementSize, BufferFlags bufferFlags, PixelFormat viewFormat = PixelFormat.None, GraphicsResourceUsage usage = GraphicsResourceUsage.Immutable)
    Parameters
    Type Name Description
    GraphicsDevice device

    The GraphicsDevice.

    System.Byte[] initialValue

    The initial value of this buffer.

    System.Int32 elementSize

    Size of an element. Must be equal to 2 or 4 for an index buffer, or to the size of a struct for a structured/typed buffer. Can be set to 0 for other buffers.

    BufferFlags bufferFlags

    The buffer flags to specify the type of buffer.

    PixelFormat viewFormat

    The view format must be specified if the buffer is declared as a shared resource view.

    GraphicsResourceUsage usage

    The usage.

    Returns
    Type Description
    Buffer

    An instance of a new Buffer


    New(GraphicsDevice, Int32, BufferFlags, GraphicsResourceUsage)

    Creates a new Buffer instance.

    public static Buffer New(GraphicsDevice device, int bufferSize, BufferFlags bufferFlags, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
    Parameters
    Type Name Description
    GraphicsDevice device

    The GraphicsDevice.

    System.Int32 bufferSize

    Size of the buffer in bytes.

    BufferFlags bufferFlags

    The buffer flags to specify the type of buffer.

    GraphicsResourceUsage usage

    The usage.

    Returns
    Type Description
    Buffer

    An instance of a new Buffer


    New(GraphicsDevice, Int32, BufferFlags, PixelFormat, GraphicsResourceUsage)

    Creates a new Buffer instance.

    public static Buffer New(GraphicsDevice device, int bufferSize, BufferFlags bufferFlags, PixelFormat viewFormat, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
    Parameters
    Type Name Description
    GraphicsDevice device

    The GraphicsDevice.

    System.Int32 bufferSize

    Size of the buffer in bytes.

    BufferFlags bufferFlags

    The buffer flags to specify the type of buffer.

    PixelFormat viewFormat

    The view format must be specified if the buffer is declared as a shared resource view.

    GraphicsResourceUsage usage

    The usage.

    Returns
    Type Description
    Buffer

    An instance of a new Buffer


    New(GraphicsDevice, Int32, Int32, BufferFlags, GraphicsResourceUsage)

    Creates a new Buffer instance.

    public static Buffer New(GraphicsDevice device, int bufferSize, int elementSize, BufferFlags bufferFlags, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
    Parameters
    Type Name Description
    GraphicsDevice device

    The GraphicsDevice.

    System.Int32 bufferSize

    Size of the buffer in bytes.

    System.Int32 elementSize

    Size of an element in the buffer.

    BufferFlags bufferFlags

    The buffer flags to specify the type of buffer.

    GraphicsResourceUsage usage

    The usage.

    Returns
    Type Description
    Buffer

    An instance of a new Buffer


    New(GraphicsDevice, Int32, Int32, BufferFlags, PixelFormat, GraphicsResourceUsage)

    Creates a new Buffer instance.

    public static Buffer New(GraphicsDevice device, int bufferSize, int elementSize, BufferFlags bufferFlags, PixelFormat viewFormat, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
    Parameters
    Type Name Description
    GraphicsDevice device

    The GraphicsDevice.

    System.Int32 bufferSize

    Size of the buffer in bytes.

    System.Int32 elementSize

    Size of an element in the buffer.

    BufferFlags bufferFlags

    The buffer flags to specify the type of buffer.

    PixelFormat viewFormat

    The view format must be specified if the buffer is declared as a shared resource view.

    GraphicsResourceUsage usage

    The usage.

    Returns
    Type Description
    Buffer

    An instance of a new Buffer


    New<T>(GraphicsDevice, ref T, BufferFlags, GraphicsResourceUsage)

    Creates a new Buffer instance.

    public static Buffer<T> New<T>(GraphicsDevice device, ref T value, BufferFlags bufferFlags, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
        where T : struct
    Parameters
    Type Name Description
    GraphicsDevice device

    The GraphicsDevice.

    T value

    The initial value of this buffer.

    BufferFlags bufferFlags

    The buffer flags to specify the type of buffer.

    GraphicsResourceUsage usage

    The usage.

    Returns
    Type Description
    Buffer<T>

    An instance of a new Buffer

    Type Parameters
    Name Description
    T

    Type of the buffer, to get the sizeof from.


    New<T>(GraphicsDevice, ref T, BufferFlags, PixelFormat, GraphicsResourceUsage)

    Creates a new Buffer instance.

    public static Buffer<T> New<T>(GraphicsDevice device, ref T value, BufferFlags bufferFlags, PixelFormat viewFormat, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
        where T : struct
    Parameters
    Type Name Description
    GraphicsDevice device

    The GraphicsDevice.

    T value

    The initial value of this buffer.

    BufferFlags bufferFlags

    The buffer flags to specify the type of buffer.

    PixelFormat viewFormat

    The view format must be specified if the buffer is declared as a shared resource view.

    GraphicsResourceUsage usage

    The usage.

    Returns
    Type Description
    Buffer<T>

    An instance of a new Buffer

    Type Parameters
    Name Description
    T

    Type of the buffer, to get the sizeof from.


    New<T>(GraphicsDevice, T[], BufferFlags, GraphicsResourceUsage)

    Creates a new Buffer instance.

    public static Buffer<T> New<T>(GraphicsDevice device, T[] initialValue, BufferFlags bufferFlags, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
        where T : struct
    Parameters
    Type Name Description
    GraphicsDevice device

    The GraphicsDevice.

    T[] initialValue

    The initial value of this buffer.

    BufferFlags bufferFlags

    The buffer flags to specify the type of buffer.

    GraphicsResourceUsage usage

    The usage.

    Returns
    Type Description
    Buffer<T>

    An instance of a new Buffer

    Type Parameters
    Name Description
    T

    Type of the buffer, to get the sizeof from.


    New<T>(GraphicsDevice, T[], BufferFlags, PixelFormat, GraphicsResourceUsage)

    Creates a new Buffer instance.

    public static Buffer<T> New<T>(GraphicsDevice device, T[] initialValue, BufferFlags bufferFlags, PixelFormat viewFormat, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
        where T : struct
    Parameters
    Type Name Description
    GraphicsDevice device

    The GraphicsDevice.

    T[] initialValue

    The initial value of this buffer.

    BufferFlags bufferFlags

    The buffer flags to specify the type of buffer.

    PixelFormat viewFormat

    The view format must be specified if the buffer is declared as a shared resource view.

    GraphicsResourceUsage usage

    The usage.

    Returns
    Type Description
    Buffer<T>

    An instance of a new Buffer

    Type Parameters
    Name Description
    T

    Type of the buffer, to get the sizeof from.


    New<T>(GraphicsDevice, Int32, BufferFlags, GraphicsResourceUsage)

    Creates a new Buffer instance.

    public static Buffer<T> New<T>(GraphicsDevice device, int elementCount, BufferFlags bufferFlags, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
        where T : struct
    Parameters
    Type Name Description
    GraphicsDevice device

    The GraphicsDevice.

    System.Int32 elementCount

    Number of T elment in this buffer.

    BufferFlags bufferFlags

    The buffer flags to specify the type of buffer.

    GraphicsResourceUsage usage

    The usage.

    Returns
    Type Description
    Buffer<T>

    An instance of a new Buffer

    Type Parameters
    Name Description
    T

    OnDestroyed()

    protected override void OnDestroyed()
    Overrides
    GraphicsResource.OnDestroyed()

    OnNameChanged()

    protected override void OnNameChanged()
    Overrides
    GraphicsResource.OnNameChanged()

    OnRecreate()

    Called when graphics device has been recreated.

    protected override bool OnRecreate()
    Returns
    Type Description
    System.Boolean

    True if item transitioned to a Active state.

    Overrides
    GraphicsResourceBase.OnRecreate()

    Recreate(IntPtr)

    Explicitly recreate buffer with given data. Usually called after a GraphicsDevice reset.

    public void Recreate(IntPtr dataPointer)
    Parameters
    Type Name Description
    System.IntPtr dataPointer

    Recreate<T>(T[])

    Explicitly recreate buffer with given data. Usually called after a GraphicsDevice reset.

    public void Recreate<T>(T[] dataPointer)
        where T : struct
    Parameters
    Type Name Description
    T[] dataPointer
    Type Parameters
    Name Description
    T

    RecreateWith(IntPtr)

    Reload Buffer from given data if GraphicsDevice has been reset.

    public Buffer RecreateWith(IntPtr dataPointer)
    Parameters
    Type Name Description
    System.IntPtr dataPointer

    The data pointer.

    Returns
    Type Description
    Buffer

    This instance.


    RecreateWith<T>(T[])

    Reload Buffer from given data if GraphicsDevice has been reset.

    public Buffer RecreateWith<T>(T[] dataPointer)
        where T : struct
    Parameters
    Type Name Description
    T[] dataPointer

    The data pointer.

    Returns
    Type Description
    Buffer

    This instance.

    Type Parameters
    Name Description
    T

    SetData(CommandList, DataPointer, Int32)

    Copies the content an array of data on CPU memory to this buffer into GPU memory.

    public void SetData(CommandList commandList, DataPointer fromData, int offsetInBytes = 0)
    Parameters
    Type Name Description
    CommandList commandList
    DataPointer fromData

    A data pointer.

    System.Int32 offsetInBytes

    The offset in bytes to write to.

    Remarks

    See the unmanaged documentation about Map/UnMap for usage and restrictions.

    Exceptions
    Type Condition
    System.ArgumentException

    SetData<TData>(CommandList, ref TData, Int32)

    Copies the content an array of data on CPU memory to this buffer into GPU memory.

    public void SetData<TData>(CommandList commandList, ref TData fromData, int offsetInBytes = 0)
        where TData : struct
    Parameters
    Type Name Description
    CommandList commandList
    TData fromData

    The data to copy from.

    System.Int32 offsetInBytes

    The offset in bytes to write to.

    Type Parameters
    Name Description
    TData

    The type of the T data.

    Remarks

    See the unmanaged documentation about Map/UnMap for usage and restrictions.

    Exceptions
    Type Condition
    System.ArgumentException

    SetData<TData>(CommandList, TData[], Int32)

    Copies the content an array of data on CPU memory to this buffer into GPU memory.

    public void SetData<TData>(CommandList commandList, TData[] fromData, int offsetInBytes = 0)
        where TData : struct
    Parameters
    Type Name Description
    CommandList commandList
    TData[] fromData

    The data to copy from.

    System.Int32 offsetInBytes

    The offset in bytes to write to.

    Type Parameters
    Name Description
    TData

    The type of the T data.

    Remarks

    See the unmanaged documentation about Map/UnMap for usage and restrictions.

    Exceptions
    Type Condition
    System.ArgumentException

    ToStaging()

    Return an equivalent staging texture CPU read-writable from this instance.

    public Buffer ToStaging()
    Returns
    Type Description
    Buffer

    A new instance of this buffer as a staging resource


    Inherited Members

    GraphicsResource.IsDebugMode
    GraphicsResource.NativeShaderResourceView
    GraphicsResource.NativeUnorderedAccessView
    GraphicsResourceBase.NativeResource
    GraphicsResourceBase.NativeDeviceChild
    GraphicsResourceBase.NativeDevice
    GraphicsResourceBase.Reload
    GraphicsResourceBase.GraphicsDevice
    GraphicsResourceBase.Destroyed
    GraphicsResourceBase.OnPause()
    GraphicsResourceBase.OnResume()
    GraphicsResourceBase.Destroy()
    ComponentBase.Tags
    ComponentBase.Name
    ComponentBase.ICollectorHolder.Collector
    ComponentBase.ToString()
    DisposeBase.Dispose()
    DisposeBase.IsDisposed
    DisposeBase.IReferencable.ReferenceCount
    DisposeBase.IReferencable.AddReference()
    DisposeBase.IReferencable.Release()
    DisposeBase.OnAddReference()
    DisposeBase.OnReleaseReference()

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    GraphicsSerializerExtensions.GetSerializationData(Buffer)
    GraphicsSerializerExtensions.SetSerializationData(Buffer, BufferData)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation