[vlc-devel] [PATCH 1/6] direct3d11: code cleaning

Steve Lhomme robux4 at videolabs.io
Wed Nov 23 17:23:56 CET 2016


- 16 is for 4x4 matrices
- group the opacity padding in an array
---
 modules/video_output/win32/direct3d11.c | 36 +++++++++++----------------------
 1 file changed, 12 insertions(+), 24 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index a8601fa..cee19aa 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -121,15 +121,15 @@ typedef struct d3d_vertex_t {
 
 typedef struct {
     FLOAT Opacity;
-    FLOAT padding[3];
+    FLOAT opacityPadding[3];
 } PS_CONSTANT_BUFFER;
 
 typedef struct {
-    FLOAT RotX[16];
-    FLOAT RotY[16];
-    FLOAT RotZ[16];
-    FLOAT View[16];
-    FLOAT Projection[16];
+    FLOAT RotX[4*4];
+    FLOAT RotY[4*4];
+    FLOAT RotZ[4*4];
+    FLOAT View[4*4];
+    FLOAT Projection[4*4];
 } VS_PROJECTION_CONST;
 
 #define SPHERE_RADIUS 1.f
@@ -239,9 +239,7 @@ static const char* globPixelShaderDefault = "\
   cbuffer PS_CONSTANT_BUFFER : register(b0)\
   {\
     float Opacity;\
-    float ignoreA;\
-    float ignoreB;\
-    float ignoreC;\
+    float opacityPadding[3];\
   };\
   Texture2D shaderTexture;\
   SamplerState SampleType;\
@@ -266,9 +264,7 @@ static const char *globPixelShaderBiplanarYUV_BT601_2RGB = "\
   cbuffer PS_CONSTANT_BUFFER : register(b0)\
   {\
     float Opacity;\
-    float ignoreA;\
-    float ignoreB;\
-    float ignoreC;\
+    float opacityPadding[3];\
   };\
   Texture2D shaderTextureY;\
   Texture2D shaderTextureUV;\
@@ -301,9 +297,7 @@ static const char *globPixelShaderBiplanarYUV_BT709_2RGB = "\
   cbuffer PS_CONSTANT_BUFFER : register(b0)\
   {\
     float Opacity;\
-    float ignoreA;\
-    float ignoreB;\
-    float ignoreC;\
+    float opacityPadding[3];\
   };\
   Texture2D shaderTextureY;\
   Texture2D shaderTextureUV;\
@@ -337,9 +331,7 @@ static const char *globPixelShaderBiplanarYUV_BT2020_2RGB = "\
   cbuffer PS_CONSTANT_BUFFER : register(b0)\
   {\
     float Opacity;\
-    float ignoreA;\
-    float ignoreB;\
-    float ignoreC;\
+    float opacityPadding[3];\
   };\
   Texture2D shaderTextureY;\
   Texture2D shaderTextureUV;\
@@ -375,9 +367,7 @@ static const char *globPixelShaderBiplanarYUYV_BT709_2RGB = "\
   cbuffer PS_CONSTANT_BUFFER : register(b0)\
   {\
     float Opacity;\
-    float ignoreA;\
-    float ignoreB;\
-    float ignoreC;\
+    float opacityPadding[3];\
   };\
   Texture2D shaderTextureYUYV;\
   SamplerState SampleType;\
@@ -410,9 +400,7 @@ static const char *globPixelShaderBiplanarYUYV_BT601_2RGB = "\
   cbuffer PS_CONSTANT_BUFFER : register(b0)\
   {\
     float Opacity;\
-    float ignoreA;\
-    float ignoreB;\
-    float ignoreC;\
+    float opacityPadding[3];\
   };\
   Texture2D shaderTextureYUYV;\
   SamplerState SampleType;\
-- 
2.10.1



More information about the vlc-devel mailing list