[vlc-commits] d3d11: pass the source primaries when compiling the shaders

Steve Lhomme git at videolan.org
Wed Oct 17 16:07:49 CEST 2018


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Oct 12 14:55:17 2018 +0200| [587f1c878ab28ca303d41c1593ea151206c6807c] | committer: Steve Lhomme

d3d11: pass the source primaries when compiling the shaders

the display_info_t already has the destination primaries

(cherry picked from commit a6804a21ab30e8cbf3eb72916262bd6f35e491cf)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=587f1c878ab28ca303d41c1593ea151206c6807c
---

 modules/video_output/win32/d3d11_shaders.c | 3 ++-
 modules/video_output/win32/d3d11_shaders.h | 7 ++++---
 modules/video_output/win32/direct3d11.c    | 6 ++++--
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/modules/video_output/win32/d3d11_shaders.c b/modules/video_output/win32/d3d11_shaders.c
index 8767e39b33..e948aadee2 100644
--- a/modules/video_output/win32/d3d11_shaders.c
+++ b/modules/video_output/win32/d3d11_shaders.c
@@ -205,7 +205,8 @@ bool IsRGBShader(const d3d_format_t *cfg)
 HRESULT D3D11_CompilePixelShader(vlc_object_t *o, d3d11_handle_t *hd3d, bool legacy_shader,
                                  d3d11_device_t *d3d_dev,
                                  const d3d_format_t *format, const display_info_t *display,
-                                 video_transfer_func_t transfer, bool src_full_range,
+                                 video_transfer_func_t transfer,
+                                 video_color_primaries_t primaries, bool src_full_range,
                                  ID3D11PixelShader **output)
 {
     static const char *DEFAULT_NOOP = "return rgb";
diff --git a/modules/video_output/win32/d3d11_shaders.h b/modules/video_output/win32/d3d11_shaders.h
index d22a516b93..fd74b819b3 100644
--- a/modules/video_output/win32/d3d11_shaders.h
+++ b/modules/video_output/win32/d3d11_shaders.h
@@ -84,10 +84,11 @@ bool IsRGBShader(const d3d_format_t *);
 
 HRESULT D3D11_CompilePixelShader(vlc_object_t *, d3d11_handle_t *, bool legacy_shader,
                                  d3d11_device_t *, const d3d_format_t *, const display_info_t *,
-                                 video_transfer_func_t, bool src_full_range,
+                                 video_transfer_func_t, video_color_primaries_t,
+                                 bool src_full_range,
                                  ID3D11PixelShader **output);
-#define D3D11_CompilePixelShader(a,b,c,d,e,f,g,h,i) \
-    D3D11_CompilePixelShader(VLC_OBJECT(a),b,c,d,e,f,g,h,i)
+#define D3D11_CompilePixelShader(a,b,c,d,e,f,g,h,i,j) \
+    D3D11_CompilePixelShader(VLC_OBJECT(a),b,c,d,e,f,g,h,i,j)
 
 float GetFormatLuminance(vlc_object_t *, const video_format_t *);
 #define GetFormatLuminance(a,b)  GetFormatLuminance(VLC_OBJECT(a),b)
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 14af66e190..00797bfc78 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1452,7 +1452,9 @@ static int Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
     sys->legacy_shader = sys->d3d_dev.feature_level < D3D_FEATURE_LEVEL_10_0 || !CanUseTextureArray(vd);
 
     hr = D3D11_CompilePixelShader(vd, &sys->hd3d, sys->legacy_shader, &sys->d3d_dev,
-                                  sys->picQuad.formatInfo, &sys->display, fmt->transfer, fmt->b_color_range_full, &sys->picQuad.d3dpixelShader);
+                                  sys->picQuad.formatInfo, &sys->display, fmt->transfer, fmt->primaries,
+                                  fmt->b_color_range_full,
+                                  &sys->picQuad.d3dpixelShader);
     if (FAILED(hr))
     {
         msg_Err(vd, "Failed to create the pixel shader. (hr=0x%lX)", hr);
@@ -1569,7 +1571,7 @@ static int Direct3D11CreateGenericResources(vout_display_t *vd)
     if (sys->d3dregion_format != NULL)
     {
         hr = D3D11_CompilePixelShader(vd, &sys->hd3d, sys->legacy_shader, &sys->d3d_dev,
-                                      sys->d3dregion_format, &sys->display, TRANSFER_FUNC_SRGB, true, &sys->pSPUPixelShader);
+                                      sys->d3dregion_format, &sys->display, TRANSFER_FUNC_SRGB, COLOR_PRIMARIES_SRGB, true, &sys->pSPUPixelShader);
         if (FAILED(hr))
         {
             if (sys->picQuad.d3dpixelShader)



More information about the vlc-commits mailing list