Stride

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

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

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

    Buffer<T> Class

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

    A buffer with typed information.

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

    public class Buffer<T> : Buffer, IDisposable, IComponent, IReferencable, ICollectorHolder where T : struct
    Type Parameters
    Name Description
    T

    Type of an element of this buffer.

    Name Description
    Constructors
    Buffer(GraphicsDevice, BufferDescription, BufferFlags, PixelFormat, IntPtr)
    Fields
    ElementSize

    Gets the size of element T.

    Methods
    GetData(CommandList)

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

    SetData(CommandList, ref T, Int32)

    Copies the content of a single structure data from CPU memory to this buffer into GPU memory.

    SetData(CommandList, T[], Int32)

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

    | Improve this Doc View Source

    Constructors


    Buffer(GraphicsDevice, BufferDescription, BufferFlags, PixelFormat, IntPtr)

    protected Buffer(GraphicsDevice device, BufferDescription description, BufferFlags viewFlags, PixelFormat viewFormat, IntPtr dataPointer)
    Parameters
    Type Name Description
    GraphicsDevice device
    BufferDescription description
    BufferFlags viewFlags
    PixelFormat viewFormat
    System.IntPtr dataPointer
    | Improve this Doc View Source

    Fields


    ElementSize

    Gets the size of element T.

    public readonly int ElementSize
    Field Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    Methods


    GetData(CommandList)

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

    public T[] GetData(CommandList commandList)
    Parameters
    Type Name Description
    CommandList commandList
    Returns
    Type Description
    T[]

    An array of 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.


    SetData(CommandList, ref T, Int32)

    Copies the content of a single structure data from CPU memory to this buffer into GPU memory.

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

    The data to copy from.

    System.Int32 offsetInBytes

    The offset in bytes to write to.

    Remarks

    This method is only working when called from the main thread that is accessing the main GraphicsDevice. See the unmanaged documentation about Map/UnMap for usage and restrictions.

    Exceptions
    Type Condition
    System.ArgumentException

    SetData(CommandList, T[], Int32)

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

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

    The data to copy from.

    System.Int32 offsetInBytes

    The offset in bytes to write to.

    Remarks

    This method is only working when called from the main thread that is accessing the main GraphicsDevice. See the unmanaged documentation about Map/UnMap for usage and restrictions.


    Inherited Members

    Buffer.elementCount
    Buffer.Description
    Buffer.Usage
    Buffer.Flags
    Buffer.SizeInBytes
    Buffer.StructureByteStride
    Buffer.ElementCount
    Buffer.ViewFlags
    Buffer.ViewFormat
    Buffer.InitialCounterOffset
    Buffer.ToStaging()
    Buffer.Clone()
    Buffer.GetData<TData>(CommandList)
    Buffer.GetData<TData>(CommandList, TData[])
    Buffer.GetData<TData>(CommandList, TData)
    Buffer.GetData<TData>(CommandList, Buffer, TData)
    Buffer.GetData<TData>(CommandList, Buffer, TData[])
    Buffer.SetData<TData>(CommandList, TData, Int32)
    Buffer.SetData<TData>(CommandList, TData[], Int32)
    Buffer.GetData(CommandList, Buffer, DataPointer)
    Buffer.SetData(CommandList, DataPointer, Int32)
    Buffer.New(GraphicsDevice, BufferDescription, PixelFormat)
    Buffer.New(GraphicsDevice, Int32, BufferFlags, GraphicsResourceUsage)
    Buffer.New<T>(GraphicsDevice, Int32, BufferFlags, GraphicsResourceUsage)
    Buffer.New(GraphicsDevice, Int32, BufferFlags, PixelFormat, GraphicsResourceUsage)
    Buffer.New(GraphicsDevice, Int32, Int32, BufferFlags, GraphicsResourceUsage)
    Buffer.New(GraphicsDevice, Int32, Int32, BufferFlags, PixelFormat, GraphicsResourceUsage)
    Buffer.New<T>(GraphicsDevice, T, BufferFlags, GraphicsResourceUsage)
    Buffer.New<T>(GraphicsDevice, T, BufferFlags, PixelFormat, GraphicsResourceUsage)
    Buffer.New<T>(GraphicsDevice, T[], BufferFlags, GraphicsResourceUsage)
    Buffer.New<T>(GraphicsDevice, T[], BufferFlags, PixelFormat, GraphicsResourceUsage)
    Buffer.New(GraphicsDevice, Byte[], Int32, BufferFlags, PixelFormat, GraphicsResourceUsage)
    Buffer.New(GraphicsDevice, DataPointer, Int32, BufferFlags, GraphicsResourceUsage)
    Buffer.New(GraphicsDevice, DataPointer, Int32, BufferFlags, PixelFormat, GraphicsResourceUsage)
    Buffer.RecreateWith<T>(T[])
    Buffer.RecreateWith(IntPtr)
    Buffer.Recreate<T>(T[])
    Buffer.InitializeFromImpl(BufferDescription, BufferFlags, PixelFormat, IntPtr)
    Buffer.OnDestroyed()
    Buffer.OnRecreate()
    Buffer.Recreate(IntPtr)
    Buffer.OnNameChanged()
    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