[vlc-commits] direct3d11: rename resourceView to renderSrc

Steve Lhomme git at videolan.org
Thu Aug 2 13:08:23 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Jul 13 15:32:51 2018 +0200| [cba3f79cd33ca1416acef2925cbfbc1e65fea389] | committer: Steve Lhomme

direct3d11: rename resourceView to renderSrc

and D3D11_AllocateShaderView() to D3D11_AllocateResourceView()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cba3f79cd33ca1416acef2925cbfbc1e65fea389
---

 modules/codec/avcodec/d3d11va.c         | 22 +++++++++++-----------
 modules/video_chroma/d3d11_fmt.c        | 22 +++++++++++-----------
 modules/video_chroma/d3d11_fmt.h        |  8 ++++----
 modules/video_output/win32/direct3d11.c | 26 +++++++++++++-------------
 4 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 0fefb04615..6e5fc20f44 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -122,7 +122,7 @@ struct vlc_va_sys_t
     /* avcodec internals */
     struct AVD3D11VAContext      hw;
 
-    ID3D11ShaderResourceView     *resourceView[MAX_SURFACE_COUNT * D3D11_MAX_SHADER_VIEW];
+    ID3D11ShaderResourceView     *renderSrc[MAX_SURFACE_COUNT * D3D11_MAX_SHADER_VIEW];
 };
 
 /* */
@@ -176,7 +176,7 @@ static struct picture_context_t *d3d11_pic_context_copy(struct picture_context_t
     struct va_pic_context *src_ctx = (struct va_pic_context*)ctx;
     struct va_pic_context *pic_ctx = CreatePicContext(src_ctx->picsys.decoder,
                                                       src_ctx->picsys.resource[0], src_ctx->picsys.context,
-                                                      src_ctx->picsys.slice_index, src_ctx->picsys.resourceView);
+                                                      src_ctx->picsys.slice_index, src_ctx->picsys.renderSrc);
     if (unlikely(pic_ctx==NULL))
         return NULL;
     if (src_ctx->va_surface) {
@@ -191,7 +191,7 @@ static struct va_pic_context *CreatePicContext(
                                                   ID3D11Resource *p_resource,
                                                   ID3D11DeviceContext *context,
                                                   UINT slice,
-                                                  ID3D11ShaderResourceView *resourceView[D3D11_MAX_SHADER_VIEW])
+                                                  ID3D11ShaderResourceView *renderSrc[D3D11_MAX_SHADER_VIEW])
 {
     struct va_pic_context *pic_ctx = calloc(1, sizeof(*pic_ctx));
     if (unlikely(pic_ctx==NULL))
@@ -209,7 +209,7 @@ static struct va_pic_context *CreatePicContext(
     for (int i=0;i<D3D11_MAX_SHADER_VIEW; i++)
     {
         pic_ctx->picsys.resource[i] = p_resource;
-        pic_ctx->picsys.resourceView[i] = resourceView[i];
+        pic_ctx->picsys.renderSrc[i] = renderSrc[i];
     }
     AcquirePictureSys(&pic_ctx->picsys);
     pic_ctx->picsys.context = context;
@@ -230,7 +230,7 @@ static struct va_pic_context* NewSurfacePicContext(vlc_va_t *va, int surface_ind
     ID3D11VideoDecoderOutputView_GetDesc(surface, &viewDesc);
 
     for (int i=0; i<D3D11_MAX_SHADER_VIEW; i++)
-        resourceView[i] = sys->resourceView[viewDesc.Texture2D.ArraySlice*D3D11_MAX_SHADER_VIEW + i];
+        resourceView[i] = sys->renderSrc[viewDesc.Texture2D.ArraySlice*D3D11_MAX_SHADER_VIEW + i];
 
     struct va_pic_context *pic_ctx = CreatePicContext(
                                                   surface,
@@ -280,7 +280,7 @@ static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
                                              p_sys->resource[KNOWN_DXGI_INDEX],
                                              va->sys->d3d_dev.d3dcontext,
                                              p_sys->slice_index,
-                                             p_sys->resourceView );
+                                             p_sys->renderSrc );
             if (pic->context == NULL)
                 return VLC_EGENERIC;
         }
@@ -802,7 +802,7 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id,
                 break;
             }
 
-            D3D11_AllocateShaderView(va, sys->d3d_dev.d3ddevice, textureFmt, pic->p_sys->texture, pic->p_sys->slice_index, pic->p_sys->resourceView);
+            D3D11_AllocateResourceView(va, sys->d3d_dev.d3ddevice, textureFmt, pic->p_sys->texture, pic->p_sys->slice_index, pic->p_sys->renderSrc);
 
             dx_sys->hw_surface[surface_idx] = pic->p_sys->decoder;
         }
@@ -872,8 +872,8 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id,
             if (texDesc.BindFlags & D3D11_BIND_SHADER_RESOURCE)
             {
                 ID3D11Texture2D *textures[D3D11_MAX_SHADER_VIEW] = {p_texture, p_texture, p_texture};
-                D3D11_AllocateShaderView(va, sys->d3d_dev.d3ddevice, textureFmt, textures, surface_idx,
-                                   &sys->resourceView[surface_idx * D3D11_MAX_SHADER_VIEW]);
+                D3D11_AllocateResourceView(va, sys->d3d_dev.d3ddevice, textureFmt, textures, surface_idx,
+                                   &sys->renderSrc[surface_idx * D3D11_MAX_SHADER_VIEW]);
             }
         }
     }
@@ -964,8 +964,8 @@ static void DxDestroySurfaces(vlc_va_t *va)
         ID3D11VideoDecoderOutputView_Release( dx_sys->hw_surface[i] );
         for (int j = 0; j < D3D11_MAX_SHADER_VIEW; j++)
         {
-            if (va->sys->resourceView[i*D3D11_MAX_SHADER_VIEW + j])
-                ID3D11ShaderResourceView_Release(va->sys->resourceView[i*D3D11_MAX_SHADER_VIEW + j]);
+            if (va->sys->renderSrc[i*D3D11_MAX_SHADER_VIEW + j])
+                ID3D11ShaderResourceView_Release(va->sys->renderSrc[i*D3D11_MAX_SHADER_VIEW + j]);
         }
     }
     if (dx_sys->decoder)
diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index cd6e263caa..d011cf7381 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -42,8 +42,8 @@
 void AcquirePictureSys(picture_sys_t *p_sys)
 {
     for (int i=0; i<D3D11_MAX_SHADER_VIEW; i++) {
-        if (p_sys->resourceView[i])
-            ID3D11ShaderResourceView_AddRef(p_sys->resourceView[i]);
+        if (p_sys->renderSrc[i])
+            ID3D11ShaderResourceView_AddRef(p_sys->renderSrc[i]);
         if (p_sys->texture[i])
             ID3D11Texture2D_AddRef(p_sys->texture[i]);
     }
@@ -60,8 +60,8 @@ void AcquirePictureSys(picture_sys_t *p_sys)
 void ReleasePictureSys(picture_sys_t *p_sys)
 {
     for (int i=0; i<D3D11_MAX_SHADER_VIEW; i++) {
-        if (p_sys->resourceView[i])
-            ID3D11ShaderResourceView_Release(p_sys->resourceView[i]);
+        if (p_sys->renderSrc[i])
+            ID3D11ShaderResourceView_Release(p_sys->renderSrc[i]);
         if (p_sys->texture[i])
             ID3D11Texture2D_Release(p_sys->texture[i]);
     }
@@ -76,11 +76,11 @@ void ReleasePictureSys(picture_sys_t *p_sys)
 }
 
 /* map texture planes to resource views */
-#undef D3D11_AllocateShaderView
-int D3D11_AllocateShaderView(vlc_object_t *obj, ID3D11Device *d3ddevice,
+#undef D3D11_AllocateResourceView
+int D3D11_AllocateResourceView(vlc_object_t *obj, ID3D11Device *d3ddevice,
                               const d3d_format_t *format,
                               ID3D11Texture2D *p_texture[D3D11_MAX_SHADER_VIEW], UINT slice_index,
-                              ID3D11ShaderResourceView *resourceView[D3D11_MAX_SHADER_VIEW])
+                              ID3D11ShaderResourceView *renderSrc[D3D11_MAX_SHADER_VIEW])
 {
     HRESULT hr;
     int i;
@@ -106,10 +106,10 @@ int D3D11_AllocateShaderView(vlc_object_t *obj, ID3D11Device *d3ddevice,
     {
         resviewDesc.Format = format->resourceFormat[i];
         if (resviewDesc.Format == DXGI_FORMAT_UNKNOWN)
-            resourceView[i] = NULL;
+            renderSrc[i] = NULL;
         else
         {
-            hr = ID3D11Device_CreateShaderResourceView(d3ddevice, (ID3D11Resource*)p_texture[i], &resviewDesc, &resourceView[i]);
+            hr = ID3D11Device_CreateShaderResourceView(d3ddevice, (ID3D11Resource*)p_texture[i], &resviewDesc, &renderSrc[i]);
             if (FAILED(hr)) {
                 msg_Err(obj, "Could not Create the Texture ResourceView %d slice %d. (hr=0x%lX)", i, slice_index, hr);
                 break;
@@ -121,8 +121,8 @@ int D3D11_AllocateShaderView(vlc_object_t *obj, ID3D11Device *d3ddevice,
     {
         while (--i >= 0)
         {
-            ID3D11ShaderResourceView_Release(resourceView[i]);
-            resourceView[i] = NULL;
+            ID3D11ShaderResourceView_Release(renderSrc[i]);
+            renderSrc[i] = NULL;
         }
         return VLC_EGENERIC;
     }
diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h
index f1ad455557..615cfdde5f 100644
--- a/modules/video_chroma/d3d11_fmt.h
+++ b/modules/video_chroma/d3d11_fmt.h
@@ -70,7 +70,7 @@ typedef struct
     unsigned                      slice_index;
     ID3D11VideoProcessorInputView  *processorInput;  /* when used as processor input */
     ID3D11VideoProcessorOutputView *processorOutput; /* when used as processor output */
-    ID3D11ShaderResourceView      *resourceView[D3D11_MAX_SHADER_VIEW];
+    ID3D11ShaderResourceView      *renderSrc[D3D11_MAX_SHADER_VIEW];
     DXGI_FORMAT                   formatTexture;
 } picture_sys_t;
 
@@ -99,11 +99,11 @@ void AcquirePictureSys(picture_sys_t *p_sys);
 void ReleasePictureSys(picture_sys_t *p_sys);
 
 /* map texture planes to resource views */
-int D3D11_AllocateShaderView(vlc_object_t *obj, ID3D11Device *d3ddevice,
+int D3D11_AllocateResourceView(vlc_object_t *obj, ID3D11Device *d3ddevice,
                              const d3d_format_t *format,
                              ID3D11Texture2D *p_texture[D3D11_MAX_SHADER_VIEW], UINT slice_index,
-                             ID3D11ShaderResourceView *resourceView[D3D11_MAX_SHADER_VIEW]);
-#define D3D11_AllocateShaderView(a,b,c,d,e,f)  D3D11_AllocateShaderView(VLC_OBJECT(a),b,c,d,e,f)
+                             ID3D11ShaderResourceView *output[D3D11_MAX_SHADER_VIEW]);
+#define D3D11_AllocateResourceView(a,b,c,d,e,f)  D3D11_AllocateResourceView(VLC_OBJECT(a),b,c,d,e,f)
 
 HRESULT D3D11_CreateDevice(vlc_object_t *obj, d3d11_handle_t *,
                            bool hw_decoding, d3d11_device_t *out);
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 70b13e9196..a866e8994b 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -434,9 +434,9 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
                 picture_sys_t *p_sys = pictures[picture_count]->p_sys;
                 if (!p_sys->texture[0])
                     continue;
-                if (D3D11_AllocateShaderView(vd, sys->d3d_dev.d3ddevice, sys->picQuad.textureFormat,
+                if (D3D11_AllocateResourceView(vd, sys->d3d_dev.d3ddevice, sys->picQuad.textureFormat,
                                              p_sys->texture, picture_count,
-                                             p_sys->resourceView))
+                                             p_sys->renderSrc))
                     goto error;
             }
         }
@@ -856,7 +856,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
             {
                 /* for performance reason we don't want to allocate this during
                  * display, do it preferrably when creating the texture */
-                assert(p_sys->resourceView[0]!=NULL);
+                assert(p_sys->renderSrc[0]!=NULL);
             }
             if ( sys->picQuad.i_height != texDesc.Height ||
                  sys->picQuad.i_width != texDesc.Width )
@@ -907,16 +907,16 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
     }
 
     /* Render the quad */
-    ID3D11ShaderResourceView **resourceView;
+    ID3D11ShaderResourceView **renderSrc;
     if (!is_d3d11_opaque(picture->format.i_chroma) || sys->legacy_shader)
-        resourceView = sys->stagingSys.resourceView;
+        renderSrc = sys->stagingSys.renderSrc;
     else {
         picture_sys_t *p_sys = ActivePictureSys(picture);
-        resourceView = p_sys->resourceView;
+        renderSrc = p_sys->renderSrc;
     }
     D3D11_RenderQuad(&sys->d3d_dev, &sys->picQuad,
                      vd->fmt.projection_mode == PROJECTION_MODE_RECTANGULAR ? &sys->flatVShader : &sys->projectionVShader,
-                     resourceView, sys->swapchainTargetView);
+                     renderSrc, sys->swapchainTargetView);
 
     if (subpicture) {
         // draw the additional vertices
@@ -924,7 +924,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
             if (sys->d3dregions[i])
             {
                 d3d_quad_t *quad = (d3d_quad_t *) sys->d3dregions[i]->p_sys;
-                D3D11_RenderQuad(&sys->d3d_dev, quad, &sys->flatVShader, quad->picSys.resourceView, sys->swapchainTargetView);
+                D3D11_RenderQuad(&sys->d3d_dev, quad, &sys->flatVShader, quad->picSys.renderSrc, sys->swapchainTargetView);
             }
         }
     }
@@ -1442,8 +1442,8 @@ static int Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
             return VLC_EGENERIC;
         }
 
-        if (D3D11_AllocateShaderView(vd, sys->d3d_dev.d3ddevice, sys->picQuad.textureFormat,
-                                     textures, 0, sys->stagingSys.resourceView))
+        if (D3D11_AllocateResourceView(vd, sys->d3d_dev.d3ddevice, sys->picQuad.textureFormat,
+                                     textures, 0, sys->stagingSys.renderSrc))
         {
             msg_Err(vd, "Failed to allocate the staging shader view");
             return VLC_EGENERIC;
@@ -1662,9 +1662,9 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
                 continue;
             }
 
-            if (D3D11_AllocateShaderView(vd, sys->d3d_dev.d3ddevice, sys->regionQuad.textureFormat,
-                                         d3dquad->picSys.texture, 0,
-                                         d3dquad->picSys.resourceView)) {
+            if (D3D11_AllocateResourceView(vd, sys->d3d_dev.d3ddevice, sys->regionQuad.textureFormat,
+                                           d3dquad->picSys.texture, 0,
+                                           d3dquad->picSys.renderSrc)) {
                 msg_Err(vd, "Failed to create %dx%d shader view for OSD",
                         r->fmt.i_visible_width, r->fmt.i_visible_height);
                 free(d3dquad);



More information about the vlc-commits mailing list