D3D12: Include serializer error messages in pipeline layout creation

Currently, Dawn ignores the output of D3D12SerializeRootSignature. This
change adds these error messages to the the CheckHRESULT context.

Change-Id: Ieeb63d7b5408ca1bc9e4ab97d777f764cdf06664
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62163
Commit-Queue: Michael Tang <tangm@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Michael Tang 2021-08-18 00:36:37 +00:00 committed by Dawn LUCI CQ
parent 8d1ead6393
commit 71d7c2e670
1 changed files with 15 additions and 4 deletions

View File

@ -13,6 +13,7 @@
// limitations under the License. // limitations under the License.
#include "dawn_native/d3d12/PipelineLayoutD3D12.h" #include "dawn_native/d3d12/PipelineLayoutD3D12.h"
#include <sstream>
#include "common/Assert.h" #include "common/Assert.h"
#include "common/BitSetIterator.h" #include "common/BitSetIterator.h"
@ -195,10 +196,20 @@ namespace dawn_native { namespace d3d12 {
ComPtr<ID3DBlob> signature; ComPtr<ID3DBlob> signature;
ComPtr<ID3DBlob> error; ComPtr<ID3DBlob> error;
DAWN_TRY(CheckHRESULT( HRESULT hr = device->GetFunctions()->d3d12SerializeRootSignature(
device->GetFunctions()->d3d12SerializeRootSignature( &rootSignatureDescriptor, D3D_ROOT_SIGNATURE_VERSION_1, &signature, &error);
&rootSignatureDescriptor, D3D_ROOT_SIGNATURE_VERSION_1, &signature, &error), if (DAWN_UNLIKELY(FAILED(hr))) {
"D3D12 serialize root signature")); std::ostringstream messageStream;
if (error) {
messageStream << static_cast<const char*>(error->GetBufferPointer());
// |error| is observed to always end with a \n, but is not
// specified to do so, so we add an extra newline just in case.
messageStream << std::endl;
}
messageStream << "D3D12 serialize root signature";
DAWN_TRY(CheckHRESULT(hr, messageStream.str().c_str()));
}
DAWN_TRY(CheckHRESULT(device->GetD3D12Device()->CreateRootSignature( DAWN_TRY(CheckHRESULT(device->GetD3D12Device()->CreateRootSignature(
0, signature->GetBufferPointer(), signature->GetBufferSize(), 0, signature->GetBufferPointer(), signature->GetBufferSize(),
IID_PPV_ARGS(&mRootSignature)), IID_PPV_ARGS(&mRootSignature)),