[vlc-commits] direct3d11: Use the pixel shader corresponding to the texture format

Steve Lhomme git at videolan.org
Wed Feb 8 13:55:46 CET 2017


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Thu Feb  2 14:54:12 2017 +0100| [010f6bd930c2118c2d8c3b42fb8e6a8581756c97] | committer: Jean-Baptiste Kempf

direct3d11: Use the pixel shader corresponding to the texture format

Not the sub resources formats.
Now we refuse to render if we the pixel shader doesn't match a known format.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/video_output/win32/direct3d11.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index fd4f3f3..1fc8795 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1392,14 +1392,25 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
     if (!sys->d3dregion_format)
         sys->d3dregion_format = GetOutputFormat(vd, VLC_CODEC_BGRA, 0, false, true);
 
-    if (sys->picQuadConfig->resourceFormat[0] == DXGI_FORMAT_R8_UNORM ||
-        sys->picQuadConfig->resourceFormat[0] == DXGI_FORMAT_R16_UNORM)
+    switch (sys->picQuadConfig->formatTexture)
+    {
+    case DXGI_FORMAT_NV12:
+    case DXGI_FORMAT_P010:
         sys->d3dPxShader = globPixelShaderBiplanarYUV_2RGB;
-    else
-    if (fmt->i_chroma == VLC_CODEC_YUYV)
+        break;
+    case DXGI_FORMAT_YUY2:
         sys->d3dPxShader = globPixelShaderBiplanarYUYV_2RGB;
-    else
+        break;
+    case DXGI_FORMAT_R8G8B8A8_UNORM:
+    case DXGI_FORMAT_B8G8R8A8_UNORM:
+    case DXGI_FORMAT_B5G6R5_UNORM:
         sys->d3dPxShader = globPixelShaderDefault;
+        break;
+    default:
+        msg_Err(vd, "Could not get a suitable pixel shader for %s", sys->picQuadConfig->name);
+        return VLC_EGENERIC;
+        break;
+    }
 
     if (sys->d3dregion_format != NULL)
         sys->psz_rgbaPxShader = globPixelShaderDefault;



More information about the vlc-commits mailing list