[vlc-devel] [PATCH 04/14] direct3d11: add a function to determine if a shader will be for RGB or YUV

Steve Lhomme robux4 at videolabs.io
Tue Mar 21 08:55:16 CET 2017


In other words, if a YUV->RGB matrix conversion will be used
---
 modules/video_output/win32/direct3d11.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 8e7974f..465d1b1 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1589,6 +1589,13 @@ static ID3DBlob* CompileShader(vout_display_t *vd, const char *psz_shader, bool
     return pShaderBlob;
 }
 
+static bool IsRGBShader(const d3d_format_t *cfg)
+{
+    return cfg->resourceFormat[0] != DXGI_FORMAT_R8_UNORM &&
+           cfg->resourceFormat[0] != DXGI_FORMAT_R16_UNORM &&
+           cfg->formatTexture != DXGI_FORMAT_YUY2;
+}
+
 static HRESULT CompilePixelShader(vout_display_t *vd, const d3d_format_t *format,
                                   video_transfer_func_t transfer, ID3D11PixelShader **output)
 {
@@ -2162,9 +2169,7 @@ static int SetupQuad(vout_display_t *vd, const video_format_t *fmt, d3d_quad_t *
 {
     vout_display_sys_t *sys = vd->sys;
     HRESULT hr;
-    const bool RGB_shader = cfg->resourceFormat[0] != DXGI_FORMAT_R8_UNORM &&
-        cfg->resourceFormat[0] != DXGI_FORMAT_R16_UNORM &&
-        fmt->i_chroma != VLC_CODEC_YUYV;
+    const bool RGB_shader = IsRGBShader(cfg);
 
     /* pixel shader constant buffer */
     PS_CONSTANT_BUFFER defaultConstants = {
-- 
2.10.1.windows.1



More information about the vlc-devel mailing list