d3d12: translate console depth format 118 in allocation queries #584

Closed
csj0oe wants to merge 1 commit from upstream-pr/584 into main
csj0oe commented 2026-11-30 08:02:27 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by csj0oe on 2026-11-30T08:02:27Z.


What

GetResourceAllocationInfo answered UINT64_MAX for a 2560×1440 console-depth resource (format 118, flags 0x80300006). Console format 118 is D16_UNORM_S8_UINT; the host has no 16-bit depth with stencil and must be asked about the format it will actually create.

  • host_description now translates the format through format::host_format on every path, not only when console flag bits are present, and drops ALLOW_UNORDERED_ACCESS for a depth image (a desktop depth image cannot also be UAV; the size is unchanged).
  • info2 uses the same description instead of depth::primary alone.
  • Formats that need no translation return None as before.

Caveat

The recorded evidence names width, height, format and flags but not the layout. With Layout == UNKNOWN the existing pair mapping already handled 118, so the sentinel implies the forwarded ROW_MAJOR case this fixes. If a future log shows allocation requires … layout=0x100…, the console-layout plane calculator is the place to fix instead — that path accepts only formats 19/20/44/45, 39/40 and 53/55.

Tests

  • Failing first: the host description stays 118 instead of mapping to 20.
  • console_depth_allocation_descriptor_takes_a_host_format (CPU) asserts the translation, the UNKNOWN pair mapping and an untouched desktop format.
  • console_depth_allocation_descriptor_answers_a_size_on_both_slots is hardware-gated and not run here.

Not run

NVIDIA, and the D3D12/Lanes GPU suites that CONTRIBUTING asks for on a runtime/d3d12 change; the hardware-gated test above did not run here.

<!-- greyfinch-sync:brcly/TuxBox:issue:5561372658 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/584). Originally posted by [csj0oe](https://github.com/csj0oe) on 2026-11-30T08:02:27Z. --- ## What `GetResourceAllocationInfo` answered `UINT64_MAX` for a 2560×1440 console-depth resource (format 118, flags `0x80300006`). Console format 118 is `D16_UNORM_S8_UINT`; the host has no 16-bit depth with stencil and must be asked about the format it will actually create. - `host_description` now translates the format through `format::host_format` on every path, not only when console flag bits are present, and drops `ALLOW_UNORDERED_ACCESS` for a depth image (a desktop depth image cannot also be UAV; the size is unchanged). - `info2` uses the same description instead of `depth::primary` alone. - Formats that need no translation return `None` as before. ## Caveat The recorded evidence names width, height, format and flags but not the layout. With `Layout == UNKNOWN` the existing pair mapping already handled 118, so the sentinel implies the forwarded `ROW_MAJOR` case this fixes. If a future log shows `allocation requires … layout=0x100…`, the console-layout plane calculator is the place to fix instead — that path accepts only formats 19/20/44/45, 39/40 and 53/55. ## Tests - Failing first: the host description stays 118 instead of mapping to 20. - `console_depth_allocation_descriptor_takes_a_host_format` (CPU) asserts the translation, the UNKNOWN pair mapping and an untouched desktop format. - `console_depth_allocation_descriptor_answers_a_size_on_both_slots` is hardware-gated and not run here. ## Not run NVIDIA, and the D3D12/Lanes GPU suites that `CONTRIBUTING` asks for on a `runtime/d3d12` change; the hardware-gated test above did not run here.
brcly commented 2026-11-30 09:50:43 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T09:50:43Z.


Thanks. Asking the host about the format it will actually create is the right principle. Before merging I need two things, though:

  1. The evidence. Where did the UINT64_MAX for 2560×1440, format 118, flags 0x80300006 come from: which build, which scene, and which log line? I can't find it in our recent boots. Your caveat says the layout isn't known and that the fix depends on it being the forwarded ROW_MAJOR case. So please capture a run that logs the layout, and show the query answering a size with this change.
  2. The scope. This changes more than format 118. host_description now runs host_format and the UAV drop on every description, and info2 now uses it too. So every console format that host_format translates gets a different size and alignment answer than before. The title places its resources by these answers, and that's the kind of quiet change that broke games after #527. Please either:
    • limit the change to the case you've seen (format 118 with depth-stencil), or
    • show that, for every format host_format changes, the answer now matches what resource creation actually allocates. A table of before and after for each translated format would do.

The hardware-gated test didn't run on your machine, so please also run it on a card. I can cover NVIDIA once the two points above are settled.

<!-- greyfinch-sync:brcly/TuxBox:comment:7274763747 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/584#issuecomment-7274763747). Originally posted by [brcly](https://github.com/brcly) on 2026-11-30T09:50:43Z. --- Thanks. Asking the host about the format it will actually create is the right principle. Before merging I need two things, though: 1. **The evidence.** Where did the `UINT64_MAX` for 2560×1440, format 118, flags `0x80300006` come from: which build, which scene, and which log line? I can't find it in our recent boots. Your caveat says the layout isn't known and that the fix depends on it being the forwarded `ROW_MAJOR` case. So please capture a run that logs the layout, and show the query answering a size with this change. 2. **The scope.** This changes more than format 118. `host_description` now runs `host_format` and the UAV drop on *every* description, and `info2` now uses it too. So every console format that `host_format` translates gets a different size and alignment answer than before. The title places its resources by these answers, and that's the kind of quiet change that broke games after #527. Please either: - limit the change to the case you've seen (format 118 with depth-stencil), or - show that, for every format `host_format` changes, the answer now matches what resource creation actually allocates. A table of before and after for each translated format would do. The hardware-gated test didn't run on your machine, so please also run it on a card. I can cover NVIDIA once the two points above are settled.
csj0oe commented 2026-11-30 10:19:14 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by csj0oe on 2026-11-30T10:19:14Z.


Closing, with the reason measured rather than argued.

The evidence for this PR is a recorded blocking_call in our evidence file — a 2560x1440, format 118, flags 0x80300006 GetResourceAllocationInfo that answered UINT64_MAX on 23 November, on a build I cannot attribute to a particular scene, and without the layout field. You were right that it is not a log line.

I then narrowed the change to depth resources only, so colour formats keep the answers they had, and ran the tests on this machine: both unit tests pass, but the hardware-gated one fails — with the translated D32_FLOAT_S8X24 description, GetResourceAllocationInfo still answers UINT64_MAX (assertion left != right failed: host cannot size the reference depth image, both sides 18446744073709551615). So on the one card I have, the change does not turn the sentinel into a size, and I will not ask you to merge a fix whose premise I cannot show.

The trace that would settle it is opt-in and now wired for the next instrumented run: TUXBOX_TRACE_ALLOCATION_BYTES=invalid prints allocation trace <kind> caller=… bytes=… align=… plus format flags layout per item. If it shows a real format=118 query answering UINT64_MAX, the narrowed change comes back with that line and the layout, and the sentinel's cause is a fact instead of an inference. Branch kept.

<!-- greyfinch-sync:brcly/TuxBox:comment:7275429765 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/584#issuecomment-7275429765). Originally posted by [csj0oe](https://github.com/csj0oe) on 2026-11-30T10:19:14Z. --- Closing, with the reason measured rather than argued. The evidence for this PR is a recorded `blocking_call` in our evidence file — a 2560x1440, format 118, flags `0x80300006` `GetResourceAllocationInfo` that answered `UINT64_MAX` on 23 November, on a build I cannot attribute to a particular scene, and without the layout field. You were right that it is not a log line. I then narrowed the change to depth resources only, so colour formats keep the answers they had, and ran the tests on this machine: both unit tests pass, but the hardware-gated one fails — with the translated `D32_FLOAT_S8X24` description, `GetResourceAllocationInfo` still answers `UINT64_MAX` (`assertion left != right failed: host cannot size the reference depth image`, both sides `18446744073709551615`). So on the one card I have, the change does not turn the sentinel into a size, and I will not ask you to merge a fix whose premise I cannot show. The trace that would settle it is opt-in and now wired for the next instrumented run: `TUXBOX_TRACE_ALLOCATION_BYTES=invalid` prints `allocation trace <kind> caller=… bytes=… align=…` plus `format flags layout` per item. If it shows a real `format=118` query answering `UINT64_MAX`, the narrowed change comes back with that line and the layout, and the sentinel's cause is a fact instead of an inference. Branch kept.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
brcly/TuxBox!584
No description provided.