[vlc-commits] direct3d11: add a function to determine if a shader will be for RGB or YUV

Steve Lhomme git at videolan.org
Tue Mar 21 18:47:49 CET 2017


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Mon Mar 20 17:01:43 2017 +0100| [382496f0ed18c7ea265dd54093242962488ccec2] | committer: Hugo Beauzée-Luyssen

direct3d11: add a function to determine if a shader will be for RGB or YUV

In other words, if a YUV->RGB matrix conversion will be used

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

 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 7add7cb..bf44d21 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1583,6 +1583,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)
 {
@@ -2156,9 +2163,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 = {



More information about the vlc-commits mailing list