[vlc-commits] direct3d11: add an option to use sharp resizing

Steve Lhomme git at videolan.org
Fri Oct 23 13:02:37 CEST 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Oct 22 15:55:16 2020 +0200| [944813c16e912c9939780c01939880d04472de92] | committer: Steve Lhomme

direct3d11: add an option to use sharp resizing

Avoid mixing pixels for SPU which are supposed to be sharper than the picture.

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

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

diff --git a/modules/video_output/win32/d3d11_shaders.c b/modules/video_output/win32/d3d11_shaders.c
index 2ead8498bd..24b37f6817 100644
--- a/modules/video_output/win32/d3d11_shaders.c
+++ b/modules/video_output/win32/d3d11_shaders.c
@@ -254,7 +254,7 @@ static HRESULT CompileTargetShader(vlc_object_t *o, const d3d11_shader_compiler_
 
 HRESULT (D3D11_CompilePixelShader)(vlc_object_t *o, const d3d11_shader_compiler_t *compiler, bool legacy_shader,
                                  d3d11_device_t *d3d_dev,
-                                 const display_info_t *display,
+                                 const display_info_t *display, bool sharp,
                                  video_transfer_func_t transfer,
                                  video_color_primaries_t primaries, bool src_full_range,
                                  d3d_quad_t *quad)
@@ -271,7 +271,7 @@ HRESULT (D3D11_CompilePixelShader)(vlc_object_t *o, const d3d11_shader_compiler_
 
     D3D11_SAMPLER_DESC sampDesc;
     memset(&sampDesc, 0, sizeof(sampDesc));
-    sampDesc.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT;
+    sampDesc.Filter = sharp ? D3D11_FILTER_MIN_MAG_MIP_POINT : D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT;
     sampDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
     sampDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
     sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
diff --git a/modules/video_output/win32/d3d11_shaders.h b/modules/video_output/win32/d3d11_shaders.h
index bbcc8d3e9a..2242afe6b1 100644
--- a/modules/video_output/win32/d3d11_shaders.h
+++ b/modules/video_output/win32/d3d11_shaders.h
@@ -110,12 +110,12 @@ int D3D11_InitShaders(vlc_object_t *, d3d11_shader_compiler_t *);
 void D3D11_ReleaseShaders(d3d11_shader_compiler_t *);
 
 HRESULT D3D11_CompilePixelShader(vlc_object_t *, const d3d11_shader_compiler_t *, bool legacy_shader,
-                                 d3d11_device_t *, const display_info_t *,
+                                 d3d11_device_t *, const display_info_t *, bool sharp,
                                  video_transfer_func_t, video_color_primaries_t,
                                  bool src_full_range,
                                  d3d_quad_t *);
-#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)
 void D3D11_ReleasePixelShader(d3d_quad_t *);
 
 HRESULT D3D11_CompileFlatVertexShader(vlc_object_t *, const d3d11_shader_compiler_t *, d3d11_device_t *, d3d_vertex_shader_t *);
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 20b5767c3a..161b4fd2a7 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -989,7 +989,7 @@ static int Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
             BogusZeroCopy(vd);
 
     hr = D3D11_CompilePixelShader(vd, &sys->shaders, sys->legacy_shader, sys->d3d_dev,
-                                  &sys->display, fmt->transfer, fmt->primaries,
+                                  &sys->display, false, fmt->transfer, fmt->primaries,
                                   fmt->color_range == COLOR_RANGE_FULL,
                                   &sys->picQuad);
     if (FAILED(hr))
@@ -1086,7 +1086,7 @@ static int Direct3D11CreateGenericResources(vout_display_t *vd)
     if (sys->regionQuad.textureFormat != NULL)
     {
         hr = D3D11_CompilePixelShader(vd, &sys->shaders, sys->legacy_shader, sys->d3d_dev,
-                                      &sys->display, TRANSFER_FUNC_SRGB, COLOR_PRIMARIES_SRGB, true,
+                                      &sys->display, true, TRANSFER_FUNC_SRGB, COLOR_PRIMARIES_SRGB, true,
                                       &sys->regionQuad);
         if (FAILED(hr))
         {



More information about the vlc-commits mailing list