Commit 7ec2e3f0 authored by Laurent Aimar's avatar Laurent Aimar

Cleared render targets only when needed (direct3d).

parent c513cf2a
...@@ -190,6 +190,7 @@ struct vout_display_sys_t ...@@ -190,6 +190,7 @@ struct vout_display_sys_t
/* */ /* */
bool reset_device; bool reset_device;
bool reopen_device; bool reopen_device;
bool clear_scene;
/* It protects the following variables */ /* It protects the following variables */
vlc_mutex_t lock; vlc_mutex_t lock;
......
...@@ -473,10 +473,7 @@ static void Manage (vout_display_t *vd) ...@@ -473,10 +473,7 @@ static void Manage (vout_display_t *vd)
vout_display_SendEventPicturesInvalid(vd); vout_display_SendEventPicturesInvalid(vd);
} }
#if 0 /* Position Change */
/*
* Position Change
*/
if (sys->changes & DX_POSITION_CHANGE) { if (sys->changes & DX_POSITION_CHANGE) {
#if 0 /* need that when bicubic filter is available */ #if 0 /* need that when bicubic filter is available */
RECT rect; RECT rect;
...@@ -494,9 +491,9 @@ static void Manage (vout_display_t *vd) ...@@ -494,9 +491,9 @@ static void Manage (vout_display_t *vd)
return VLC_EGENERIC; return VLC_EGENERIC;
} }
#endif #endif
sys->clear_scene = true;
sys->changes &= ~DX_POSITION_CHANGE; sys->changes &= ~DX_POSITION_CHANGE;
} }
#endif
} }
/** /**
...@@ -1023,6 +1020,8 @@ static int Direct3DCreateScene(vout_display_t *vd, const video_format_t *fmt) ...@@ -1023,6 +1020,8 @@ static int Direct3DCreateScene(vout_display_t *vd, const video_format_t *fmt)
sys->d3dregion_count = 0; sys->d3dregion_count = 0;
sys->d3dregion = NULL; sys->d3dregion = NULL;
sys->clear_scene = true;
// Texture coordinates outside the range [0.0, 1.0] are set // Texture coordinates outside the range [0.0, 1.0] are set
// to the texture color at 0.0 or 1.0, respectively. // to the texture color at 0.0 or 1.0, respectively.
IDirect3DDevice9_SetSamplerState(d3ddev, 0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP); IDirect3DDevice9_SetSamplerState(d3ddev, 0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
...@@ -1373,12 +1372,15 @@ static void Direct3DRenderScene(vout_display_t *vd, ...@@ -1373,12 +1372,15 @@ static void Direct3DRenderScene(vout_display_t *vd,
LPDIRECT3DDEVICE9 d3ddev = sys->d3ddev; LPDIRECT3DDEVICE9 d3ddev = sys->d3ddev;
HRESULT hr; HRESULT hr;
/* Clear the backbuffer and the zbuffer */ if (sys->clear_scene) {
hr = IDirect3DDevice9_Clear(d3ddev, 0, NULL, D3DCLEAR_TARGET, /* Clear the backbuffer and the zbuffer */
D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); hr = IDirect3DDevice9_Clear(d3ddev, 0, NULL, D3DCLEAR_TARGET,
if (FAILED(hr)) { D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
msg_Dbg(vd, "%s:%d (hr=0x%0lX)", __FUNCTION__, __LINE__, hr); if (FAILED(hr)) {
return; msg_Dbg(vd, "%s:%d (hr=0x%0lX)", __FUNCTION__, __LINE__, hr);
return;
}
sys->clear_scene = false;
} }
// Begin the scene // Begin the scene
......
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