Skip to content

Under Wine, identify the adapter from the system DXGI's ids when the driver's id query is not implemented - #252

Merged
phantoslayer21 merged 1 commit into
mainfrom
fix/wine-adapter-fallback-248
Nov 16, 2026
Merged

phantoslayer21 merged 1 commit into
mainfrom
fix/wine-adapter-fallback-248

Conversation

@phantoslayer21

Copy link
Copy Markdown
Owner

Fixes #248

What this changes and why

Since #225, an adapter counts as RDNA 4 only if the kernel-mode driver's PCI ids say so (D3DKMTQueryAdapterInfo, type 31), and the check fails closed. Wine and Proton don't implement that query: it answers STATUS_NOT_IMPLEMENTED (0xC0000002), as the probe results in #248 show. So under Proton, an RX 9070 XT would get the front end's upscaler instead of WrongGPU's models.

  • A fallback for Wine only (clean/runtime/rdna4.h, rdna4_win.h). It applies only when both of these hold:

    • the driver's query returns exactly STATUS_NOT_IMPLEMENTED;
    • the process runs under Wine (ntdll exports wine_get_version).

    Then the system DXGI's VendorId and DeviceId, for the adapter whose LUID matches the game device's, stand in for the driver's ids. They're judged by the same rule: AMD's vendor id 0x1002 and a device on the same RDNA 4 id list.

  • Everything else fails closed as before:

    • any other status from the query;
    • a query that couldn't be made (no thunks, or the adapter wasn't opened), reported as STATUS_UNSUCCESSFUL so it can never lead to the fallback;
    • STATUS_NOT_IMPLEMENTED outside Wine;
    • the system DXGI not answering.
  • Windows behaviour is unchanged. When the driver's ids are read, they alone decide, and the fallback's sources are never asked. That holds under Wine too, if Wine implements the query later.

  • One log line when the fallback accepts an adapter: "Wine: the driver's adapter id query is not implemented; the adapter was identified from the system DXGI's ids (... PCI 1002:7550 (Wine: the system DXGI's ids))". The runtime writes it at the executor choice (backend.cpp, information), and the Ray Reconstruction runtime writes it when it accepts the device. Refusals keep their current line, which now shows the ids the fallback read.

  • All callers get it, because they share the one lookup (read_adapter_identity): the executor choice, the native D3D12 device, and the Ray Reconstruction runtime.

  • A limit, stated plainly: under Wine, the system DXGI is Wine's own or the one Proton ships, and its ids can be changed by that DXGI's own configuration. That is why the fallback is Wine-only and checks the same vendor and id list. The device's driver-channel probe still has to pass when the device is created (as rdna4.h describes).

What each new or substantially changed file is based on

Own design. No new files.

How it was tested

clean/runtime/interop/tests/test_executor_select.cpp, with injected query results (AdapterSources.driver_query, under_wine, dxgi_ids) and counts of what was asked:

  • STATUS_NOT_IMPLEMENTED + Wine + the system DXGI's 1002:7550: accepted, on the D3D12 executor, with the one line. Every id on the list is accepted.
  • STATUS_NOT_IMPLEMENTED + Wine + another vendor's ids (8086): refused, and the front end's upscaler takes the game.
  • STATUS_NOT_IMPLEMENTED + Wine + 10DE:7550 (an RDNA 4 device id under another vendor's id): refused.
  • STATUS_NOT_IMPLEMENTED + Wine + an AMD board outside the list: refused, and the line says so.
  • STATUS_NOT_IMPLEMENTED without Wine (the Windows path): refused, and the system DXGI's ids are never asked.
  • Other statuses (0xC0000001, 0xC000000D, 0xC0000022), under Wine too: refused; neither Wine nor the DXGI ids are asked.
  • The driver's ids read: they decide, and the fallback is never asked. Under Wine, RDNA 3 ids from the driver are refused even when DXGI says 7550.
  • The system DXGI not answering under Wine: refused.

Results:

  • Built with MSVC /std:c++17 /permissive- /W4: 234 checks pass, no warnings. clean/tests/test_executor_select.py now builds with /permissive- too; its release and developer builds pass, 10/10 tests.
  • The real Windows path (rdna4_win.h), run on Windows 11 with an RX 9070 XT, through a small console program that only reads adapter information:
    • not under Wine;
    • the driver's query returns 0 for both adapters;
    • the RX 9070 XT (PCI 1002:7550) is accepted from the driver's ids, and the Microsoft Basic Render Driver (1414:008C) is refused;
    • no fallback and no Wine line.

Not tested:

  • Under Wine or Proton (no Wine here). @j0nsh1n, could you run this branch in your Wine runner with your probe? It should show the one Wine line and the D3D12 executor for an RDNA 4 board, and the refusal line for the RX 7900 XT. If you'd like to share the probe's source under the project's licence, it could be added as a Wine-runner check.

Checklist

  • I make the clean-room statement of CONTRIBUTING.md for this and all my contributions (required once, in my first pull request).
  • Every commit has a Signed-off-by: line (git commit -s; Developer Certificate of Origin 1.1).
  • New source files carry the SPDX licence line for MIT, or are covered in REUSE.toml. (No new files.)
  • No files of the original upscaler (see CONTRIBUTING.md), no model data, game files, captures, screenshots or binaries; no paths, user or machine names of my PC.
  • Any new third-party component is under a permitted licence and listed in THIRD-PARTY-NOTICES and REUSE.toml. (None.)
  • Numbers in documents come with their measurement record. (None added.)
  • Kernel or runtime changes: the runtime's adapter identity (no kernel change). It is covered by the tests above; CI builds the runtime.

…driver's id query is not implemented

Wine and Proton answer the driver's PCI id query (D3DKMTQueryAdapterInfo type 31) with
STATUS_NOT_IMPLEMENTED, so #225's RDNA 4 check refused every board there.

- Only when the query returns exactly STATUS_NOT_IMPLEMENTED and the process runs under Wine
  (ntdll exports wine_get_version), the system DXGI's vendor and device id of the adapter with
  the game device's LUID stand in, against the same vendor and RDNA 4 id list.
- Any other status, a query that could not be made, the same status outside Wine, or DXGI not
  answering: refused as before. When the driver's ids are read, they alone decide.
- One log line when the fallback accepts an adapter (the executor choice and the Ray
  Reconstruction runtime).
- Tests with injected query results, including that the Windows path never asks the fallback's
  sources; the test's MSVC build uses /permissive-.

Fixes #248

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
@phantoslayer21 phantoslayer21 added this to the 0.6.5 milestone Nov 16, 2026
@phantoslayer21 phantoslayer21 added area: runtime Model M runtime and kernels area: linux Linux, Wine and Proton area: ray-reconstruction Ray Reconstruction runtime, plugin and kernels labels Nov 16, 2026
@phantoslayer21
phantoslayer21 marked this pull request as ready for review November 16, 2026 00:41
@phantoslayer21
phantoslayer21 merged commit 91436c4 into main Nov 16, 2026
10 checks passed
@phantoslayer21
phantoslayer21 deleted the fix/wine-adapter-fallback-248 branch November 16, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: linux Linux, Wine and Proton area: ray-reconstruction Ray Reconstruction runtime, plugin and kernels area: runtime Model M runtime and kernels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Under Proton the driver id query of #225 is not implemented, so an RX 9070 XT would be treated as "not RDNA 4"

1 participant