[PR #1740] d3d12: log the pipeline state stream refusal reason for E_INVALIDARG #1755

Open
opened 2026-11-26 21:18:50 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1740
Author: @Mby159
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: feat/pso-stream-refusal-reason


📝 Commits (1)

  • 28f9123 d3d12: log the pipeline state stream refusal reason for E_INVALIDARG (RT-PSO-STREAM-EINVALIDARG-REASON)

📊 Changes

3 files changed (+42 additions, -19 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+7 -4)
📝 runtime/shims/d3d12_vulkan_device.cpp (+34 -14)
📝 runtime/shims/d3d12_xs_device.cpp (+1 -1)

📄 Description

Claimed in the coordination issue as: RT-PSO-STREAM-EINVALIDARG-REASON
(https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7159937113)

Depends on: none

What and why

ID3D12Device2::CreatePipelineState refuses a pipeline state stream with E_INVALIDARG without saying why, so a pipeline that is skipped cannot be seen in the log.

Two places make the refusal silent, both on main 57ba40bd6:

  • runtime/shims/d3d12_vulkan_device.cpp:12127: the finish lambda of the PC CreatePipelineState records a PipelineStream::Refused trace for E_NOTIMPL only, and every E_INVALIDARG from parse_pipeline_stream returns a bare HRESULT, so d3d12_trace::stream_refusal stays null;
  • runtime/shims/d3d12_xs_device.cpp:4729: the LEONIDA_PSO_STREAM_AUDIT gate fires for E_NOTIMPL and E_FAIL only, and audit_pso_stream is called from that console proxy path alone, so the PC path prints no audit line either.

This pull request gives each refusal a reason and prints it once, next to the existing stream_unsupported helper:

  • parse_pipeline_stream: a reason for every E_INVALIDARG — the stream has no subobjects, it ends inside a subobject type or payload, an unknown subobject type, two subobjects of one family, a compute stage with graphics stages, no shader stage;
  • create_graphics: the two mesh cases (a mesh pipeline with a vertex, tessellation or geometry stage; a graphics pipeline with no vertex stage) name their reason too; the remaining graphics-state refusals get one generic reason;
  • the PC CreatePipelineState prints each reason once through log_once (no environment variable needed) and records the E_INVALIDARG refusals in the PipelineStream::Refused trace when tracing is on; the console proxy's LEONIDA_PSO_STREAM_AUDIT gate is widened to E_INVALIDARG, and the audit call site stays console-only;
  • docs/d3d12_vulkan.md describes the refusal reason and the audit.

The HRESULTs do not change: every refusal still returns E_INVALIDARG. What is added is a reason string, one [rt] d3d12: <reason> <type> line per distinct (reason, subobject type) pair, one [d3d12-trace] record per refusal when tracing is on, and the console path's audit line for an E_INVALIDARG refusal when LEONIDA_PSO_STREAM_AUDIT=1 is set.

Tested

  • clang++ -std=c++20 -fsyntax-only (LLVM/Clang 21 from llvm-mingw, -fms-extensions, -ferror-limit=0, -Wall -Wextra) on runtime/shims/d3d12_vulkan_device.cpp and runtime/shims/d3d12_xs_device.cpp: the diagnostic set of this branch and of main 57ba40bd6 is the same (508 lines / 34 distinct messages on the first file, 2 / 2 on the second, identical on both sides), so the change adds none. The five errors in that set are pre-existing on main and come from the stub headers this machine has instead of the Windows SDK; this is a diagnostic-parity check, not a build.
  • Not built, not linked and not run: this machine has no MSVC, no Windows SDK and no GPU, so the runtime test binaries could not be built and no pipeline was created. The repository's Runtime workflow (.github/workflows/runtime.yml) builds the runtime/ tree with MSVC on windows-latest and runs the CPU runtime tests with ctest, and it runs on pull requests whose changed paths include runtime/**, so it covers this change; that build was not run here.

GPUs tested: none — no GPU on this machine, nothing was run on one

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (not applicable: no translator rule is added)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1740 **Author:** [@Mby159](https://github.com/Mby159) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/pso-stream-refusal-reason` --- ### 📝 Commits (1) - [`28f9123`](https://github.com/ubiquitarianism/leonida/commit/28f9123cc3964344f4002e5a01feb6b240f89b82) d3d12: log the pipeline state stream refusal reason for E_INVALIDARG (RT-PSO-STREAM-EINVALIDARG-REASON) ### 📊 Changes **3 files changed** (+42 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+7 -4) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+34 -14) 📝 `runtime/shims/d3d12_xs_device.cpp` (+1 -1) </details> ### 📄 Description Claimed in the coordination issue as: RT-PSO-STREAM-EINVALIDARG-REASON (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7159937113) Depends on: none ### What and why `ID3D12Device2::CreatePipelineState` refuses a pipeline state stream with `E_INVALIDARG` without saying why, so a pipeline that is skipped cannot be seen in the log. Two places make the refusal silent, both on `main` 57ba40bd6: - `runtime/shims/d3d12_vulkan_device.cpp:12127`: the `finish` lambda of the PC `CreatePipelineState` records a `PipelineStream::Refused` trace for `E_NOTIMPL` only, and every `E_INVALIDARG` from `parse_pipeline_stream` returns a bare HRESULT, so `d3d12_trace::stream_refusal` stays null; - `runtime/shims/d3d12_xs_device.cpp:4729`: the `LEONIDA_PSO_STREAM_AUDIT` gate fires for `E_NOTIMPL` and `E_FAIL` only, and `audit_pso_stream` is called from that console proxy path alone, so the PC path prints no audit line either. This pull request gives each refusal a reason and prints it once, next to the existing `stream_unsupported` helper: - `parse_pipeline_stream`: a reason for every `E_INVALIDARG` — the stream has no subobjects, it ends inside a subobject type or payload, an unknown subobject type, two subobjects of one family, a compute stage with graphics stages, no shader stage; - `create_graphics`: the two mesh cases (a mesh pipeline with a vertex, tessellation or geometry stage; a graphics pipeline with no vertex stage) name their reason too; the remaining graphics-state refusals get one generic reason; - the PC `CreatePipelineState` prints each reason once through `log_once` (no environment variable needed) and records the `E_INVALIDARG` refusals in the `PipelineStream::Refused` trace when tracing is on; the console proxy's `LEONIDA_PSO_STREAM_AUDIT` gate is widened to `E_INVALIDARG`, and the audit call site stays console-only; - `docs/d3d12_vulkan.md` describes the refusal reason and the audit. The HRESULTs do not change: every refusal still returns `E_INVALIDARG`. What is added is a reason string, one `[rt] d3d12: <reason> <type>` line per distinct (reason, subobject type) pair, one `[d3d12-trace]` record per refusal when tracing is on, and the console path's audit line for an `E_INVALIDARG` refusal when `LEONIDA_PSO_STREAM_AUDIT=1` is set. ### Tested - `clang++ -std=c++20 -fsyntax-only` (LLVM/Clang 21 from llvm-mingw, `-fms-extensions`, `-ferror-limit=0`, `-Wall -Wextra`) on `runtime/shims/d3d12_vulkan_device.cpp` and `runtime/shims/d3d12_xs_device.cpp`: the diagnostic set of this branch and of `main` 57ba40bd6 is the same (508 lines / 34 distinct messages on the first file, 2 / 2 on the second, identical on both sides), so the change adds none. The five errors in that set are pre-existing on `main` and come from the stub headers this machine has instead of the Windows SDK; this is a diagnostic-parity check, not a build. - Not built, not linked and not run: this machine has no MSVC, no Windows SDK and no GPU, so the runtime test binaries could not be built and no pipeline was created. The repository's Runtime workflow (`.github/workflows/runtime.yml`) builds the `runtime/` tree with MSVC on `windows-latest` and runs the CPU runtime tests with `ctest`, and it runs on pull requests whose changed paths include `runtime/**`, so it covers this change; that build was not run here. GPUs tested: none — no GPU on this machine, nothing was run on one AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (not applicable: no translator rule is added) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1755
No description provided.