[vlc-commits] direct3d11: keep a reference to the pixel shader longer
Steve Lhomme
git at videolan.org
Wed Feb 8 14:46:01 CET 2017
vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Wed Feb 8 14:26:57 2017 +0100| [936523b585dff0adea49d8e96ae057fa417ce105] | committer: Jean-Baptiste Kempf
direct3d11: keep a reference to the pixel shader longer
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=936523b585dff0adea49d8e96ae057fa417ce105
---
modules/video_output/win32/direct3d11.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 35a6712..8934327 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -133,6 +133,7 @@ struct vout_display_sys_t
ID3D11DeviceContext *d3dcontext; /* D3D context */
d3d_quad_t picQuad;
const d3d_format_t *picQuadConfig;
+ ID3D11PixelShader *picQuadPixelShader;
ID3D11RenderTargetView *d3drenderTargetView;
ID3D11DepthStencilView *d3ddepthStencilView;
@@ -1565,8 +1566,7 @@ static int Direct3D11CreateResources(vout_display_t *vd, video_format_t *fmt)
vd->info.is_slow = !is_d3d11_opaque(fmt->i_chroma);
- ID3D11PixelShader *pPicQuadShader;
- hr = CompilePixelShader(vd, sys->d3dPxShader, &pPicQuadShader);
+ hr = CompilePixelShader(vd, sys->d3dPxShader, &sys->picQuadPixelShader);
if (FAILED(hr))
{
msg_Err(vd, "Failed to create the pixel shader. (hr=0x%lX)", hr);
@@ -1578,7 +1578,8 @@ static int Direct3D11CreateResources(vout_display_t *vd, video_format_t *fmt)
hr = CompilePixelShader(vd, sys->psz_rgbaPxShader, &sys->pSPUPixelShader);
if (FAILED(hr))
{
- ID3D11PixelShader_Release(pPicQuadShader);
+ ID3D11PixelShader_Release(sys->picQuadPixelShader);
+ sys->picQuadPixelShader = NULL;
msg_Err(vd, "Failed to create the SPU pixel shader. (hr=0x%lX)", hr);
return VLC_EGENERIC;
}
@@ -1629,13 +1630,12 @@ static int Direct3D11CreateResources(vout_display_t *vd, video_format_t *fmt)
}
ID3D10Blob_Release(pVSBlob);
- if (AllocQuad( vd, fmt, &sys->picQuad, sys->picQuadConfig, pPicQuadShader,
+ if (AllocQuad( vd, fmt, &sys->picQuad, sys->picQuadConfig, sys->picQuadPixelShader,
vd->fmt.projection_mode) != VLC_SUCCESS) {
- ID3D11PixelShader_Release(pPicQuadShader);
+ ID3D11PixelShader_Release(sys->picQuadPixelShader);
msg_Err(vd, "Could not Create the main quad picture. (hr=0x%lX)", hr);
return VLC_EGENERIC;
}
- ID3D11PixelShader_Release(pPicQuadShader);
ID3D11DeviceContext_IASetPrimitiveTopology(sys->d3dcontext, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
@@ -2180,6 +2180,11 @@ static void Direct3D11DestroyResources(vout_display_t *vd)
ID3D11VertexShader_Release(sys->pSPUPixelShader);
sys->pSPUPixelShader = NULL;
}
+ if (sys->picQuadPixelShader)
+ {
+ ID3D11PixelShader_Release(sys->picQuadPixelShader);
+ sys->picQuadPixelShader = NULL;
+ }
#if defined(HAVE_ID3D11VIDEODECODER)
if( sys->context_lock != INVALID_HANDLE_VALUE )
{
More information about the vlc-commits
mailing list