d3d12: Use ID3D12DeviceConfiguration for root signature serialization

If we were able to create a device factory from a DLL-local D3D12Core,
we want to use that one to do root signature serialization, instead of
going to the globally-configured D3D12Core.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18305>
This commit is contained in:
Jesse Natalie 2022-08-28 06:40:23 -07:00 committed by Marge Bot
parent 6a1268cc4f
commit 035db6f011
3 changed files with 17 additions and 4 deletions

View file

@ -79,6 +79,9 @@ d3d12_context_destroy(struct pipe_context *pctx)
dxil_destroy_validator(ctx->dxil_validator);
#endif
if (ctx->dev_config)
ctx->dev_config->Release();
if (ctx->timestamp_query)
pctx->destroy_query(pctx, ctx->timestamp_query);
@ -2545,6 +2548,7 @@ d3d12_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
ctx->D3D12SerializeVersionedRootSignature =
(PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE)util_dl_get_proc_address(screen->d3d12_mod, "D3D12SerializeVersionedRootSignature");
(void)screen->dev->QueryInterface(&ctx->dev_config);
ctx->submit_id = (uint64_t)p_atomic_add_return(&screen->ctx_count, 1) << 32ull;

View file

@ -254,6 +254,7 @@ struct d3d12_context {
struct d3d12_descriptor_handle null_sampler;
PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE D3D12SerializeVersionedRootSignature;
ID3D12DeviceConfiguration *dev_config;
#ifdef _WIN32
struct dxil_validator *dxil_validator;
#endif

View file

@ -208,10 +208,18 @@ create_root_signature(struct d3d12_context *ctx, struct d3d12_root_signature_key
root_sig_desc.Desc_1_1.Flags |= D3D12_ROOT_SIGNATURE_FLAG_ALLOW_STREAM_OUTPUT;
ComPtr<ID3DBlob> sig, error;
if (FAILED(ctx->D3D12SerializeVersionedRootSignature(&root_sig_desc,
&sig, &error))) {
debug_printf("D3D12SerializeRootSignature failed\n");
return NULL;
if (ctx->dev_config) {
if (FAILED(ctx->dev_config->SerializeVersionedRootSignature(&root_sig_desc,
&sig, &error))) {
debug_printf("D3D12SerializeRootSignature failed\n");
return NULL;
}
} else {
if (FAILED(ctx->D3D12SerializeVersionedRootSignature(&root_sig_desc,
&sig, &error))) {
debug_printf("D3D12SerializeRootSignature failed\n");
return NULL;
}
}
ID3D12RootSignature *ret;