Commit cf9b13f1 authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

direct3d9: remove the secondary HWND storage

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 28cf4fbd
......@@ -84,7 +84,8 @@ HRESULT D3D9_CreateDevice(vlc_object_t *o, d3d9_handle_t *hd3d, HWND hwnd,
return E_INVALIDARG;
}
if (D3D9_FillPresentationParameters(o, hd3d, AdapterToUse, hwnd, source, out))
out->hwnd = hwnd;
if (D3D9_FillPresentationParameters(o, hd3d, AdapterToUse, source, out))
return E_INVALIDARG;
/* */
......@@ -138,7 +139,7 @@ void D3D9_ReleaseDevice(d3d9_device_t *d3d_dev)
* It setup vout_display_sys_t::d3dpp and vout_display_sys_t::rect_display
* from the default adapter.
*/
int D3D9_FillPresentationParameters(vlc_object_t *o, d3d9_handle_t *hd3d, UINT AdapterToUse, HWND hwnd,
int D3D9_FillPresentationParameters(vlc_object_t *o, d3d9_handle_t *hd3d, UINT AdapterToUse,
const video_format_t *source, d3d9_device_t *out)
{
/*
......@@ -165,7 +166,7 @@ int D3D9_FillPresentationParameters(vlc_object_t *o, d3d9_handle_t *hd3d, UINT A
d3dpp->EnableAutoDepthStencil = FALSE;
if (source->i_width)
{
d3dpp->hDeviceWindow = hwnd;
d3dpp->hDeviceWindow = out->hwnd;
d3dpp->SwapEffect = D3DSWAPEFFECT_COPY;
d3dpp->BackBufferFormat = d3ddm.Format;
d3dpp->BackBufferCount = 1;
......
......@@ -56,6 +56,7 @@ typedef struct
/* creation parameters */
D3DPRESENT_PARAMETERS pp;
UINT adapterId;
HWND hwnd;
D3DCAPS9 caps;
} d3d9_device_t;
......@@ -83,7 +84,7 @@ int D3D9_Create(vlc_object_t *, d3d9_handle_t *);
void D3D9_Destroy(d3d9_handle_t *);
int D3D9_FillPresentationParameters(vlc_object_t *, d3d9_handle_t *, UINT AdapterToUse, HWND,
int D3D9_FillPresentationParameters(vlc_object_t *, d3d9_handle_t *, UINT AdapterToUse,
const video_format_t *, d3d9_device_t *out);
#endif /* VLC_VIDEOCHROMA_D3D9_FMT_H_ */
......@@ -131,7 +131,6 @@ struct d3dctx
{
d3d9_handle_t hd3d;
d3d9_device_t d3d_dev;
HWND hwnd;
};
struct vout_display_sys_t
......@@ -758,9 +757,7 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt)
{
vout_display_sys_t *sys = vd->sys;
sys->d3dctx.hwnd = sys->sys.hvideownd;
if (FAILED(D3D9_CreateDevice(vd, &sys->d3dctx.hd3d, sys->d3dctx.hwnd,
if (FAILED(D3D9_CreateDevice(vd, &sys->d3dctx.hd3d, sys->sys.hvideownd,
&vd->source, &sys->d3dctx.d3d_dev)))
return VLC_EGENERIC;
......@@ -826,7 +823,7 @@ static int Direct3D9Reset(vout_display_t *vd)
struct d3dctx *d3dctx = &sys->d3dctx;
d3d9_device_t *p_d3d9_dev = &d3dctx->d3d_dev;
if (D3D9_FillPresentationParameters(VLC_OBJECT(vd), &d3dctx->hd3d, p_d3d9_dev->adapterId, d3dctx->hwnd, &vd->source, &d3dctx->d3d_dev))
if (D3D9_FillPresentationParameters(VLC_OBJECT(vd), &d3dctx->hd3d, p_d3d9_dev->adapterId, &vd->source, &d3dctx->d3d_dev))
return VLC_EGENERIC;
/* release all D3D objects */
......@@ -1958,7 +1955,7 @@ GLConvOpen(vlc_object_t *obj)
tc->priv = priv;
priv->vt = vt;
priv->d3dctx = (struct d3dctx) { .hwnd = tc->gl->surface->handle.hwnd };
priv->d3dctx = (struct d3dctx) { 0 };
if (D3D9_Create(obj, &priv->d3dctx.hd3d) != VLC_SUCCESS)
goto error;
......@@ -1968,7 +1965,7 @@ GLConvOpen(vlc_object_t *obj)
goto error;
}
if (FAILED(D3D9_CreateDevice(obj, &priv->d3dctx.hd3d, priv->d3dctx.hwnd,
if (FAILED(D3D9_CreateDevice(obj, &priv->d3dctx.hd3d, tc->gl->surface->handle.hwnd,
&tc->fmt, &priv->d3dctx.d3d_dev)))
goto error;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment