Table of Contents

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

structureSize int
bindFlags BindFlags
optionFlags ResourceOptionFlags
lazyResize bool

If 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

structureSize int

Size of the structure.

bindFlags BindFlags

The bind flags.

canOverWrite bool

if set to true [can over write].

cpuAccess CpuAccessFlags

The cpu access.

optionFlags ResourceOptionFlags

The option flags.

lazyResize bool

if 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

structureSize int

Size of the structure.

bindFlags BindFlags

The bind flags.

canOverWrite bool

if set to true [can over write].

optionFlags ResourceOptionFlags

The option flags.

lazyResize bool

if set to true [lazy resize].

Fields

CanOverwrite

public readonly bool CanOverwrite

Field Value

bool

LazyResize

public readonly bool LazyResize

Field Value

bool

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

context DeviceContextProxy

The context.

count int

The element count.

EnsureBufferCapacity(DeviceContextProxy, int, int)

Ensures the buffer capacity is enough.

public void EnsureBufferCapacity(DeviceContextProxy context, int count, int minSizeCount)

Parameters

context DeviceContextProxy

The context.

count int

The count.

minSizeCount int

The minimum size count.

Initialize(Device, int, int)

Initializes the specified device.

public void Initialize(Device device, int count, int minBufferCount = 0)

Parameters

device Device

The device.

count int

The count.

minBufferCount int

The minimum buffer count.

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

context DeviceContextProxy

The context.

action Action<DataBox>

The action.

OnBufferChanged(Buffer)

protected virtual void OnBufferChanged(Buffer newBuffer)

Parameters

newBuffer Buffer

OnDispose(bool)

Disposes of object resources.

protected override void OnDispose(bool disposeManagedResources)

Parameters

disposeManagedResources bool

If 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

context DeviceContextProxy

The context.

data nint

The data.

byteCount int

The count by bytes.

byteOffset int

The offset by bytes.

minBufferSizeByBytes int

The 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

context DeviceContextProxy
data IList<T>
count int

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

context DeviceContextProxy
data IList<T>
count int

Data Count

offset int
minBufferCount int

Used to create a dynamic buffer with size of Max(count, minBufferCount).

Type Parameters

T