[vlc-commits] direct3d11: group the start/end rendering callbacks into one

Steve Lhomme git at videolan.org
Tue May 7 16:50:15 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue May  7 13:51:54 2019 +0200| [e19a35029206e823c1fcd14fc3dc72d070669b88] | committer: Steve Lhomme

direct3d11: group the start/end rendering callbacks into one

Similar to OpenGL MakeCurrent(true/false)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e19a35029206e823c1fcd14fc3dc72d070669b88
---

 modules/video_output/win32/direct3d11.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 5573656ccc..0ac5a1ec18 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -146,8 +146,7 @@ struct vout_display_sys_t
     bool (*setupDeviceCb)(void* opaque, const struct device_cfg_t*, struct device_setup_t* );
     void (*cleanupDeviceCb)(void* opaque);
     void (*swapCb)(void* opaque);
-    void (*endRenderCb)(void* opaque);
-    bool (*starRenderCb)(void* opaque);
+    bool (*startEndRenderingCb)(void* opaque, bool enter);
     bool (*resizeCb)(void* opaque, unsigned, unsigned);
 };
 
@@ -370,12 +369,16 @@ static bool Resize( void *opaque, unsigned i_width, unsigned i_height )
     return true;
 }
 
-static bool StartRendering( void *opaque )
+static bool LocalSwapchainStartEndRendering( void *opaque, bool enter )
 {
     vout_display_t *vd = opaque;
-    vout_display_sys_t *sys = vd->sys;
 
-    D3D11_ClearRenderTargets( &sys->d3d_dev, sys->display.pixelFormat, sys->internal_swapchain.swapchainTargetView );
+    if ( enter )
+    {
+        vout_display_sys_t *sys = vd->sys;
+
+        D3D11_ClearRenderTargets( &sys->d3d_dev, sys->display.pixelFormat, sys->internal_swapchain.swapchainTargetView );
+    }
     return true;
 }
 
@@ -487,15 +490,14 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
         return ret;
 
     bool uses_external_callbacks = true;
-    if (!sys->swapCb || !sys->starRenderCb || !sys->endRenderCb || !sys->resizeCb)
+    if (sys->swapCb == NULL || sys->startEndRenderingCb == NULL || sys->resizeCb == NULL)
     {
         sys->internal_swapchain.obj = VLC_OBJECT(vd);
         sys->outside_opaque = vd;
         sys->setupDeviceCb       = LocalSwapchainSetupDevice;
         sys->cleanupDeviceCb     = LocalSwapchainCleanupDevice;
         sys->swapCb              = Swap;
-        sys->starRenderCb        = StartRendering;
-        sys->endRenderCb         = NULL;
+        sys->startEndRenderingCb = LocalSwapchainStartEndRendering;
         sys->resizeCb            = Resize;
         uses_external_callbacks = false;
     }
@@ -968,12 +970,11 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
     }
 #endif
 
-    if (sys->starRenderCb(sys->outside_opaque))
+    if (sys->startEndRenderingCb(sys->outside_opaque, true))
     {
         PreparePicture(vd, picture, subpicture);
 
-        if (sys->endRenderCb)
-            sys->endRenderCb(sys->outside_opaque);
+        sys->startEndRenderingCb(sys->outside_opaque, false);
     }
 }
 



More information about the vlc-commits mailing list