Skip to content

DXGI adapter identity, and NVAPI's ray tracing entry points - #346

Merged
dttdrv merged 2 commits into
dttdrv:mainfrom
aaf2tbz:split/adapter-nvapi
Nov 26, 2026
Merged

dttdrv merged 2 commits into
dttdrv:mainfrom
aaf2tbz:split/adapter-nvapi

Conversation

@aaf2tbz

@aaf2tbz aaf2tbz commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

The adapter's identity, and NVAPI's ray tracing entry points. Split out of #341, with the same commits.

What changes

  • dxgi: an adapter has a device of its vendor's, and a configurable subsystem and revision. This changes a default: with no device configured, AMD (the default vendor) reports 744c, NVIDIA 2704 and Intel 56a0, instead of 0000. dxgi.customSubSysId and dxgi.customRevision are new. dxgi_adapter_identity: 8 of 10 configurations wrong before.
  • nvapi: NVIDIA's ray tracing caps and extended acceleration structure builds are answered.
    • NvAPI_D3D12_GetRaytracingCaps reports nothing beyond D3D12's.
    • NvAPI_D3D12_BuildRaytracingAccelerationStructureEx and ..._GetRaytracingAccelerationStructurePrebuildInfoEx forward plain builds to D3D12's, and refuse micromaps, spheres and their flags with NVAPI_NOT_SUPPORTED.
    • nvapi_raytracing is new; before, the entry points were missing.

Evidence

Mac mini, Apple M6, macOS 27.3. MetalSharp Wine 8.0 (arm64 with FEX), copied with --clone. ARM64EC build with -Denable_nvngx=true -Denable_nvapi=true -Denable_tests=true.

Not run

  • nvapi_raytracing fails under --validate on every family where ray queries do on main (Metal's "Invalid load in 'device' or 'constant' address space"). It passes without validation.
  • win32: src/nvapi/nvapi.cpp does not build on main (an EnumDisplayMonitors lambda). x86_64 was not built.

…system and revision

An adapter reported device ID 0 unless dxgi.customDeviceId named one, whatever its vendor:
AMD's by default, NVIDIA's with NVEXT or dxgi.customVendorId. Applications look the vendor
and device up in tables of PC GPUs, where 0 is in none, and MetalSharp's DLSS setup
(src/nvngx/signing/README.md) has to name NVIDIA's RTX 4080, 2704, for a device at all.

The device is now one of the vendor's where the configuration names none: NVIDIA's RTX 4080
(10de:2704), and the other vendors' of its class, AMD's RX 7900 XTX (1002:744c) and Intel's
Arc A770 (8086:56a0); Apple's vendor, which has no PCI devices, keeps 0.
dxgi.customSubSysId (up to eight hex digits) and dxgi.customRevision (up to two) set the
subsystem and revision, which stay 0 without them or when they are not such a number. The
options reach the environment through MULLION_CONFIG, as every option does. mullion.conf
documents both and the defaults.

dxgi_adapter_identity checks GetDesc, GetDesc1 and GetDesc3 in a process for each of ten
configurations: the defaults, NVEXT, each vendor, a named device, a subsystem, revision and
name, and values that are not numbers of their digits. Without the change it fails eight
of the ten cases (device 0 for AMD, NVIDIA and Intel, subsystem and revision 0); with it
it passes as every family under validation, three times each.
…builds are answered

NvAPI_D3D12_GetRaytracingCaps, NvAPI_D3D12_GetRaytracingAccelerationStructurePrebuildInfoEx
and NvAPI_D3D12_BuildRaytracingAccelerationStructureEx were not there, and QueryInterface
gave no function for them. Engines that use NVIDIA's ray tracing extensions query the caps
before they choose a build path, and build through the Ex functions with NVAPI's geometry
descriptions.

The caps of every type are its CAP_NONE: no NVIDIA shader extension is lowered, so thread
reordering is the no-op the header gives that value, and there are no opacity or
displacement micromaps, cluster operations, partitioned top-level structures, spheres or
linear swept spheres. A size other than the caps' is INVALID_ARGUMENT, an unknown type too,
and a null pointer INVALID_POINTER (nvapi.h).

The Ex prebuild information and build are "an extension of" ID3D12Device5's and
ID3D12GraphicsCommandList4's: triangle and box geometries, in an array a stride apart or by
pointer, and top-level structures are converted to Direct3D's inputs, whose build flags
have the same values, and go to the device's and list's own calls, post-build information
included. A geometry of micromaps, spheres or linear swept spheres and the build flags of
micromaps and data access are NOT_SUPPORTED, as the caps say none of them is there; a count
of post-build descriptions without them is INVALID_COMBINATION and another structure
version INCOMPATIBLE_STRUCT_VERSION. Instances keep their flags, of which Metal's instances
take the four Direct3D defines.

nvapi_raytracing builds the ray tracing tests' scene (d3d12_rays.hpp) through NVAPI and
traces it with ray queries against the CPU caster, compares the prebuild sizes and the
compacted size with Direct3D's, and checks the caps and the refusals. Without the change it
fails with no function for the three; with it it passes as every family, three times each.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants