ScintillatorSynth / Scintillator

A Video Synthesis Engine for SuperCollider
https://scintillatorsynth.org
56 stars 8 forks source link

Device-specific memory allocation and staging #58

Open lnihlen opened 4 years ago

lnihlen commented 4 years ago

Optimum choice of memory allocations on the GPU depends on several different factors, including:

There are potentially big performance differences between architectures and access patterns. And, any GPU-only memory will need to be staged, meaning a temporary CPU-accessible buffer is created and then graphics commands issued to copy the data to the GPU-only buffer. This staging needs to happen before the buffer can be used, and in order to avoid race conditions it seems it would be best if the staging happens before creation callbacks are processed. For example, staging the vertex and index buffers before a ScinthDef completion callback or OSC message gets sent.

There might also be opportunity for re-use of vertex and index buffers here, too, which are not currently shared across ScinthDefs.

Lastly, this might help with #52, as it is true that one of the things that's different between the integrated and discrete GPU is memory model.