[PR #1195] [CLOSED] OLD-9955: CreateShaderResourceView refuses the views D3D12 refuses (carries #220) #1227

Closed
opened 2026-11-26 20:20:31 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1195
Author: @TimIdle
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: oldpr-9955-srv-validation


📝 Commits (1)

  • 6fb60a7 d3d12: validate CreateShaderResourceView descriptors

📊 Changes

3 files changed (+508 additions, -12 deletions)

View changed files

📝 runtime/CMakeLists.txt (+8 -0)
📝 runtime/shims/d3d12_vulkan_device.cpp (+41 -12)
➕ runtime/test/d3d12_srv_validation_test.cpp (+459 -0)

📄 Description

Claimed in the coordination issue as: OLD-9955 (claim)

What and why

This carries forward old-pr/9955 by @justr4mzi (draft #220). The commit is cherry-picked onto main unchanged, with the author kept.

CreateShaderResourceView on main writes a descriptor for some views the D3D12 runtime refuses. The layer now refuses them too, in image_descriptor (runtime/shims/d3d12_vulkan_device.cpp):

  • a component mapping without the always-set bit or with a selector past FORCE_VALUE_1, for every view (before, only multisample views were checked)
  • a ResourceMinLODClamp that is negative or NaN
  • a typeless view format, or DXGI_FORMAT_UNKNOWN on a typeless texture
  • a view whose mip or array range ends past the texture (before, only the array range of multisample views)

runtime/test/d3d12_srv_validation_test.cpp compares the layer with the host D3D12 runtime case by case.

Tested

Native Windows 11 10.0.26300, MSVC 19.44, RelWithDebInfo, LEONIDA_REQUIRE_VULKAN=ON, on main 42537e7 plus the commit.

Check Result
d3d12_srv_validation_test with the fix pass: 16 valid cases accepted, 90 invalid cases rejected (0 validation errors)
d3d12_srv_validation_test with main's d3d12_vulkan_device.cpp fail: line 305: expect_null_srv(tex1d.p, &bad)
full ctest -j 6 403 of 403 passed, gameinput and gameinput_script disabled.

GPUs tested: NVIDIA GeForce RTX 2050 (Ampere GA107, laptop), driver 621.24, Windows 11

AI-assisted: yes (Claude Code)

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. (No translator rule here.)

🤖 Generated with Claude Code


🔄 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/1195 **Author:** [@TimIdle](https://github.com/TimIdle) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `oldpr-9955-srv-validation` --- ### 📝 Commits (1) - [`6fb60a7`](https://github.com/ubiquitarianism/leonida/commit/6fb60a75f45a3a1efcb9d6fa1a55cbddd7bf89cb) d3d12: validate CreateShaderResourceView descriptors ### 📊 Changes **3 files changed** (+508 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `runtime/CMakeLists.txt` (+8 -0) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+41 -12) ➕ `runtime/test/d3d12_srv_validation_test.cpp` (+459 -0) </details> ### 📄 Description Claimed in the coordination issue as: OLD-9955 ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7142645744)) ### What and why This carries forward `old-pr/9955` by @justr4mzi (draft #220). The commit is cherry-picked onto `main` unchanged, with the author kept. `CreateShaderResourceView` on `main` writes a descriptor for some views the D3D12 runtime refuses. The layer now refuses them too, in `image_descriptor` (`runtime/shims/d3d12_vulkan_device.cpp`): - a component mapping without the always-set bit or with a selector past `FORCE_VALUE_1`, for every view (before, only multisample views were checked) - a `ResourceMinLODClamp` that is negative or NaN - a typeless view format, or `DXGI_FORMAT_UNKNOWN` on a typeless texture - a view whose mip or array range ends past the texture (before, only the array range of multisample views) `runtime/test/d3d12_srv_validation_test.cpp` compares the layer with the host D3D12 runtime case by case. ### Tested Native Windows 11 10.0.26300, MSVC 19.44, RelWithDebInfo, `LEONIDA_REQUIRE_VULKAN=ON`, on `main` `42537e7` plus the commit. | Check | Result | |---|---| | `d3d12_srv_validation_test` with the fix | pass: `16 valid cases accepted, 90 invalid cases rejected (0 validation errors)` | | `d3d12_srv_validation_test` with `main`'s `d3d12_vulkan_device.cpp` | fail: `line 305: expect_null_srv(tex1d.p, &bad)` | | full `ctest -j 6` | 403 of 403 passed, `gameinput` and `gameinput_script` disabled. | GPUs tested: NVIDIA GeForce RTX 2050 (Ampere GA107, laptop), driver 621.24, Windows 11 AI-assisted: yes (Claude Code) ### 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. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (No translator rule here.) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:20:31 +01:00
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#1227
No description provided.