[vlc-commits] d3d11: fix direct VLC_CODEC_I420_10L rendering

Steve Lhomme git at videolan.org
Tue Oct 15 10:15:14 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Oct 15 10:14:51 2019 +0200| [51e0ca3bf05c244dd16962e9fc391d6f29d2999c] | committer: Steve Lhomme

d3d11: fix direct VLC_CODEC_I420_10L rendering

The width of the custom texture is double the size of the actual video.

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

 modules/video_output/win32/d3d11_quad.c    | 1 +
 modules/video_output/win32/d3d11_shaders.c | 7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules/video_output/win32/d3d11_quad.c b/modules/video_output/win32/d3d11_quad.c
index 8a0e367929..0f2a296a85 100644
--- a/modules/video_output/win32/d3d11_quad.c
+++ b/modules/video_output/win32/d3d11_quad.c
@@ -1115,6 +1115,7 @@ void D3D11_UpdateViewport(d3d_quad_t *quad, const RECT *rect, const d3d_format_t
                 break;
             }
             /* fallthrough */
+        case VLC_CODEC_I420_10L:
         case VLC_CODEC_I420:
             quad->cropViewport[1].TopLeftX = quad->cropViewport[0].TopLeftX / 2;
             quad->cropViewport[1].TopLeftY = quad->cropViewport[0].TopLeftY / 2;
diff --git a/modules/video_output/win32/d3d11_shaders.c b/modules/video_output/win32/d3d11_shaders.c
index eadf5a9234..edb74f96a6 100644
--- a/modules/video_output/win32/d3d11_shaders.c
+++ b/modules/video_output/win32/d3d11_shaders.c
@@ -396,9 +396,10 @@ HRESULT D3D11_CompilePixelShader(vlc_object_t *o, d3d11_handle_t *hd3d, bool leg
             {
             case VLC_CODEC_I420_10L:
                 psz_sampler[0] =
-                       "sample.x  = shaderTexture[0].Sample(samplerState, coords).x * 64;\n"
-                       "sample.y  = shaderTexture[1].Sample(samplerState, coords).x * 64;\n"
-                       "sample.z  = shaderTexture[2].Sample(samplerState, coords).x * 64;\n"
+                       "float3 coords_2 = float3(coords.x/2, coords.y, coords.z);\n"
+                       "sample.x  = shaderTexture[0].Sample(samplerState, coords_2).x * 64;\n"
+                       "sample.y  = shaderTexture[1].Sample(samplerState, coords_2).x * 64;\n"
+                       "sample.z  = shaderTexture[2].Sample(samplerState, coords_2).x * 64;\n"
                        "sample.a  = 1;";
                 break;
             case VLC_CODEC_I420:



More information about the vlc-commits mailing list