# DynamicBuffer Custom Struct input

**URL:** <http://forum.vvvv.org/t/dynamicbuffer-custom-struct-input/25081>\
**Category:** question\
**Created:** [March 27, 2026, 4:18pm UTC](http://forum.vvvv.org/t/dynamicbuffer-custom-struct-input/25081 "2026-03-27T16:18:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pakreht](http://forum.vvvv.org/user_avatar/forum.vvvv.org/pakreht/32/18717_2.png) [@pakreht](http://forum.vvvv.org/u/pakreht)\
**Post date:** [March 27, 2026, 4:18pm UTC](http://forum.vvvv.org/t/dynamicbuffer-custom-struct-input/25081/1 "2026-03-27T16:18:48Z")

</div>

Hello,  
Wondering how to create a custom Struct as input to `DynamicBuffer [Stride.Buffer]` (setting `IsStructuredBuffer` as **True** ).

Goal is to then feed this Buffer to a DrawShader (custom `.sdsl` shader).

Tryed with Record but does not seem to be recognized by `DynamicBuffer`, “Unable to resolve adaptive node SetGraphicsData”.

Seems like the solution would be to create the struct with raw C# ? Or is there a non-C# solution?

Already prepared the structure on the .hlsl side

```C
shader Shatter_FL
{
    struct Shatter
    {
        float3 Pos;
        float3 Dir;
        float Str;
        int LineID;
    };
};

```

Thanks!

---

<div class="post-metadata">

**Author:** ![Elias](http://forum.vvvv.org/letter_avatar_proxy/v2/letter/e/999999/32.png) [@Elias](http://forum.vvvv.org/u/Elias)\
**Post date:** [March 27, 2026, 4:28pm UTC](http://forum.vvvv.org/t/dynamicbuffer-custom-struct-input/25081/2 "2026-03-27T16:28:00Z")

</div>

Yes, you’ll need to define the struct in C# - VL does not have that option.

---

<div class="post-metadata">

**Author:** ![pakreht](http://forum.vvvv.org/user_avatar/forum.vvvv.org/pakreht/32/18717_2.png) [@pakreht](http://forum.vvvv.org/u/pakreht)\
**Post date:** [March 27, 2026, 5:46pm UTC](http://forum.vvvv.org/t/dynamicbuffer-custom-struct-input/25081/3 "2026-03-27T17:46:05Z")

</div>

Followed the beginning of [Writing Nodes with C# - vvvvTv S02 E05](https://www.youtube.com/live/LZ-y5FOrdh0)

Then Written this code in `Utils.cs`:

```auto
using System.Runtime.InteropServices;
using Stride.Core.Mathematics; // provide Vector3

namespace Main;

// /// <summary>
// /// Mirrors the HLSL Shatter struct from shaders/Shatter_FL.sdsl
// /// Layout: sequential, Pack=4, total 32 bytes.
// /// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct Shatter
{
    public Vector3 Pos;
    public Vector3 Dir;
    public float Str;
    public int LineID;

    public Shatter(Vector3 pos, Vector3 dir, float str, int lineID)
    {
        Pos = pos;
        Dir = dir;
        Str = str;
        LineID = lineID;
    }
}

```

Then used the Struct constructor inside the loop, and everything seem to be working :

 ![image](http://forum.vvvv.org/uploads/default/original/3X/f/7/f76887210a22d01a7fe3b76ff7fa4b8cd039d2d2.png)

•ᴗ•

---

<div class="post-metadata">

**Author:** ![yar](http://forum.vvvv.org/user_avatar/forum.vvvv.org/yar/32/327_2.png) [@yar](http://forum.vvvv.org/u/yar)\
**Post date:** [April 1, 2026, 1:48pm UTC](http://forum.vvvv.org/t/dynamicbuffer-custom-struct-input/25081/4 "2026-04-01T13:48:15Z")

</div>

btw, is this efficient?  
Do I understand correctly that, when working with immutable objects, it wouldn’t involve recreating every frame in such a setup? @Elias

---

<div class="post-metadata">

**Author:** ![pakreht](http://forum.vvvv.org/user_avatar/forum.vvvv.org/pakreht/32/18717_2.png) [@pakreht](http://forum.vvvv.org/u/pakreht)\
**Post date:** [April 1, 2026, 2:07pm UTC](http://forum.vvvv.org/t/dynamicbuffer-custom-struct-input/25081/5 "2026-04-01T14:07:17Z")

</div>

I used a cache in the final setup

But this mean I still recreate the struct every time the cache is triggered  
Maybe calling create once and then using an `Update` method to change the attributes without recreating a new struct would be better ?
