[vlc-commits] d3d11: use proper name in shader to tell the source is using texture arrays

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


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Oct 23 08:48:34 2020 +0200| [bd746b8f0def400a36f15bcebdcdad03a6f77b4b] | committer: Steve Lhomme

d3d11: use proper name in shader to tell the source is using texture arrays

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

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

diff --git a/modules/video_output/win32/d3d11_shaders.c b/modules/video_output/win32/d3d11_shaders.c
index 24b37f6817..75e8529de2 100644
--- a/modules/video_output/win32/d3d11_shaders.c
+++ b/modules/video_output/win32/d3d11_shaders.c
@@ -205,8 +205,9 @@ bool IsRGBShader(const d3d_format_t *cfg)
            cfg->formatTexture != DXGI_FORMAT_420_OPAQUE;
 }
 
-static HRESULT CompileTargetShader(vlc_object_t *o, const d3d11_shader_compiler_t *compiler, bool legacy_shader,
+static HRESULT CompileTargetShader(vlc_object_t *o, const d3d11_shader_compiler_t *compiler,
                                    d3d11_device_t *d3d_dev,
+                                   bool texture_array,
                                    const char *psz_sampler,
                                    const char *psz_src_to_linear,
                                    const char *psz_primaries_transform,
@@ -216,7 +217,7 @@ static HRESULT CompileTargetShader(vlc_object_t *o, const d3d11_shader_compiler_
                                    ID3D11PixelShader **output)
 {
     char *shader;
-    int allocated = asprintf(&shader, globPixelShaderDefault, legacy_shader ? "" : "Array",
+    int allocated = asprintf(&shader, globPixelShaderDefault, texture_array ? "Array" : "",
                              psz_src_to_linear, psz_linear_to_display,
                              psz_primaries_transform, psz_tone_mapping,
                              psz_adjust_range, psz_move_planes, psz_sampler);
@@ -252,8 +253,9 @@ static HRESULT CompileTargetShader(vlc_object_t *o, const d3d11_shader_compiler_
     return hr;
 }
 
-HRESULT (D3D11_CompilePixelShader)(vlc_object_t *o, const d3d11_shader_compiler_t *compiler, bool legacy_shader,
+HRESULT (D3D11_CompilePixelShader)(vlc_object_t *o, const d3d11_shader_compiler_t *compiler,
                                  d3d11_device_t *d3d_dev,
+                                 bool texture_array,
                                  const display_info_t *display, bool sharp,
                                  video_transfer_func_t transfer,
                                  video_color_primaries_t primaries, bool src_full_range,
@@ -627,13 +629,13 @@ HRESULT (D3D11_CompilePixelShader)(vlc_object_t *o, const d3d11_shader_compiler_
         }
     }
 
-    hr = CompileTargetShader(o, compiler, legacy_shader, d3d_dev,
+    hr = CompileTargetShader(o, compiler, d3d_dev, texture_array,
                                      psz_sampler[0], psz_src_to_linear,
                                      psz_primaries_transform,
                                      psz_linear_to_display, psz_tone_mapping,
                                      psz_adjust_range, psz_move_planes[0], &quad->d3dpixelShader[0]);
     if (!FAILED(hr) && psz_sampler[1])
-        hr = CompileTargetShader(o, compiler, legacy_shader, d3d_dev,
+        hr = CompileTargetShader(o, compiler, d3d_dev, texture_array,
                                  psz_sampler[1], psz_src_to_linear,
                                  psz_primaries_transform,
                                  psz_linear_to_display, psz_tone_mapping,
diff --git a/modules/video_output/win32/d3d11_shaders.h b/modules/video_output/win32/d3d11_shaders.h
index 2242afe6b1..fa5f4bc737 100644
--- a/modules/video_output/win32/d3d11_shaders.h
+++ b/modules/video_output/win32/d3d11_shaders.h
@@ -109,8 +109,8 @@ bool IsRGBShader(const d3d_format_t *);
 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 *, bool sharp,
+HRESULT D3D11_CompilePixelShader(vlc_object_t *, const d3d11_shader_compiler_t *,
+                                 d3d11_device_t *, bool texture_array, const display_info_t *, bool sharp,
                                  video_transfer_func_t, video_color_primaries_t,
                                  bool src_full_range,
                                  d3d_quad_t *);
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 161b4fd2a7..3d9d55b2ba 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -988,7 +988,7 @@ 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) ||
             BogusZeroCopy(vd);
 
-    hr = D3D11_CompilePixelShader(vd, &sys->shaders, sys->legacy_shader, sys->d3d_dev,
+    hr = D3D11_CompilePixelShader(vd, &sys->shaders, sys->d3d_dev, !sys->legacy_shader,
                                   &sys->display, false, fmt->transfer, fmt->primaries,
                                   fmt->color_range == COLOR_RANGE_FULL,
                                   &sys->picQuad);
@@ -1085,7 +1085,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,
+        hr = D3D11_CompilePixelShader(vd, &sys->shaders, sys->d3d_dev, !sys->legacy_shader,
                                       &sys->display, true, TRANSFER_FUNC_SRGB, COLOR_PRIMARIES_SRGB, true,
                                       &sys->regionQuad);
         if (FAILED(hr))



More information about the vlc-commits mailing list