[vlc-devel] [PATCH 28/29] direct3d11: create a shader resource view for each slice of the decoder texture

Steve Lhomme robux4 at videolabs.io
Thu Jan 19 11:11:03 CET 2017


This way it can be passed directly to the pixel shader, straight out of the
decoder.
---
 modules/video_output/win32/direct3d11.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index b1dbede..6c53628 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -577,6 +577,9 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
     unsigned          picture_count = 0;
     HRESULT           hr;
 
+    const d3d_format_t *cfg = GetOutputFormat(vd, vd->fmt.i_chroma, 0, true, false);
+    assert(cfg == vd->sys->picQuadConfig);
+
     ID3D10Multithread *pMultithread;
     hr = ID3D11Device_QueryInterface( vd->sys->d3ddevice, &IID_ID3D10Multithread, (void **)&pMultithread);
     if (SUCCEEDED(hr)) {
@@ -619,6 +622,9 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
         picsys->slice_index = picture_count;
         picsys->context = vd->sys->d3dcontext;
 
+        if (AllocateShaderView(vd, vd->sys->picQuadConfig, texture, picture_count, picsys->resourceView) != VLC_SUCCESS)
+            goto error;
+
         picture_resource_t resource = {
             .p_sys = picsys,
             .pf_destroy = DestroyDisplayPoolPicture,
@@ -670,6 +676,10 @@ static void DestroyDisplayPoolPicture(picture_t *picture)
 {
     picture_sys_t *p_sys = (picture_sys_t*) picture->p_sys;
 
+    if (p_sys->resourceView[0])
+        ID3D11ShaderResourceView_Release(p_sys->resourceView[0]);
+    if (p_sys->resourceView[1])
+        ID3D11ShaderResourceView_Release(p_sys->resourceView[1]);
     if (p_sys->texture)
         ID3D11Texture2D_Release(p_sys->texture);
     if (p_sys->context)
-- 
2.10.2



More information about the vlc-devel mailing list