fix(encode/windows): resolve NVENC at runtime — AMD/Intel hosts no longer crash at start

The nvenc build linked nvEncodeAPI64.dll's entry points at load time, so a
--features nvenc binary hard-crashed on any box without the NVIDIA driver
(AMD/Intel). Entry points now come from a runtime LoadLibrary table
(encode/windows/nvenc.rs load_api); a missing DLL just falls through the
encoder auto-detect to AMF/QSV/software. The generated import lib and all its
plumbing (gen-nvenc-importlib.ps1, nvenc.def, PUNKTFUNK_NVENC_LIB_DIR,
setup-build-env wiring) are gone.

Live-validated on the RTX 4090 box (NVENC session, 7000+ frames).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 12:09:18 +00:00
parent 95a08e99c3
commit 01fcb01019
9 changed files with 259 additions and 150 deletions
+2 -2
View File
@@ -12,9 +12,9 @@ $admin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdenti
).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
if (-not $admin) { throw "Run elevated (Machine-scope env requires Administrator)." }
# NVENC import lib (nvencodeapi.lib); libclang for bindgen; cmake policy floor for audiopus_sys.
# libclang for bindgen; cmake policy floor for audiopus_sys. (NVENC needs no build-time env:
# its entry points are runtime-loaded from the driver's nvEncodeAPI64.dll.)
$vars = [ordered]@{
'PUNKTFUNK_NVENC_LIB_DIR' = 'C:\Users\Public\nvenc'
'LIBCLANG_PATH' = 'C:\Program Files\LLVM\bin'
'CMAKE_POLICY_VERSION_MINIMUM' = '3.5'
# FFMPEG_DIR is only needed for the `amf-qsv` feature (libavcodec). The RTX box builds