Class Buffer<T>
A buffer with typed information.
public class Buffer<T> : Buffer, IDisposable, IComponent, IReferencable, ICollectorHolder where T : unmanaged
Type Parameters
TType of an element of this buffer.
- Inheritance
-
objectBuffer<T>
- Implements
- Inherited Members
- Extension Methods
Constructors
Buffer(GraphicsDevice, BufferDescription, BufferFlags, PixelFormat, nint)
protected Buffer(GraphicsDevice device, BufferDescription description, BufferFlags viewFlags, PixelFormat viewFormat, nint dataPointer)
Parameters
deviceGraphicsDevicedescriptionBufferDescriptionviewFlagsBufferFlagsviewFormatPixelFormatdataPointernint
Fields
ElementSize
Gets the size of element T.
public readonly int ElementSize
Field Value
Methods
GetData(CommandList)
Gets the content of this texture to an array of data.
public T[] GetData(CommandList commandList)
Parameters
commandListCommandList
Returns
- 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, int)
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
commandListCommandListfromDataTThe data to copy from.
offsetInBytesintThe 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
SetData(CommandList, T[], int)
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
commandListCommandListfromDataT[]The data to copy from.
offsetInBytesintThe 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.