VL - Custom Dynamic Buffer

yes, this follows now the pattern of the dynamic texture, there is FromSpread, FromArray and FromIntPtr. all expect the data as bytes:

download below

not that you need Buffer to read from raw buffers instead of StructuredBuffer in the shader code.

also it is best for performance to have structs that have a data alignment of 32 byte (128-bit). if your struct does not fit exactly you can pad with unused data to fill up to the next 32 byte.

struct Foo
{
    float4 Position;
    float  Radius;
    float pad0;
    float pad1;
    float pad2;
};

Buffer <Foo> FooBuf;

from: Understanding Structured Buffer Performance | NVIDIA Developer

2 Likes