[vlc-devel] [PATCH 1/6] direct3d11: set the RGB mask for RGB32

Steve Lhomme robux4 at videolabs.io
Thu May 12 12:17:14 CEST 2016


---
 modules/video_chroma/dxgi_fmt.c         | 13 +++++++++++++
 modules/video_chroma/dxgi_fmt.h         |  1 +
 modules/video_output/win32/direct3d11.c |  2 ++
 3 files changed, 16 insertions(+)

diff --git a/modules/video_chroma/dxgi_fmt.c b/modules/video_chroma/dxgi_fmt.c
index be44b00..e7e6a85 100644
--- a/modules/video_chroma/dxgi_fmt.c
+++ b/modules/video_chroma/dxgi_fmt.c
@@ -25,6 +25,7 @@
 #endif
 
 #include "dxgi_fmt.h"
+#include <vlc_es.h>
 
 typedef struct
 {
@@ -94,3 +95,15 @@ const d3d_format_t *GetRenderFormatList(void)
 {
     return d3d_formats;
 }
+
+void DxgiFormatMask(DXGI_FORMAT format, video_format_t *fmt)
+{
+    switch (format)
+    {
+    case DXGI_FORMAT_B8G8R8X8_UNORM:
+        fmt->i_rmask = 0x0000ff00;
+        fmt->i_gmask = 0x00ff0000;
+        fmt->i_bmask = 0xff000000;
+        break;
+    }
+}
diff --git a/modules/video_chroma/dxgi_fmt.h b/modules/video_chroma/dxgi_fmt.h
index dc8839c..ba7b559 100644
--- a/modules/video_chroma/dxgi_fmt.h
+++ b/modules/video_chroma/dxgi_fmt.h
@@ -39,5 +39,6 @@ typedef struct
 
 extern const char *DxgiFormatToStr(DXGI_FORMAT format);
 extern const d3d_format_t *GetRenderFormatList(void);
+extern void DxgiFormatMask(DXGI_FORMAT format, video_format_t *);
 
 #endif /* include-guard */
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 5161e19..8a45f19 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -969,6 +969,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
                 msg_Dbg( vd, "Using pixel format %s from chroma %4.4s", output_format->name,
                              (char *)&i_src_chroma );
                 fmt->i_chroma = output_format->fourcc;
+                DxgiFormatMask( output_format->formatTexture, fmt );
                 sys->picQuadConfig.textureFormat      = output_format->formatTexture;
                 sys->picQuadConfig.resourceFormatYRGB = output_format->formatY;
                 sys->picQuadConfig.resourceFormatUV   = output_format->formatUV;
@@ -991,6 +992,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
                 msg_Dbg( vd, "Using pixel format %s for chroma %4.4s", output_format->name,
                              (char *)&i_src_chroma );
                 fmt->i_chroma = output_format->fourcc;
+                DxgiFormatMask( output_format->formatTexture, fmt );
                 sys->picQuadConfig.textureFormat      = output_format->formatTexture;
                 sys->picQuadConfig.resourceFormatYRGB = output_format->formatY;
                 sys->picQuadConfig.resourceFormatUV   = output_format->formatUV;
-- 
2.8.1



More information about the vlc-devel mailing list