[vlc-commits] direct3d11: do not access the vout_display_t from the swapchain callbacks
Steve Lhomme
git at videolan.org
Thu May 9 15:31:18 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu May 9 13:47:51 2019 +0200| [0f347fbbf37dfc6fd925efaad9f92fcf1c86876b] | committer: Steve Lhomme
direct3d11: do not access the vout_display_t from the swapchain callbacks
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0f347fbbf37dfc6fd925efaad9f92fcf1c86876b
---
modules/video_output/win32/direct3d11.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 5d66e36e3d..22dc9f4bdc 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -510,8 +510,7 @@ static bool UpdateSwapchain( struct d3d11_local_swapchain *display, const struct
static bool LocalSwapchainSetupDevice( void *opaque, const struct device_cfg_t *cfg, struct device_setup_t *out )
{
- vout_display_t *vd = opaque;
- struct d3d11_local_swapchain *display = &vd->sys->internal_swapchain;
+ struct d3d11_local_swapchain *display = opaque;
HRESULT hr;
#if VLC_WINSTORE_APP
ID3D11DeviceContext *legacy_ctx = var_InheritInteger( display->obj, "winrt-d3dcontext" ); /* LEGACY */
@@ -535,15 +534,13 @@ static bool LocalSwapchainSetupDevice( void *opaque, const struct device_cfg_t *
static void LocalSwapchainCleanupDevice( void *opaque )
{
- vout_display_t *vd = opaque;
- struct d3d11_local_swapchain *display = &vd->sys->internal_swapchain;
+ struct d3d11_local_swapchain *display = opaque;
D3D11_ReleaseDevice( &display->d3d_dev );
}
static void LocalSwapchainSwap( void *opaque )
{
- vout_display_t *vd = opaque;
- struct d3d11_local_swapchain *display = &vd->sys->internal_swapchain;
+ struct d3d11_local_swapchain *display = opaque;
DXGI_PRESENT_PARAMETERS presentParams = { 0 };
@@ -557,8 +554,7 @@ static void LocalSwapchainSwap( void *opaque )
static bool LocalSwapchainUpdateOutput( void *opaque, const struct direct3d_cfg_t *cfg, struct output_cfg_t *out )
{
- vout_display_t *vd = opaque;
- struct d3d11_local_swapchain *display = &vd->sys->internal_swapchain;
+ struct d3d11_local_swapchain *display = opaque;
if ( !UpdateSwapchain( display, cfg ) )
return false;
out->surface_format = display->pixelFormat->formatTexture;
@@ -571,12 +567,10 @@ static bool LocalSwapchainUpdateOutput( void *opaque, const struct direct3d_cfg_
static bool LocalSwapchainStartEndRendering( void *opaque, bool enter )
{
- vout_display_t *vd = opaque;
+ struct d3d11_local_swapchain *display = opaque;
if ( enter )
{
- struct d3d11_local_swapchain *display = &vd->sys->internal_swapchain;
-
D3D11_ClearRenderTargets( &display->d3d_dev, display->pixelFormat, display->swapchainTargetView );
}
return true;
@@ -611,7 +605,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
{
sys->internal_swapchain.obj = VLC_OBJECT(vd);
sys->internal_swapchain.hd3d = &sys->hd3d;
- sys->outside_opaque = vd;
+ sys->outside_opaque = &sys->internal_swapchain;
sys->setupDeviceCb = LocalSwapchainSetupDevice;
sys->cleanupDeviceCb = LocalSwapchainCleanupDevice;
sys->updateOutputCb = LocalSwapchainUpdateOutput;
More information about the vlc-commits
mailing list