Mesa (master): d3d12: Don't require DXIL for WSL

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Dec 16 16:42:47 UTC 2020


Module: Mesa
Branch: master
Commit: eb4353838d7b54f0811d171da9afad5416b04059
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=eb4353838d7b54f0811d171da9afad5416b04059

Author: Jesse Natalie <jenatali at microsoft.com>
Date:   Fri Dec  4 15:39:55 2020 -0800

d3d12: Don't require DXIL for WSL

Always use the experimental shader models feature, which allows
unsigned DXIL to be used, so we don't need a libdxil for WSL.

Reviewed-by: Bill Kristiansen <billkris at microsoft.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937>

---

 src/gallium/drivers/d3d12/d3d12_compiler.cpp | 16 +++++++++++-----
 src/gallium/drivers/d3d12/d3d12_screen.cpp   |  5 ++++-
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/d3d12/d3d12_compiler.cpp b/src/gallium/drivers/d3d12/d3d12_compiler.cpp
index f42ab1ecd68..4b09a51587a 100644
--- a/src/gallium/drivers/d3d12/d3d12_compiler.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_compiler.cpp
@@ -1174,19 +1174,25 @@ d3d12_validation_tools::d3d12_validation_tools()
 {
    load_dxil_dll();
    DxcCreateInstanceProc dxil_create_func = (DxcCreateInstanceProc)util_dl_get_proc_address(dxil_module, "DxcCreateInstance");
-   assert(dxil_create_func);
 
-   HRESULT hr = dxil_create_func(CLSID_DxcValidator,  IID_PPV_ARGS(&validator));
-   if (FAILED(hr)) {
-      debug_printf("D3D12: Unable to create validator\n");
+   if (dxil_create_func) {
+      HRESULT hr = dxil_create_func(CLSID_DxcValidator,  IID_PPV_ARGS(&validator));
+      if (FAILED(hr)) {
+         debug_printf("D3D12: Unable to create validator\n");
+      }
    }
+#ifdef _WIN32
+   else if (!(d3d12_debug & D3D12_DEBUG_EXPERIMENTAL)) {
+      debug_printf("D3D12: Unable to load DXIL.dll\n");
+   }
+#endif
 
    DxcCreateInstanceProc compiler_create_func  = nullptr;
    if(dxc_compiler_module.load("dxcompiler.dll"))
       compiler_create_func = (DxcCreateInstanceProc)util_dl_get_proc_address(dxc_compiler_module, "DxcCreateInstance");
 
    if (compiler_create_func) {
-      hr = compiler_create_func(CLSID_DxcLibrary, IID_PPV_ARGS(&library));
+      HRESULT hr = compiler_create_func(CLSID_DxcLibrary, IID_PPV_ARGS(&library));
       if (FAILED(hr)) {
          debug_printf("D3D12: Unable to create library instance: %x\n", hr);
       }
diff --git a/src/gallium/drivers/d3d12/d3d12_screen.cpp b/src/gallium/drivers/d3d12/d3d12_screen.cpp
index 4ec192e004d..e8d47810fab 100644
--- a/src/gallium/drivers/d3d12/d3d12_screen.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_screen.cpp
@@ -702,7 +702,10 @@ create_device(IUnknown *adapter)
       return NULL;
    }
 
-   if (d3d12_debug & D3D12_DEBUG_EXPERIMENTAL) {
+#ifdef _WIN32
+   if (d3d12_debug & D3D12_DEBUG_EXPERIMENTAL)
+#endif
+   {
       D3D12EnableExperimentalFeatures = (PFN_D3D12ENABLEEXPERIMENTALFEATURES)util_dl_get_proc_address(d3d12_mod, "D3D12EnableExperimentalFeatures");
       D3D12EnableExperimentalFeatures(1, &D3D12ExperimentalShaderModels, NULL, NULL);
    }



More information about the mesa-commit mailing list