Skip to content

Report failed vendor upscaler calls - #324

Merged
dzhdanNV merged 4 commits into
NVIDIA-RTX:mainfrom
Nullpoint56:upscaler-report-vendor-failures
Nov 12, 2026
Merged

dzhdanNV merged 4 commits into
NVIDIA-RTX:mainfrom
Nullpoint56:upscaler-report-vendor-failures

Conversation

@Nullpoint56

Copy link
Copy Markdown
Contributor

Failed vendor calls in UpscalerInterface.hpp are silent:

  • Creation: a missing or incomplete FSR loader (:1083), a failed ffxCreateContext, XeSS call, or NGX initialization or feature creation returns FAILURE with no message. Only MetalFX reports one (:1883).
  • Dispatch: a failed ffxDispatch (:1657), xessSetExposureMultiplier, xessD3D12Execute (:1686) or NGX evaluation (:1757, :1862) is an NRI_CHECK, gone in release builds, so the upscale silently doesn't happen.

This reports each through NRI_REPORT_ERROR, naming the call and its result (and the library for FSR), in release builds too. Success paths are unchanged.

Measured on v191, RTX 4070 SUPER, vendor DLLs removed: FSR and DLSS super resolution go from a silent FAILURE to 'amd_fidelityfx_loader_dx12.dll' can't be loaded and NGX feature creation failed, result = 0xBAD0000B.

Failed vendor calls were silent: creation returned "FAILURE" with no message (a missing or
incomplete FSR loader, "ffxCreateContext", the XeSS calls, NGX initialization and feature
creation), and a failed dispatch ("ffxDispatch", "xessSetExposureMultiplier", "xessD3D12Execute",
NGX evaluation) was an "NRI_CHECK", compiled out of release builds. Each now reports through
"NRI_REPORT_ERROR", naming the call and its result, in release builds too.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T16:17:07.413505Z 5e12091 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dzhdanNV

dzhdanNV commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

Thanks. The intent is good, but reporting errors also invokes AbortExecution. Its default implementation breaks/traps, including in Release, which prevents callers from handling recoverable failures.

How should we handle this?

  • keep the current behavior? If we agree, it's acceptable, IMO
  • report warnings instead?
  • report errors without invoking AbortExecution?
  • another approach?

@Nullpoint56

Copy link
Copy Markdown
Contributor Author

Thanks. The intent is good, but reporting errors also invokes AbortExecution. Its default implementation breaks/traps, including in Release, which prevents callers from handling recoverable failures.

How should we handle this?

  • keep the current behavior? If we agree, it's acceptable, IMO
  • report warnings instead?
  • report errors without invoking AbortExecution?
  • another approach?

Agreed, aborting is wrong here: a failed vendor call is the vendor's answer, not a misuse of NRI.

Suggestion, using what Result already encodes:

  • Creation: report with Result::INVALID_SDK and return it ("unable to load, version or SDK mismatch", no AbortExecution). Callers can then tell a missing/unusable runtime from a bug and fall back.
  • Dispatch: keep the NRI_CHECK, plus an ERROR without AbortExecution in release, since the caller can't react to a void call and today it fails silently.

If this solution is accepted, I'll push a commit to this PR to fix it.

@dzhdanNV

Copy link
Copy Markdown
Collaborator

Sounds good. Hmm, what about adding Result::EXT_ERROR = -5? Various user-actionable errors coming from 3rd parties may generate this error code.

@Nullpoint56

Copy link
Copy Markdown
Contributor Author

That works for me, it's clean and unambiguous like that for the caller too. I'll make a commit here to add that and the abort fix today after work if everything else checks out.

@dzhdanNV

Copy link
Copy Markdown
Collaborator

Perfect. Please, don't forget to apply this logic everywhere. I have just updated D3D12MA in NRI. So, after merging this one, I will create v192 release and mention C# bindings in the README.

A failed vendor call is the vendor's answer, not a misuse of NRI, but it was reported with
"Result::FAILURE", which calls "AbortExecution" (by default a break or a trap, in release builds
too). New "Result::EXT_ERROR" (-5) is reported without it:
- upscalers: creation reports and returns it for every failed FFX, XeSS and NGX call ("FfxConvertError"
  and "XessConvertError" are gone, they mapped vendor codes to aborting results); a failed dispatch and
  MetalFX scaler creation report it
- NVAPI: "NRI_REPORT_ERROR_ON_BAD_NVAPI_STATUS" reports it; the Reflex calls report and return it
  instead of a bare "FAILURE"; a D3D11 shading rate view reports and returns it (it was an
  "INVALID_ARGUMENT" from "ID3D11Device::CreateXxxView")
- AGS: device creation reports and returns it; D3D11 NVAPI and AGS commands report it
  ("NRI_RETURN_ON_EXT_FAILURE")
- a failed "NvAPI_Initialize" or "agsInitialize" is a warning: the device is created without the
  extension, as with a missing AGS library. So is a refused "NvAPI_D3D12_EnableRaytracingValidation",
  which was silent
@Nullpoint56

Copy link
Copy Markdown
Contributor Author

Pushed 5e12091.

As discussed: added Result::EXT_ERROR = -5. Upscaler creation now returns it for failed FFX, XeSS and NGX calls, and a failed dispatch reports it, without AbortExecution.

Extended to the other places where a 3rd party failure aborted or was silent:

  • MetalFX scaler creation: the same vendor failure, in the same file
  • NRI_REPORT_ERROR_ON_BAD_NVAPI_STATUS: reported FAILURE, so it aborted
  • Reflex calls: returned a bare FAILURE without a message
  • D3D11 shading rate view: a failed NVAPI call surfaced as an aborting INVALID_ARGUMENT from "CreateXxxView"
  • AGS device creation and the D3D11 NVAPI / AGS commands: reported FAILURE, so they aborted (new NRI_RETURN_ON_EXT_FAILURE)

Points that could go either way, are they OK like this?

  • FfxConvertError / XessConvertError are removed, so every vendor failure is EXT_ERROR and the vendor's code goes in the message, instead of being mapped to INVALID_ARGUMENT / UNSUPPORTED / OUT_OF_MEMORY
  • a failed NvAPI_Initialize / agsInitialize, and a refused NvAPI_D3D12_EnableRaytracingValidation (silent before), are warnings: the device is still created without the extension, as with a missing AGS library
  • NRI_REPORT_ERROR_ON_BAD_NVAPI_STATUS also covers the feature probes at device creation, where the device is created anyway
  • unrelated, just noticed: XeSS warnings are positive codes (XESS_RESULT_WARNING_OLD_DRIVER, ...), so the != XESS_RESULT_SUCCESS checks treat them as failures

dzhdanNV commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Updated this PR so applications can fall back after optional SDK failures while retaining normal handling of rendering errors:

  • Preserve specific INVALID_ARGUMENT, UNSUPPORTED, and OUT_OF_MEMORY results; use EXT_ERROR for other SDK failures and report recoverable errors without AbortExecution.
  • Keep NVAPI/AGS rendering errors unchanged; optional initialization and diagnostic failures warn and continue.
  • Fix XeSS warning handling, failed-context cleanup, exposure-error handling, and network selection before pipeline creation/init.
  • Report MetalFX compiler diagnostics and clarify the AbortExecution comment.

@dzhdanNV

Copy link
Copy Markdown
Collaborator

Probably, there will be another cleanup in the future but this is outside of this PR.

So, EXT_ERROR is reported for:

  • Upscaler creation: FSR library/entry-point/context failures, XeSS setup failures, NGX initialization/feature creation, and MetalFX compiler creation
  • Upscaling: failed FSR/XeSS/DLSS dispatch or MetalFX scaler creation
  • XeSS cleanup: failed context destruction
  • Reflex: failed sleep-mode setup, latency markers, sleep, or latency-report queries

@dzhdanNV
dzhdanNV merged commit afc5276 into NVIDIA-RTX:main Nov 12, 2026
@dzhdanNV

Copy link
Copy Markdown
Collaborator

Thanks for the help! Merged.

@dzhdanNV

Copy link
Copy Markdown
Collaborator

My intention is - report a meaningful result if there is a clear misuse (it may be a warning or worse), report EXT_ERROR if a 3rd party fails in a non-documented way.

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