[vlc-commits] direct3d11: move D3D11_AllocateQuad() out of D3D11_SetupQuad()

Steve Lhomme git at videolan.org
Thu Aug 2 10:07:41 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Aug  2 09:38:40 2018 +0200| [2ab46e2b681d10cd184f7d8176e4888b4360826b] | committer: Steve Lhomme

direct3d11: move D3D11_AllocateQuad() out of D3D11_SetupQuad()

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

 modules/video_output/win32/d3d11_quad.c |  3 ---
 modules/video_output/win32/direct3d11.c | 17 ++++++++++++++++-
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/modules/video_output/win32/d3d11_quad.c b/modules/video_output/win32/d3d11_quad.c
index 708d7cd685..666d041b5d 100644
--- a/modules/video_output/win32/d3d11_quad.c
+++ b/modules/video_output/win32/d3d11_quad.c
@@ -693,9 +693,6 @@ int D3D11_SetupQuad(vlc_object_t *o, d3d11_device_t *d3d_dev, const video_format
                     ID3D11VertexShader *d3dvertexShader, ID3D11InputLayout *pVertexLayout,
                     video_projection_mode_t projection, video_orientation_t orientation)
 {
-    if (D3D11_AllocateQuad(o, d3d_dev, projection, quad) != VLC_SUCCESS)
-        return VLC_EGENERIC;
-
     const bool RGB_shader = IsRGBShader(quad->formatInfo);
 
     quad->shaderConstants.LuminanceScale = GetFormatLuminance(o, fmt) / (float)displayFormat->luminance_peak;
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 72f3954c6e..ac3ad26a3c 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -355,6 +355,12 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
     surface_fmt.i_width  = sys->picQuad.i_width;
     surface_fmt.i_height = sys->picQuad.i_height;
 
+    if (D3D11_AllocateQuad(vd, &sys->d3d_dev, vd->fmt.projection_mode, &sys->picQuad) != VLC_SUCCESS)
+    {
+        msg_Err(vd, "Could not allocate quad buffers.");
+        return NULL;
+    }
+
     if (D3D11_SetupQuad( vd, &sys->d3d_dev, &surface_fmt, &sys->picQuad, &sys->display, &sys->sys.rect_src_clipped,
                    vd->fmt.projection_mode == PROJECTION_MODE_RECTANGULAR ? sys->flatVSShader : sys->projectionVSShader,
                    sys->pVertexLayout,
@@ -1721,10 +1727,19 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
             d3dquad->i_height   = r->fmt.i_height;
 
             d3dquad->formatInfo = sys->d3dregion_format;
+            err = D3D11_AllocateQuad(vd, &sys->d3d_dev, PROJECTION_MODE_RECTANGULAR, d3dquad);
+            if (err != VLC_SUCCESS)
+            {
+                msg_Err(vd, "Failed to allocate %dx%d quad for OSD",
+                             r->fmt.i_visible_width, r->fmt.i_visible_height);
+                free(d3dquad);
+                continue;
+            }
+
             err = D3D11_SetupQuad( vd, &sys->d3d_dev, &r->fmt, d3dquad, &sys->display, &output,
                              sys->flatVSShader, sys->pVertexLayout, PROJECTION_MODE_RECTANGULAR, ORIENT_NORMAL );
             if (err != VLC_SUCCESS) {
-                msg_Err(vd, "Failed to create %dx%d quad for OSD",
+                msg_Err(vd, "Failed to setup %dx%d quad for OSD",
                         r->fmt.i_visible_width, r->fmt.i_visible_height);
                 free(d3dquad);
                 continue;



More information about the vlc-commits mailing list