No announcement yet.

Afterwarp v2 multithread rendering and fast texture transfer

  • Filter
  • Time
  • Show
Clear All
new posts

  • Afterwarp v2 multithread rendering and fast texture transfer

    I have a few questions regarding your library.
    In my application, I need to have a few video players running simultaneously, each running in its own thread, decoding video frame, and assigned textures need to be updated as fast as possible.
    After all video frames are composed to the final frame image (render target), texture image needs to be readback to CPU memory.

    First, I'm wondering about multithreading support of Afterwarp library? Is it safe to update and fetch textures from other threads?

    Does library use CUDA toolkit for textures and surface memory?

    How to write custom shaders?
    Need to convert YUV colors to RGB and vice verses, and write some custom screen transitions effects.

    Is it possible to access native api (D3D11) objects from Afterwarp? Using object handles for example.


  • #2
    1. Afterwarp can be used from multiple threads, but depending on backend, some API calls may or may not be thread-safe, so you would need to use some sort of synchronization between threads (mutexes, critical sections, etc.) So, for instance, if you are updating texture contents and then in another thread want to render this texture to the screen, your rendering thread would need to wait until texture contents have been updated in another thread before starting to use it.

    2. CUDA is a completely different technology, which is limited to Nvidia hardware. If you need GPGPU work, you can always use Compute shaders directly in Afterwarp - in v2 the support has been further extended and they will work on all modern hardware. In fact, internally Afterwarp v2 uses Compute shaders rather heavily.

    3. I can post an example on how to use custom shaders with Afterwarp v2. Do you need them in Delphi or FPC/Lazarus?

    4. Internally, Afterwarp v2 does expose backend objects from Direct3D, but these are not exposed through public API. It would be fairly easy to expose them, but I am not sure if it would be a good idea doing so. Why would you need to access Direct3D objects directly?

    P.S. As far as I know, Direct3D actually supports some YUV formats, but not sure which ones. If necessary, these can be very easily be exposed by Afterwarp API as well. Can you please tell which format(s) do you use?