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: 2ea15cd661 ("d3d12: introduce d3d12 gallium driver")
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15744>
(cherry picked from commit 837f781c9a)
This commit is contained in:
Erik Faye-Lund 2022-04-05 08:40:42 +02:00 committed by Dylan Baker
parent 5a9d7c8d56
commit c70adca8d2
2 changed files with 8 additions and 2 deletions

View file

@ -5292,7 +5292,7 @@
"description": "d3d12: fix return-code without dxcompiler.dll",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"because_sha": "2ea15cd661c8355e8e35624eba0bf10cbcd57f61"
},
{

View file

@ -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());