[vlc-commits] d3d11_fmt: simplify AllocateTextures() calls

Steve Lhomme git at videolan.org
Mon May 28 13:25:29 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Feb 21 14:03:44 2018 +0100| [fdcd44202a89352f080def8723f14b041e277030] | committer: Steve Lhomme

d3d11_fmt: simplify AllocateTextures() calls

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

 modules/hw/d3d11/d3d11_deinterlace.c    | 2 +-
 modules/video_chroma/d3d11_fmt.c        | 1 +
 modules/video_chroma/d3d11_fmt.h        | 6 +++---
 modules/video_output/win32/direct3d11.c | 6 +++---
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/modules/hw/d3d11/d3d11_deinterlace.c b/modules/hw/d3d11/d3d11_deinterlace.c
index c26f1c322a..ec5029e9ba 100644
--- a/modules/hw/d3d11/d3d11_deinterlace.c
+++ b/modules/hw/d3d11/d3d11_deinterlace.c
@@ -278,7 +278,7 @@ static picture_t *NewOutputPicture( filter_t *p_filter )
             video_format_t fmt = p_filter->fmt_out.video;
             fmt.i_width  = dstDesc.Width;
             fmt.i_height = dstDesc.Height;
-            if (AllocateTextures(VLC_OBJECT(p_filter), &p_sys->d3d_dev, cfg,
+            if (AllocateTextures(p_filter, &p_sys->d3d_dev, cfg,
                                  &fmt, 1, pic_sys->texture) != VLC_SUCCESS)
             {
                 free(pic_sys);
diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index 57f4ef2a50..8768829376 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -446,6 +446,7 @@ const d3d_format_t *FindD3D11Format(ID3D11Device *d3ddevice,
     return NULL;
 }
 
+#undef AllocateTextures
 int AllocateTextures( vlc_object_t *obj, d3d11_device_t *d3d_dev,
                       const d3d_format_t *cfg, const video_format_t *fmt,
                       unsigned pool_size, ID3D11Texture2D *textures[] )
diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h
index c9b86b6d6d..1124010807 100644
--- a/modules/video_chroma/d3d11_fmt.h
+++ b/modules/video_chroma/d3d11_fmt.h
@@ -136,9 +136,9 @@ const d3d_format_t *FindD3D11Format(ID3D11Device *d3ddevice,
                                     bool allow_opaque,
                                     UINT supportFlags);
 
-int AllocateTextures(vlc_object_t *obj, d3d11_device_t *d3d_dev,
-                     const d3d_format_t *cfg, const video_format_t *fmt,
-                     unsigned pool_size, ID3D11Texture2D *textures[]);
+int AllocateTextures(vlc_object_t *, d3d11_device_t *, const d3d_format_t *,
+                     const video_format_t *, unsigned pool_size, ID3D11Texture2D *textures[]);
+#define AllocateTextures(a,b,c,d,e,f)  AllocateTextures(VLC_OBJECT(a),b,c,d,e,f)
 
 static inline void d3d11_device_lock(d3d11_device_t *d3d_dev)
 {
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 288be24d0a..070dcd72fc 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -362,7 +362,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
             /* only provide enough for the filters, we can still do direct rendering */
             slices = __MIN(slices, 6);
 
-        if (AllocateTextures(VLC_OBJECT(vd), &sys->d3d_dev, sys->picQuad.formatInfo, &surface_fmt, slices, textures))
+        if (AllocateTextures(vd, &sys->d3d_dev, sys->picQuad.formatInfo, &surface_fmt, slices, textures))
             goto error;
 
         pictures = calloc(pool_size, sizeof(*pictures));
@@ -1464,7 +1464,7 @@ static int Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
         surface_fmt.i_width  = sys->picQuad.i_width;
         surface_fmt.i_height = sys->picQuad.i_height;
 
-        if (AllocateTextures(VLC_OBJECT(vd), &sys->d3d_dev, sys->picQuad.formatInfo, &surface_fmt, 1, textures))
+        if (AllocateTextures(vd, &sys->d3d_dev, sys->picQuad.formatInfo, &surface_fmt, 1, textures))
         {
             msg_Err(vd, "Failed to allocate the staging texture");
             return VLC_EGENERIC;
@@ -1771,7 +1771,7 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
             if (unlikely(d3dquad==NULL)) {
                 continue;
             }
-            if (AllocateTextures(VLC_OBJECT(vd), &sys->d3d_dev, sys->d3dregion_format, &r->p_picture->format, 1, d3dquad->picSys.texture)) {
+            if (AllocateTextures(vd, &sys->d3d_dev, sys->d3dregion_format, &r->p_picture->format, 1, d3dquad->picSys.texture)) {
                 msg_Err(vd, "Failed to allocate %dx%d texture for OSD",
                         r->fmt.i_visible_width, r->fmt.i_visible_height);
                 for (int j=0; j<D3D11_MAX_SHADER_VIEW; j++)



More information about the vlc-commits mailing list