[vlc-commits] direct3d11: wait indefinitely for the rendering to be done
Steve Lhomme
git at videolan.org
Mon Aug 10 13:35:39 CEST 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Aug 10 12:13:39 2020 +0200| [ba04276cae760f919a9a61c5dd5eb294e4d26cef] | committer: Steve Lhomme
direct3d11: wait indefinitely for the rendering to be done
If we don't, D3D11 complains that we didn't wait for the finished result
matching a ID3D11DeviceContext::End() call.
As long as GetData() returns S_FALSE we can safely wait. Any other value will
exit the loop.
We want the rendering time seen by the vout to be as accurate as possible
rather than stop waiting after some time and pretend the rendering happened
when it didn't.
The granularity of the wait should be as small as possible to have the
rendering time stats as accurate as possible.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ba04276cae760f919a9a61c5dd5eb294e4d26cef
---
modules/video_output/win32/direct3d11.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index b6c5fcd7b4..3da8c32b23 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -661,15 +661,14 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture, subpicture_t
if (sys->prepareWait)
{
- int maxWait = 10;
ID3D11DeviceContext_End(sys->d3d_dev->d3dcontext, sys->prepareWait);
while (S_FALSE == ID3D11DeviceContext_GetData(sys->d3d_dev->d3dcontext,
- sys->prepareWait, NULL, 0, 0)
- && --maxWait)
+ sys->prepareWait, NULL, 0, 0))
{
+ const vlc_tick_t render_wait = VLC_TICK_FROM_MS(2);
d3d11_device_unlock( sys->d3d_dev );
- SleepEx(2, TRUE);
+ vlc_tick_sleep(render_wait);
d3d11_device_lock( sys->d3d_dev );
}
}
More information about the vlc-commits
mailing list