From 856f1d4e3c95034eb171225007318645567a9a60 Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Wed, 18 Jun 2025 13:23:19 -0700 Subject: [PATCH] d3d12: Fail-fast on PSO creation failures I'm seeing crash reports from the wild where it's not necessarily clear why something failed, and it'd be nice to have the PSO desc on the stack when something failed. It ends up being fatal anyway (we don't gracefully drop draw calls, and I don't think we should). Part-of: --- src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp b/src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp index 0b69928d141..8c33f66f31e 100644 --- a/src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp +++ b/src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp @@ -43,6 +43,7 @@ #include "util/u_prim.h" #include +#include struct d3d12_gfx_pso_entry { struct d3d12_gfx_pipeline_state key; @@ -388,23 +389,24 @@ create_gfx_pipeline_state(struct d3d12_context *ctx) ID3D12PipelineState *ret; + HRESULT hr; if (screen->opts14.IndependentFrontAndBackStencilRefMaskSupported) { D3D12_PIPELINE_STATE_STREAM_DESC pso_stream_desc{ sizeof(pso_desc), &pso_desc }; - if (FAILED(screen->dev->CreatePipelineState(&pso_stream_desc, - IID_PPV_ARGS(&ret)))) { - debug_printf("D3D12: CreateGraphicsPipelineState failed!\n"); + if (FAILED(hr = screen->dev->CreatePipelineState(&pso_stream_desc, + IID_PPV_ARGS(&ret)))) { + std::_Exit(hr); return NULL; } } else { D3D12_GRAPHICS_PIPELINE_STATE_DESC v0desc = pso_desc.GraphicsDescV0(); - if (FAILED(screen->dev->CreateGraphicsPipelineState(&v0desc, - IID_PPV_ARGS(&ret)))) { - debug_printf("D3D12: CreateGraphicsPipelineState failed!\n"); + if (FAILED(hr = screen->dev->CreateGraphicsPipelineState(&v0desc, + IID_PPV_ARGS(&ret)))) { + std::_Exit(hr); return NULL; } }