Root scene throws error in async loop in 6.x

both versions in the image work in 5.2, the right version will throw an error in 6.x (tested 6.0-0300 and 0319)

callmenames-2024-03-27.vl (20.2 KB)

This can’t work. When you place a Stride node, we create a Stride game on the main thread. Accessing that game from a different thread is guaranteed disaster. I’d say it was pure luck that you didn’t get a crash in 5.x.


Correct, all interaction with the GPU should be from the main thread.

You could run multiple vvvv instances and send the textures via Spout, that would work better. But rendering textures in a background thread is not possible.

1 Like

aha, assumed something of that kind…so, when i want to render multiple scenes to textures, with individual scenes being potentially heavy, it all should happen on the main thread? can i optimize this performance-wise?

edit: @tonfilm haven’t seen your answer before…this is what I’m planning to do, sending each scene via spout to resolume…was hoping i could avoid running multiple vvvv instances though, did this already for years with beta…

In the end it’s all draw calls on the GPU, they will be sequential anyways.

The best way to optimize this is to render each scene after the other. For instance by putting each one in it’s own node.

Just be aware that update just sends a list of instructions to Stride. The actual rendering and GPU calls will happen after the update of the main loop is finished. The next update will start when all draw calls are dispatched to the GPU.

To further optimize (keeping update short), you could multi thread the CPU work, if you have heavy calculations. Just make sure to pass the data to the main thread before you send the information to Stride/GPU. The stride profiler (F3 and check the other shortcuts in the help browser) will give you pretty detailed information about timings.

If some scenes share data or do similar things, then you could try to do the work only once before passing it to the scenes…

1 Like

Understood, thank you.

Out of curiosity though: since it’s instructions, and I’m “holding latest” (which as far as I understand means use latest value (here=instruction) in Update), let’s say I keep the rootScene and sceneTexture on the main thread, but my animation, let’s say a box, lives on another thread, this would/could still make sense, no?
Maybe hard to follow, but I’m trying to establish a system of hot-loading stride animations (as you know from other posts where you have helped me), and it just would be nicer if I could generalize an async loop over this animation patches, instead of doing it in each animation where necessary…if it’s not possible then that’s it, just wondering about the difference between an instruction sent after update vs. a value used in update when receiving data from another thread…

also another question on this: putting root scene plus scenetexture in 2 separate nodes, place both in the app patch, would ensure they are rendered after each other? This implies this would not be the case if the roots and renderers would all live in the same node (or just in the app patch)?