[vlc-commits] [Git][videolan/vlc][master] d3d11: pass a vlc_logger to D3D11_AllocateResourceView()

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Wed May 4 07:30:16 UTC 2022



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
f7803af5 by Steve Lhomme at 2022-05-04T07:04:47+00:00
d3d11: pass a vlc_logger to D3D11_AllocateResourceView()

No need to force the caller to know about its object.

- - - - -


7 changed files:

- modules/codec/avcodec/d3d11va.c
- modules/codec/mft.cpp
- modules/hw/d3d11/d3d11_decoder.cpp
- modules/hw/d3d11/d3d11_surface.c
- modules/video_chroma/d3d11_fmt.c
- modules/video_chroma/d3d11_fmt.h
- modules/video_output/win32/direct3d11.cpp


Changes:

=====================================
modules/codec/avcodec/d3d11va.c
=====================================
@@ -567,7 +567,7 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id,
         if (texDesc.BindFlags & D3D11_BIND_SHADER_RESOURCE)
         {
             ID3D11Texture2D *textures[DXGI_MAX_SHADER_VIEW] = {p_texture, p_texture, p_texture};
-            D3D11_AllocateResourceView(va, sys->d3d_dev->d3ddevice, sys->render_fmt, textures, surface_idx,
+            D3D11_AllocateResourceView(vlc_object_logger(va), sys->d3d_dev->d3ddevice, sys->render_fmt, textures, surface_idx,
                                 &sys->renderSrc[surface_idx * DXGI_MAX_SHADER_VIEW]);
         }
     }


=====================================
modules/codec/mft.cpp
=====================================
@@ -962,7 +962,7 @@ static int ProcessOutputStream(decoder_t *p_dec, DWORD stream_id, bool & keep_re
                                     d3d11Res, d3d11Res, d3d11Res, d3d11Res
                                 };
 
-                                if (D3D11_AllocateResourceView(p_dec, dev_sys->d3d_dev.d3ddevice, p_sys->cfg,
+                                if (D3D11_AllocateResourceView(vlc_object_logger(p_dec), dev_sys->d3d_dev.d3ddevice, p_sys->cfg,
                                                                 tex, slice, p_sys->cachedSRV[slice]) != VLC_SUCCESS)
                                 {
                                     d3d11Res->Release();
@@ -988,7 +988,7 @@ static int ProcessOutputStream(decoder_t *p_dec, DWORD stream_id, bool & keep_re
                                 p_sys->cachedSRV[sliceIndex][j]->Release();
                         }
 
-                        if (D3D11_AllocateResourceView(p_dec, dev_sys->d3d_dev.d3ddevice, p_sys->cfg,
+                        if (D3D11_AllocateResourceView(vlc_object_logger(p_dec), dev_sys->d3d_dev.d3ddevice, p_sys->cfg,
                                                        tex, sliceIndex, p_sys->cachedSRV[sliceIndex]) != VLC_SUCCESS)
                         {
                             d3d11Res->Release();


=====================================
modules/hw/d3d11/d3d11_decoder.cpp
=====================================
@@ -191,7 +191,7 @@ static int DecodeFrame( decoder_t *p_dec, block_t *p_block )
         if (src_sys->renderSrc[j])
             src_sys->renderSrc[j]->Release();
     }
-    D3D11_AllocateResourceView(p_dec, dev_sys->d3d_dev.d3ddevice, p_sys->output_format,
+    D3D11_AllocateResourceView(vlc_object_logger(p_dec), dev_sys->d3d_dev.d3ddevice, p_sys->output_format,
                                src_sys->texture, src_sys->slice_index, src_sys->renderSrc);
 
     picture_Hold( p_pic ); // hold the picture we got from the block


=====================================
modules/hw/d3d11/d3d11_surface.c
=====================================
@@ -646,7 +646,7 @@ static picture_t *AllocateCPUtoGPUTexture(filter_t *p_filter, filter_sys_t *p_sy
                          &p_dst->format, false, pic_ctx->picsys.texture, p_dst->p) != VLC_SUCCESS)
         goto done;
 
-    if (unlikely(D3D11_AllocateResourceView(p_filter, p_sys->d3d_dev->d3ddevice, cfg,
+    if (unlikely(D3D11_AllocateResourceView(vlc_object_logger(p_filter), p_sys->d3d_dev->d3ddevice, cfg,
                                             pic_ctx->picsys.texture, 0, pic_ctx->picsys.renderSrc) != VLC_SUCCESS))
         goto done;
 


=====================================
modules/video_chroma/d3d11_fmt.c
=====================================
@@ -97,8 +97,7 @@ void ReleaseD3D11PictureSys(picture_sys_d3d11_t *p_sys)
 }
 
 /* map texture planes to resource views */
-#undef D3D11_AllocateResourceView
-int D3D11_AllocateResourceView(vlc_object_t *obj, ID3D11Device *d3ddevice,
+int D3D11_AllocateResourceView(struct vlc_logger *obj, ID3D11Device *d3ddevice,
                               const d3d_format_t *format,
                               ID3D11Texture2D *p_texture[DXGI_MAX_SHADER_VIEW], UINT slice_index,
                               ID3D11ShaderResourceView *renderSrc[DXGI_MAX_SHADER_VIEW])
@@ -132,7 +131,7 @@ int D3D11_AllocateResourceView(vlc_object_t *obj, ID3D11Device *d3ddevice,
         {
             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);
+                vlc_error(obj, "Could not Create the Texture ResourceView %d slice %d. (hr=0x%lX)", i, slice_index, hr);
                 break;
             }
         }
@@ -991,7 +990,7 @@ picture_t *D3D11_AllocPicture(vlc_object_t *obj,
         return NULL;
     }
 
-    D3D11_AllocateResourceView(obj, dev_sys->d3d_dev.d3ddevice, cfg, pic_ctx->picsys.texture, 0, pic_ctx->picsys.renderSrc);
+    D3D11_AllocateResourceView(vlc_object_logger(obj), dev_sys->d3d_dev.d3ddevice, cfg, pic_ctx->picsys.texture, 0, pic_ctx->picsys.renderSrc);
 
     if (shared)
     {


=====================================
modules/video_chroma/d3d11_fmt.h
=====================================
@@ -153,11 +153,10 @@ void AcquireD3D11PictureSys(picture_sys_d3d11_t *p_sys);
 void ReleaseD3D11PictureSys(picture_sys_d3d11_t *p_sys);
 
 /* map texture planes to resource views */
-int D3D11_AllocateResourceView(vlc_object_t *obj, ID3D11Device *d3ddevice,
+int D3D11_AllocateResourceView(struct vlc_logger *obj, ID3D11Device *d3ddevice,
                              const d3d_format_t *format,
                              ID3D11Texture2D *p_texture[DXGI_MAX_SHADER_VIEW], UINT slice_index,
                              ID3D11ShaderResourceView *output[DXGI_MAX_SHADER_VIEW]);
-#define D3D11_AllocateResourceView(a,b,c,d,e,f)  D3D11_AllocateResourceView(VLC_OBJECT(a),b,c,d,e,f)
 
 d3d11_decoder_device_t *D3D11_CreateDevice(vlc_object_t *obj, IDXGIAdapter *,
                                    bool hw_decoding, bool forced);


=====================================
modules/video_output/win32/direct3d11.cpp
=====================================
@@ -325,7 +325,7 @@ static int UpdateStaging(vout_display_t *vd, const video_format_t *fmt)
             return VLC_EGENERIC;
         }
 
-        if (D3D11_AllocateResourceView(vd, sys->d3d_dev->d3ddevice, sys->picQuad.generic.textureFormat,
+        if (D3D11_AllocateResourceView(vlc_object_logger(vd), sys->d3d_dev->d3ddevice, sys->picQuad.generic.textureFormat,
                                     textures, 0, sys->stagingSys.renderSrc))
         {
             msg_Err(vd, "Failed to allocate the staging shader view");
@@ -1333,7 +1333,7 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
                 continue;
             }
 
-            if (D3D11_AllocateResourceView(vd, sys->d3d_dev->d3ddevice, sys->regionQuad.generic.textureFormat,
+            if (D3D11_AllocateResourceView(vlc_object_logger(vd), sys->d3d_dev->d3ddevice, sys->regionQuad.generic.textureFormat,
                                            d3dquad->picSys.texture, 0,
                                            d3dquad->picSys.renderSrc)) {
                 msg_Err(vd, "Failed to create %dx%d shader view for OSD",



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/f7803af508b977c4680143039da44974d0d423f4

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/f7803af508b977c4680143039da44974d0d423f4
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list