• Steve Lhomme's avatar
    direct3d11: rework the rendering wait · 42011b9f
    Steve Lhomme authored
    The core needs to know how long the rendering takes place to estimate when a
    frame needs to be dropped preemptively or not.
    So far we waited until the render (plus decoding and filtering?) is done before
    we allowed the picture swap to happen. Now we only wait until (almost) the swap
    date. If we still have to wait, we'll do it after the swap, hoping it will
    still happen in time.
    It is reversing the strict waiting (all?) commands issued to be processed,
    including all decoder threads and filters on the ID3D11DeviceContext. We no
    longer allow waiting past the display date and we do the swap when we're told.
    We no longer release the ID3D11DeviceContext lock either as it allows more
    commands in and makes the waiting time/performance worse.
    We do wait until the initial wait condition is done, if anything to silence
    some D3D11 warnings saying we wanted to wait for something but never got to the
    point it was actually finished. It also keeps the waiting in the display thread
    so it doesn't think it can do more things when it's still busy with the
    previous call. This will allow it do drop frames more accurately.
    A cleaner way would be to count the Display call in the time to render of the
    core, but it's not possible as in some case we wait and the work is actually
    finished and in some others we wait and the work is not finished. We can't tell
    the difference in the core.
    Fixes #21600
direct3d11.c 51.5 KB