Mesa (staging/22.0): d3d12: fix return-code without dxcompiler.dll

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 6 21:45:48 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: fde26bbfbed877f50a61f82e61b8a81ab25f255b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fde26bbfbed877f50a61f82e61b8a81ab25f255b

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Tue Apr  5 08:40:42 2022 +0200

d3d12: fix return-code without dxcompiler.dll

When we don't have a good dxcompiler.dll that we can load IDxcLibrary
from to help with diagnostics, we currently return true for validation
even if the validation actually failed.

Let's fix that, and also add a debug-message explaining what went wrong
for those who are debugging and wondering what's up.

Fixes: 2ea15cd661c ("d3d12: introduce d3d12 gallium driver")
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15744>
(cherry picked from commit 837f781c9a4f909ac1ee0b3b8331af87301b5fc3)

---

 .pick_status.json                            | 2 +-
 src/gallium/drivers/d3d12/d3d12_compiler.cpp | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 214250298d9..c483a12d923 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4,7 +4,7 @@
         "description": "d3d12: fix return-code without dxcompiler.dll",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "because_sha": "2ea15cd661c8355e8e35624eba0bf10cbcd57f61"
     },
     {
diff --git a/src/gallium/drivers/d3d12/d3d12_compiler.cpp b/src/gallium/drivers/d3d12/d3d12_compiler.cpp
index bc4c19436c3..1fa9cd82924 100644
--- a/src/gallium/drivers/d3d12/d3d12_compiler.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_compiler.cpp
@@ -1566,7 +1566,13 @@ bool d3d12_validation_tools::validate_and_sign(struct blob *dxil)
    validator->Validate(&source, DxcValidatorFlags_InPlaceEdit, &result);
    HRESULT validationStatus;
    result->GetStatus(&validationStatus);
-   if (FAILED(validationStatus) && library) {
+   if (FAILED(validationStatus)) {
+      if (!library) {
+         debug_printf("D3D12: validation failed, but lacking "
+                      "IDxcLibrary for proper diagnostics.\n");
+         return false;
+      }
+
       ComPtr<IDxcBlobEncoding> printBlob, printBlobUtf8;
       result->GetErrorBuffer(&printBlob);
       library->GetBlobAsUtf8(printBlob.Get(), printBlobUtf8.GetAddressOf());



More information about the mesa-commit mailing list