[vlc-commits] d3d11_shaders: keep using float4

Steve Lhomme git at videolan.org
Mon Oct 15 10:28:37 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Oct 15 10:26:57 2018 +0200| [be20bc3003af6bb2bca2f90802e04e8a69942840] | committer: Steve Lhomme

d3d11_shaders: keep using float4

float3x3 multiplying doesn't seem to work well when float4x4 works fine.
And it doesn't seem to have any performance impact.

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

 modules/video_output/win32/d3d11_shaders.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/modules/video_output/win32/d3d11_shaders.c b/modules/video_output/win32/d3d11_shaders.c
index 9fea7806d6..0563a7e0d0 100644
--- a/modules/video_output/win32/d3d11_shaders.c
+++ b/modules/video_output/win32/d3d11_shaders.c
@@ -75,7 +75,7 @@ static const char* globPixelShaderDefault = "\
   };\n\
   \n\
   /* see http://filmicworlds.com/blog/filmic-tonemapping-operators/ */\n\
-  inline float3 hable(float3 x) {\n\
+  inline float4 hable(float4 x) {\n\
       const float A = 0.15, B = 0.50, C = 0.10, D = 0.20, E = 0.02, F = 0.30;\n\
       return ((x * (A*x + (C*B))+(D*E))/(x * (A*x + B) + (D*F))) - E/F;\n\
   }\n\
@@ -93,27 +93,27 @@ static const char* globPixelShaderDefault = "\
       return x;\n\
   }\n\
   \n\
-  inline float3 sourceToLinear(float3 rgb) {\n\
+  inline float4 sourceToLinear(float4 rgb) {\n\
       %s;\n\
   }\n\
   \n\
-  inline float3 linearToDisplay(float3 rgb) {\n\
+  inline float4 linearToDisplay(float4 rgb) {\n\
       %s;\n\
   }\n\
   \n\
-  inline float3 transformPrimaries(float3 rgb) {\n\
+  inline float4 transformPrimaries(float4 rgb) {\n\
       %s;\n\
   }\n\
   \n\
-  inline float3 toneMapping(float3 rgb) {\n\
+  inline float4 toneMapping(float4 rgb) {\n\
       %s;\n\
   }\n\
   \n\
-  inline float3 adjustRange(float3 rgb) {\n\
+  inline float4 adjustRange(float4 rgb) {\n\
       %s;\n\
   }\n\
   \n\
-  inline float3 reorderPlanes(float3 rgb) {\n\
+  inline float4 reorderPlanes(float4 rgb) {\n\
       %s;\n\
   }\n\
   \n\
@@ -133,14 +133,14 @@ static const char* globPixelShaderDefault = "\
         sample = sampleTexture( SamplerStates[0], In.Texture );\n\
     float4 rgba = mul(mul(sample, WhitePoint), Colorspace);\n\
     float opacity = rgba.a * Opacity;\n\
-    float3 rgb = (float3)rgba;\n\
+    float4 rgb = rgba; rgb.a = 0;\n\
     rgb = sourceToLinear(rgb);\n\
     rgb = transformPrimaries(rgb);\n\
     rgb = toneMapping(rgb);\n\
     rgb = linearToDisplay(rgb);\n\
     rgb = adjustRange(rgb);\n\
     rgb = reorderPlanes(rgb);\n\
-    return float4(rgb, saturate(opacity));\n\
+    return float4(rgb.rgb, saturate(opacity));\n\
   }\n\
 ";
 



More information about the vlc-commits mailing list