Commit d0b92b9b authored by Steve Lhomme's avatar Steve Lhomme Committed by Hugo Beauzée-Luyssen
Browse files

direct3d9: use point interpolation rather than none



We could use linear interpolation but in software decoding the decoder pool is
not initialized with black so we would interpolate with uninitialized (green)
lines/colons.
Signed-off-by: Hugo Beauzée-Luyssen's avatarHugo Beauzée-Luyssen <hugo@beauzee.fr>
parent 6b236169
......@@ -127,6 +127,9 @@ struct vout_display_sys_t
D3DPRESENT_PARAMETERS d3dpp;
bool use_d3d9ex;
D3DTEXTUREFILTERTYPE minFilter;
D3DTEXTUREFILTERTYPE magFilter;
// scene objects
LPDIRECT3DTEXTURE9 d3dtex;
LPDIRECT3DVERTEXBUFFER9 d3dvtc;
......@@ -1294,19 +1297,27 @@ static int Direct3D9CreateScene(vout_display_t *vd, const video_format_t *fmt)
IDirect3DDevice9_SetSamplerState(d3ddev, 0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
// Set linear filtering quality
if (sys->d3dcaps.TextureFilterCaps & D3DPTFILTERCAPS_MINFLINEAR) {
/* we can't use linear interpolation in software decoding, the pictures
* are not initialized to black */
if ( is_d3d9_opaque(vd->source.i_chroma) &&
sys->d3dcaps.TextureFilterCaps & D3DPTFILTERCAPS_MINFLINEAR ) {
//msg_Dbg(vd, "Using D3DTEXF_LINEAR for minification");
IDirect3DDevice9_SetSamplerState(d3ddev, 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
sys->minFilter = D3DTEXF_LINEAR;
} else {
//msg_Dbg(vd, "Using D3DTEXF_POINT for minification");
IDirect3DDevice9_SetSamplerState(d3ddev, 0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
sys->minFilter = D3DTEXF_POINT;
}
if (sys->d3dcaps.TextureFilterCaps & D3DPTFILTERCAPS_MAGFLINEAR) {
if ( is_d3d9_opaque(vd->source.i_chroma) &&
sys->d3dcaps.TextureFilterCaps & D3DPTFILTERCAPS_MAGFLINEAR ) {
//msg_Dbg(vd, "Using D3DTEXF_LINEAR for magnification");
IDirect3DDevice9_SetSamplerState(d3ddev, 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
sys->magFilter = D3DTEXF_LINEAR;
} else {
//msg_Dbg(vd, "Using D3DTEXF_POINT for magnification");
IDirect3DDevice9_SetSamplerState(d3ddev, 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
sys->magFilter = D3DTEXF_POINT;
}
// set maximum ambient light
......@@ -1658,7 +1669,14 @@ static int Direct3D9ImportPicture(vout_display_t *vd,
/* Copy picture surface into texture surface
* color space conversion happen here */
hr = IDirect3DDevice9_StretchRect(sys->d3ddev, source, &vd->sys->sys.rect_src_clipped, destination, NULL, D3DTEXF_NONE );
D3DTEXTUREFILTERTYPE filterType;
if (sys->sys.rect_src_clipped.right < sys->sys.rect_dest_clipped.right)
filterType = sys->magFilter;
else if (sys->sys.rect_src_clipped.right > sys->sys.rect_dest_clipped.right)
filterType = sys->minFilter;
else
filterType = D3DTEXF_NONE;
hr = IDirect3DDevice9_StretchRect(sys->d3ddev, source, &sys->sys.rect_src_clipped, destination, NULL, filterType );
IDirect3DSurface9_Release(destination);
if (FAILED(hr)) {
msg_Dbg(vd, "Failed IDirect3DDevice9_StretchRect: source 0x%p 0x%0lx",
......
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