[vlc-commits] d3d11: move the shader function in a separate structure

Steve Lhomme git at videolan.org
Wed Feb 12 16:44:39 CET 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Feb 12 14:19:05 2020 +0100| [c50f21688d0bcf76d36527e7def64772ae25e6dd] | committer: Steve Lhomme

d3d11: move the shader function in a separate structure

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

 modules/video_chroma/d3d11_fmt.c           | 18 +++++++++---------
 modules/video_chroma/d3d11_fmt.h           |  9 +++++++--
 modules/video_output/win32/d3d11_shaders.c |  2 +-
 3 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index 25f987f902..7a63fa52c7 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -702,17 +702,17 @@ int D3D11_Create(vlc_object_t *obj, d3d11_handle_t *hd3d, bool with_shaders)
 
     if (with_shaders)
     {
-        hd3d->compiler_dll = Direct3D11LoadShaderLibrary();
-        if (!hd3d->compiler_dll) {
+        hd3d->shaders.compiler_dll = Direct3D11LoadShaderLibrary();
+        if (!hd3d->shaders.compiler_dll) {
             msg_Err(obj, "cannot load d3dcompiler.dll, aborting");
             FreeLibrary(hd3d->hdll);
             return VLC_EGENERIC;
         }
 
-        hd3d->OurD3DCompile = (void *)GetProcAddress(hd3d->compiler_dll, "D3DCompile");
-        if (!hd3d->OurD3DCompile) {
+        hd3d->shaders.OurD3DCompile = (void *)GetProcAddress(hd3d->shaders.compiler_dll, "D3DCompile");
+        if (!hd3d->shaders.OurD3DCompile) {
             msg_Err(obj, "Cannot locate reference to D3DCompile in d3dcompiler DLL");
-            FreeLibrary(hd3d->compiler_dll);
+            FreeLibrary(hd3d->shaders.compiler_dll);
             FreeLibrary(hd3d->hdll);
             return VLC_EGENERIC;
         }
@@ -760,12 +760,12 @@ void D3D11_Destroy(d3d11_handle_t *hd3d)
     if (hd3d->hdll)
         FreeLibrary(hd3d->hdll);
 
-    if (hd3d->compiler_dll)
+    if (hd3d->shaders.compiler_dll)
     {
-        FreeLibrary(hd3d->compiler_dll);
-        hd3d->compiler_dll = NULL;
+        FreeLibrary(hd3d->shaders.compiler_dll);
+        hd3d->shaders.compiler_dll = NULL;
     }
-    hd3d->OurD3DCompile = NULL;
+    hd3d->shaders.OurD3DCompile = NULL;
 
 #if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
     if (hd3d->dxgidebug_dll)
diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h
index 79142a266e..f8ff31724a 100644
--- a/modules/video_chroma/d3d11_fmt.h
+++ b/modules/video_chroma/d3d11_fmt.h
@@ -56,10 +56,15 @@ typedef struct
 
 typedef struct
 {
-#if !VLC_WINSTORE_APP
-    HINSTANCE                 hdll;         /* handle of the opened d3d11 dll */
     HINSTANCE                 compiler_dll; /* handle of the opened d3dcompiler dll */
     pD3DCompile               OurD3DCompile;
+} d3d11_shaders_t;
+
+typedef struct
+{
+#if !VLC_WINSTORE_APP
+    HINSTANCE                 hdll;         /* handle of the opened d3d11 dll */
+    d3d11_shaders_t           shaders;
 #if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
     HINSTANCE                 dxgidebug_dll;
     HRESULT (WINAPI * pf_DXGIGetDebugInterface)(const GUID *riid, void **ppDebug);
diff --git a/modules/video_output/win32/d3d11_shaders.c b/modules/video_output/win32/d3d11_shaders.c
index 1f943953c2..21937afe53 100644
--- a/modules/video_output/win32/d3d11_shaders.c
+++ b/modules/video_output/win32/d3d11_shaders.c
@@ -39,7 +39,7 @@
 #include "d3d11_shaders.h"
 
 #if !VLC_WINSTORE_APP
-# define D3DCompile(args...)                    hd3d->OurD3DCompile(args)
+# define D3DCompile(args...)                    hd3d->shaders.OurD3DCompile(args)
 #endif
 
 #define ST2084_PQ_CONSTANTS  "const float ST2084_m1 = 2610.0 / (4096.0 * 4);\n\



More information about the vlc-commits mailing list