ToBufferDescription (get elements from inner array) in VL

image

In an AsyncTask after treating and clearing my data I am constructing some DynamicBuffers (ToBufferDescription) and push them in my main vvvv patch. These Buffers are being consisted by “vector4” type Spreads.

image

What I am willing to do , before output them to my main vvvv patch, is to have the capability to pick specific elements or spreads of elements from these Dynamic Buffers (out of the async task without invoke it again), is it possible to pull out data from these dynamic buffers in VL ?

the solution looks pretty clear, you only need to learn how to define your own data type that takes everything you want to send as an input pin on Create (i see 6 inputs here, 4 buffer descriptions and two other links) and then make a few getters and/or one Split to get the data back from your data type where you need it.

did you watch the tutorial videos? especially the definition of the particle data type should be interesting to you.

Yes I watched it but I ll do it again, I use tuples in order to get the data out of the AsyncTask (as I saw in others examples of AsyncTask) and then split them so I can reach the DynamicBuffers I created in it. Although I dont get yet how to create my data type in this case so it can be compatible with the dynamic buffer definition.
I ll do my homework and I ll get back !

open the document patch and add a Record there and give it a name, or press Ctrl+P to make a new patch and set it to Record and give it a name both actions are the same.

the add pads to it, name it like stuff you want to store (Positions, Normals etc.) and add inputs and outputs for it and assign the inputs to Create and the outputs to new operations like GetPositions, Split etc.

Thank you @tonfilm I feel that I didnt explain it correctly, let me recap this because I have the sense that I am in a wrong path.
I already have as an output one item of type DynamicBufferDescription, that’s why I think that it refers in the case where I already had a spread of DynamicBufferDescription Items.
So the thing is, if I can access these 5755 elements of the SharpDX.Vector4 where the Dynamic Buffer derives from, after the async task and their composition.

image

or it is a matter of HLSL and DX anymore ?

for that there are a few solutions.

  • easiest is to make your data type that transports all data and can give you the spread or buffer description where you need it
  • output only the spreads and build the buffer description much later
  • hack it by adding VL.CoreLib.VVVV.dll to your vl document and use the DynamicBufferDescriptionSpread Data node to get the spread out of the description. this will need a Cast, because DynamicBufferDescription can also be IntPtr, Array or Stream…
1 Like

I was wondering which will be the best solution also, I thought that it will be much better to fit everything in the async task and create all the dynamic buffers in there, but if it is not a huge amount of load for VL to do them outside (since I want to avoid passing them as spreads to vvvv) then there is no reason to insist in a so complicated solution.

the ToBufferDescription is very cheap, building the spread is expensive and each pin to vvvv costs some overhead.

aha, very close on my reservations, thank you @tonfilm, I ll probably do the easiest for now and get the ToBufferDescription out of the async task.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.