Class DynamicBufferProxy
- Namespace
- HelixToolkit.SharpDX.Utilities
- Assembly
- HelixToolkit.SharpDX.dll
public class DynamicBufferProxy : BufferProxyBase, IElementsBufferProxy, IBufferProxy, IDisposable
- Inheritance
-
DynamicBufferProxy
- Implements
- Derived
- Inherited Members
Constructors
DynamicBufferProxy(int, BindFlags, ResourceOptionFlags, bool)
public DynamicBufferProxy(int structureSize, BindFlags bindFlags, ResourceOptionFlags optionFlags = ResourceOptionFlags.None, bool lazyResize = true)
Parameters
structureSizeintbindFlagsBindFlagsoptionFlagsResourceOptionFlagslazyResizeboolIf existing data size is smaller than buffer size, reuse existing. Otherwise create a new buffer with exact same size
DynamicBufferProxy(int, BindFlags, bool, CpuAccessFlags, ResourceOptionFlags, bool)
Initializes a new instance of the DynamicBufferProxy class.
public DynamicBufferProxy(int structureSize, BindFlags bindFlags, bool canOverWrite, CpuAccessFlags cpuAccess, ResourceOptionFlags optionFlags = ResourceOptionFlags.None, bool lazyResize = true)
Parameters
structureSizeintSize of the structure.
bindFlagsBindFlagsThe bind flags.
canOverWriteboolif set to
true[can over write].cpuAccessCpuAccessFlagsThe cpu access.
optionFlagsResourceOptionFlagsThe option flags.
lazyResizeboolif set to
true[lazy resize].
DynamicBufferProxy(int, BindFlags, bool, ResourceOptionFlags, bool)
Initializes a new instance of the DynamicBufferProxy class.
public DynamicBufferProxy(int structureSize, BindFlags bindFlags, bool canOverWrite, ResourceOptionFlags optionFlags = ResourceOptionFlags.None, bool lazyResize = true)
Parameters
structureSizeintSize of the structure.
bindFlagsBindFlagsThe bind flags.
canOverWriteboolif set to
true[can over write].optionFlagsResourceOptionFlagsThe option flags.
lazyResizeboolif set to
true[lazy resize].
Fields
CanOverwrite
public readonly bool CanOverwrite
Field Value
LazyResize
public readonly bool LazyResize
Field Value
Properties
Capacity
Gets the capacity in bytes.
public int Capacity { get; }
Property Value
- int
The capacity.
CapacityUsed
Gets the capacity used in bytes.
public int CapacityUsed { get; }
Property Value
- int
The capacity used.
CpuAccess
public CpuAccessFlags CpuAccess { get; }
Property Value
- CpuAccessFlags
OptionFlags
public ResourceOptionFlags OptionFlags { get; }
Property Value
- ResourceOptionFlags
Methods
CreateBuffer(DeviceContextProxy, int)
Creates the buffer with size of count * structure size.
public void CreateBuffer(DeviceContextProxy context, int count)
Parameters
contextDeviceContextProxyThe context.
countintThe element count.
EnsureBufferCapacity(DeviceContextProxy, int, int)
Ensures the buffer capacity is enough.
public void EnsureBufferCapacity(DeviceContextProxy context, int count, int minSizeCount)
Parameters
contextDeviceContextProxyThe context.
countintThe count.
minSizeCountintThe minimum size count.
Initialize(Device, int, int)
Initializes the specified device.
public void Initialize(Device device, int count, int minBufferCount = 0)
Parameters
MapBuffer(DeviceContextProxy, Action<DataBox>)
Maps the buffer. Make sure to call EnsureBufferCapacity(DeviceContextProxy, int, int) to make sure buffer has enough space
public void MapBuffer(DeviceContextProxy context, Action<DataBox> action)
Parameters
contextDeviceContextProxyThe context.
actionAction<DataBox>The action.
OnBufferChanged(Buffer)
protected virtual void OnBufferChanged(Buffer newBuffer)
Parameters
newBufferBuffer
OnDispose(bool)
Disposes of object resources.
protected override void OnDispose(bool disposeManagedResources)
Parameters
disposeManagedResourcesboolIf true, managed resources should be disposed of in addition to unmanaged resources.
UploadDataToBuffer(DeviceContextProxy, nint, int, int, int)
Uploads the data pointer to buffer.
public void UploadDataToBuffer(DeviceContextProxy context, nint data, int byteCount, int byteOffset, int minBufferSizeByBytes = 0)
Parameters
contextDeviceContextProxyThe context.
datanintThe data.
byteCountintThe count by bytes.
byteOffsetintThe offset by bytes.
minBufferSizeByBytesintThe minimum buffer count by bytes.
UploadDataToBuffer<T>(DeviceContextProxy, IList<T>, int)
public void UploadDataToBuffer<T>(DeviceContextProxy context, IList<T> data, int count) where T : unmanaged
Parameters
contextDeviceContextProxydataIList<T>countint
Type Parameters
T
UploadDataToBuffer<T>(DeviceContextProxy, IList<T>, int, int, int)
public void UploadDataToBuffer<T>(DeviceContextProxy context, IList<T> data, int count, int offset, int minBufferCount = 0) where T : unmanaged
Parameters
contextDeviceContextProxydataIList<T>countintData Count
offsetintminBufferCountintUsed to create a dynamic buffer with size of Max(count, minBufferCount).
Type Parameters
T