[vlc-devel] [PATCH 1/3] direct3d11: remove parameters that are always the same

Steve Lhomme robux4 at videolabs.io
Sun Jul 2 11:38:07 CEST 2017


and optimize the texture creation flags

--
replaces https://patches.videolan.org/patch/17220/
- we need to keep pool_type_display
---
 modules/video_output/win32/direct3d11.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index d5a4db7106..9b6a879ef5 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -577,7 +577,7 @@ static void Close(vlc_object_t *object)
 static int AllocateTextures(vout_display_t *vd, const d3d_format_t *cfg,
                             video_format_t *fmt, unsigned pool_size,
                             ID3D11Texture2D *textures[],
-                            bool pool_type_display, bool processor_input)
+                            bool pool_type_display)
 {
     vout_display_sys_t *sys = vd->sys;
     int plane;
@@ -588,16 +588,10 @@ static int AllocateTextures(vout_display_t *vd, const d3d_format_t *cfg,
     texDesc.MipLevels = 1;
     texDesc.SampleDesc.Count = 1;
     texDesc.MiscFlags = 0; //D3D11_RESOURCE_MISC_SHARED;
-    texDesc.Usage = D3D11_USAGE_DEFAULT;
-    texDesc.CPUAccessFlags = 0;
     texDesc.Format = cfg->formatTexture;
-    if (pool_type_display)
-        texDesc.BindFlags |= D3D11_BIND_SHADER_RESOURCE;
-    if (processor_input)
-        texDesc.BindFlags |= D3D11_BIND_RENDER_TARGET;
-    if (is_d3d11_opaque(fmt->i_chroma))
+    texDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
+    if (is_d3d11_opaque(fmt->i_chroma)) {
         texDesc.BindFlags |= D3D11_BIND_DECODER;
-    if (is_d3d11_opaque(fmt->i_chroma) || processor_input) {
         texDesc.Usage = D3D11_USAGE_DEFAULT;
         texDesc.CPUAccessFlags = 0;
     } else {
@@ -683,7 +677,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
     }
 
     if (AllocateTextures(vd, sys->picQuadConfig, &surface_fmt, pool_size, textures,
-                         true, false))
+                         true))
         goto error;
 
     if (!vd->info.is_slow) {
@@ -738,8 +732,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
         video_format_Copy(&staging_fmt, &surface_fmt);
         staging_fmt.i_width = staging_fmt.i_visible_width;
         staging_fmt.i_height = staging_fmt.i_visible_height;
-        if (AllocateTextures(vd, sys->picQuadConfig, &staging_fmt, 1, textures, true,
-                             false))
+        if (AllocateTextures(vd, sys->picQuadConfig, &staging_fmt, 1, textures, true))
             goto error;
 
         sys->picQuad.i_x_offset = 0;
@@ -2742,7 +2735,7 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
             if (unlikely(d3dquad==NULL)) {
                 continue;
             }
-            if (AllocateTextures(vd, sys->d3dregion_format, &r->fmt, 1, textures, true, false)) {
+            if (AllocateTextures(vd, sys->d3dregion_format, &r->fmt, 1, textures, true)) {
                 msg_Err(vd, "Failed to allocate %dx%d texture for OSD",
                         r->fmt.i_visible_width, r->fmt.i_visible_height);
                 for (int i=0; i<D3D11_MAX_SHADER_VIEW; i++)
-- 
2.13.0



More information about the vlc-devel mailing list