mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
d3d12: Fail screen creation if a shader validator is needed and can't be created
Also fail screen creation if experimental shader models are requested, but can't be enabled
Fixes: 2ea15cd6 ("d3d12: introduce d3d12 gallium driver")
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Tested-by: Prodea Alexandru-Liviu <liviuprodea@yahoo.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4022
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8865>
This commit is contained in:
parent
f66b0c7303
commit
2ddafc2676
3 changed files with 24 additions and 9 deletions
|
|
@ -84,7 +84,11 @@ struct d3d12_validation_tools
|
|||
|
||||
struct d3d12_validation_tools *d3d12_validator_create()
|
||||
{
|
||||
return new d3d12_validation_tools();
|
||||
d3d12_validation_tools *tools = new d3d12_validation_tools();
|
||||
if (tools->validator)
|
||||
return tools;
|
||||
delete tools;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void d3d12_validator_destroy(struct d3d12_validation_tools *validator)
|
||||
|
|
@ -192,10 +196,12 @@ compile_nir(struct d3d12_context *ctx, struct d3d12_shader_selector *sel,
|
|||
shader->cb_bindings[shader->num_cb_bindings++].binding = i;
|
||||
}
|
||||
}
|
||||
ctx->validation_tools->validate_and_sign(&tmp);
|
||||
if (ctx->validation_tools) {
|
||||
ctx->validation_tools->validate_and_sign(&tmp);
|
||||
|
||||
if (d3d12_debug & D3D12_DEBUG_DISASS) {
|
||||
ctx->validation_tools->disassemble(&tmp);
|
||||
if (d3d12_debug & D3D12_DEBUG_DISASS) {
|
||||
ctx->validation_tools->disassemble(&tmp);
|
||||
}
|
||||
}
|
||||
|
||||
blob_finish_get_buffer(&tmp, &shader->bytecode, &shader->bytecode_length);
|
||||
|
|
@ -1255,8 +1261,6 @@ bool d3d12_validation_tools::validate_and_sign(struct blob *dxil)
|
|||
ShaderBlob source(dxil);
|
||||
|
||||
ComPtr<IDxcOperationResult> result;
|
||||
if (!validator)
|
||||
return false;
|
||||
|
||||
validator->Validate(&source, DxcValidatorFlags_InPlaceEdit, &result);
|
||||
HRESULT validationStatus;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@ static void
|
|||
d3d12_context_destroy(struct pipe_context *pctx)
|
||||
{
|
||||
struct d3d12_context *ctx = d3d12_context(pctx);
|
||||
d3d12_validator_destroy(ctx->validation_tools);
|
||||
if (ctx->validation_tools)
|
||||
d3d12_validator_destroy(ctx->validation_tools);
|
||||
|
||||
if (ctx->timestamp_query)
|
||||
pctx->destroy_query(pctx, ctx->timestamp_query);
|
||||
|
|
|
|||
|
|
@ -715,11 +715,21 @@ create_device(IUnknown *adapter)
|
|||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
if (d3d12_debug & D3D12_DEBUG_EXPERIMENTAL)
|
||||
if (!(d3d12_debug & D3D12_DEBUG_EXPERIMENTAL)) {
|
||||
struct d3d12_validation_tools *validation_tools = d3d12_validator_create();
|
||||
if (!validation_tools) {
|
||||
debug_printf("D3D12: failed to initialize validator with experimental shader models disabled\n");
|
||||
return nullptr;
|
||||
}
|
||||
d3d12_validator_destroy(validation_tools);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
D3D12EnableExperimentalFeatures = (PFN_D3D12ENABLEEXPERIMENTALFEATURES)util_dl_get_proc_address(d3d12_mod, "D3D12EnableExperimentalFeatures");
|
||||
D3D12EnableExperimentalFeatures(1, &D3D12ExperimentalShaderModels, NULL, NULL);
|
||||
if (FAILED(D3D12EnableExperimentalFeatures(1, &D3D12ExperimentalShaderModels, NULL, NULL))) {
|
||||
debug_printf("D3D12: failed to enable experimental shader models\n");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
D3D12CreateDevice = (PFN_D3D12CREATEDEVICE)util_dl_get_proc_address(d3d12_mod, "D3D12CreateDevice");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue