I have this code that processes memory video frames through HLSL pixel shaders and DirectX 9. There is no graphical interface, it is a DLL that runs within a video processing chain.
https://github.com/mysteryx93/AviSynthShader/blob/master/Src/D3D9RenderImpl.cpp
It is now working stable.
However, I realized that DX9 is creating 8 threads. That wouldn't be so much of an issue if it wasn't for the fact that if I run 8 instances of the video processing script, and the processing chain contains 12 calls to shaders, and each shader instance creates 8 threads, then I end up with 768 threads and massive memory consumption.
Why is DirectX 9 creating so many threads, and is there a way to prevent this?