View Single Post
Old 29th October 2015, 09:59   #1  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,455
How to Use Frame Buffer with MT

How do you program AviSynth filters for MT? I heard about a frame buffer, and how does it work?

I'm thinking of this. I'm using 8 threads and am processing frame n. I could increase performance 2x by processing the next frame at the same time. I could assume that with 8 threads, the next frame to be processed will usually be n+8.

Now what if it's not? I don't want to be calculating frame n+8 several times in separate threads. If another thread wants to render frame n+8 while my thread is still processing it, is there a way to
1. make the second thread wait
2. finish calculating it and store it in a cache
3. access the frame from the cache in the second thread

How can I do this, or is there a better way to do it?

Basically I want to fill in the data that will be requested next, because when rendering scenes with a DirectX9 device, it returns the previously created scene while we fill in the data of the current scene. It works if I create a 2nd dummy scene but that cuts performance in half!
MysteryX is offline   Reply With Quote