[vlc-commits] d3d11: add a function to release pixel shaders from a quad
Steve Lhomme
git at videolan.org
Mon Aug 13 11:48:12 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Aug 13 09:30:53 2018 +0200| [ea99dba9714dd1af719789fe158b8e4c438d9d2c] | committer: Steve Lhomme
d3d11: add a function to release pixel shaders from a quad
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ea99dba9714dd1af719789fe158b8e4c438d9d2c
---
modules/video_output/win32/d3d11_quad.c | 9 +--------
modules/video_output/win32/d3d11_shaders.c | 12 ++++++++++++
modules/video_output/win32/d3d11_shaders.h | 1 +
modules/video_output/win32/direct3d11.c | 15 ++-------------
4 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/modules/video_output/win32/d3d11_quad.c b/modules/video_output/win32/d3d11_quad.c
index ba783ab739..3bb60d3e35 100644
--- a/modules/video_output/win32/d3d11_quad.c
+++ b/modules/video_output/win32/d3d11_quad.c
@@ -176,14 +176,7 @@ void D3D11_ReleaseQuad(d3d_quad_t *quad)
ID3D11Buffer_Release(quad->pVertexShaderConstants);
quad->pVertexShaderConstants = NULL;
}
- for (size_t i=0; i<D3D11_MAX_SHADER_VIEW; i++)
- {
- if (quad->d3dpixelShader[i])
- {
- ID3D11PixelShader_Release(quad->d3dpixelShader[i]);
- quad->d3dpixelShader[i] = NULL;
- }
- }
+ D3D11_ReleasePixelShader(quad);
for (size_t i=0; i<2; i++)
{
if (quad->d3dsampState[i])
diff --git a/modules/video_output/win32/d3d11_shaders.c b/modules/video_output/win32/d3d11_shaders.c
index c74a19985b..e54dcfca9e 100644
--- a/modules/video_output/win32/d3d11_shaders.c
+++ b/modules/video_output/win32/d3d11_shaders.c
@@ -585,6 +585,18 @@ HRESULT D3D11_CompilePixelShader(vlc_object_t *o, d3d11_handle_t *hd3d, bool leg
return hr;
}
+void D3D11_ReleasePixelShader(d3d_quad_t *quad)
+{
+ for (size_t i=0; i<D3D11_MAX_SHADER_VIEW; i++)
+ {
+ if (quad->d3dpixelShader[i])
+ {
+ ID3D11PixelShader_Release(quad->d3dpixelShader[i]);
+ quad->d3dpixelShader[i] = NULL;
+ }
+ }
+}
+
#undef D3D11_CompileShader
ID3DBlob* D3D11_CompileShader(vlc_object_t *obj, const d3d11_handle_t *hd3d, const d3d11_device_t *d3d_dev,
const char *psz_shader, bool pixel)
diff --git a/modules/video_output/win32/d3d11_shaders.h b/modules/video_output/win32/d3d11_shaders.h
index 8ef7c0f3ac..2f87bafd4a 100644
--- a/modules/video_output/win32/d3d11_shaders.h
+++ b/modules/video_output/win32/d3d11_shaders.h
@@ -117,6 +117,7 @@ HRESULT D3D11_CompilePixelShader(vlc_object_t *, d3d11_handle_t *, bool legacy_s
d3d_quad_t *);
#define D3D11_CompilePixelShader(a,b,c,d,e,f,g,h) \
D3D11_CompilePixelShader(VLC_OBJECT(a),b,c,d,e,f,g,h)
+void D3D11_ReleasePixelShader(d3d_quad_t *);
HRESULT D3D11_CompileFlatVertexShader(vlc_object_t *, d3d11_handle_t *, d3d11_device_t *, d3d_vshader_t *);
#define D3D11_CompileFlatVertexShader(a,b,c,d) D3D11_CompileFlatVertexShader(VLC_OBJECT(a),b,c,d)
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 71bec97e7e..ae8f4449a9 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1527,14 +1527,7 @@ static int Direct3D11CreateGenericResources(vout_display_t *vd)
&sys->regionQuad);
if (FAILED(hr))
{
- for (size_t i=0; i<D3D11_MAX_SHADER_VIEW; i++)
- {
- if (sys->picQuad.d3dpixelShader[i])
- {
- ID3D11PixelShader_Release(sys->picQuad.d3dpixelShader[i]);
- sys->picQuad.d3dpixelShader[i] = NULL;
- }
- }
+ D3D11_ReleasePixelShader(&sys->picQuad);
msg_Err(vd, "Failed to create the SPU pixel shader. (hr=0x%lX)", hr);
return VLC_EGENERIC;
}
@@ -1582,17 +1575,13 @@ static void Direct3D11DestroyResources(vout_display_t *vd)
D3D11_ReleaseVertexShader(&sys->flatVShader);
D3D11_ReleaseVertexShader(&sys->projectionVShader);
+ D3D11_ReleasePixelShader(&sys->regionQuad);
for (size_t i=0; i < D3D11_MAX_SHADER_VIEW; i++)
{
if (sys->swapchainTargetView[i]) {
ID3D11RenderTargetView_Release(sys->swapchainTargetView[i]);
sys->swapchainTargetView[i] = NULL;
}
- if (sys->regionQuad.d3dpixelShader[i])
- {
- ID3D11PixelShader_Release(sys->regionQuad.d3dpixelShader[i]);
- sys->regionQuad.d3dpixelShader[i] = NULL;
- }
}
msg_Dbg(vd, "Direct3D11 resources destroyed");
More information about the vlc-commits
mailing list