From fcf6abc7c6719cbdec9a2da96e1c968e3af04cd3 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sun, 6 Jun 2021 06:14:24 +1000 Subject: [PATCH] [host] NvFBC/DXGI: make DXGI the default instead of the fallback It has been detemined that a failure to init NvFBC causes a 20-30% performance penalty on non NvFBC supported hardware (GeForce) when using DXGI, as such reverse the order and default to using DXGI as our first option. If NvFBC is still desired, pr #500 added the option `app:capture` which can be used to force NvFBC. --- host/platform/Windows/capture/CMakeLists.txt | 8 ++++---- host/platform/Windows/capture/NVFBC/src/nvfbc.c | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/host/platform/Windows/capture/CMakeLists.txt b/host/platform/Windows/capture/CMakeLists.txt index 9c09a638..9ee7cb73 100644 --- a/host/platform/Windows/capture/CMakeLists.txt +++ b/host/platform/Windows/capture/CMakeLists.txt @@ -17,14 +17,14 @@ if(NOT EXISTS "${nvfbc_sdk}/inc" OR NOT IS_DIRECTORY "${nvfbc_sdk}/inc") set(USE_NVFBC OFF) endif() -if(USE_NVFBC) - add_capture("NVFBC") -endif() - if(USE_DXGI) add_capture("DXGI") endif() +if(USE_NVFBC) + add_capture("NVFBC") +endif() + include("PostCapture") add_library(capture STATIC ${CAPTURE_C}) diff --git a/host/platform/Windows/capture/NVFBC/src/nvfbc.c b/host/platform/Windows/capture/NVFBC/src/nvfbc.c index b287afd6..3883a868 100644 --- a/host/platform/Windows/capture/NVFBC/src/nvfbc.c +++ b/host/platform/Windows/capture/NVFBC/src/nvfbc.c @@ -165,6 +165,10 @@ static bool nvfbc_init(void) free(buffer); } + // NOTE: Calling this on hardware that doesn't support NvFBC such as GeForce + // causes a substantial performance pentalty even if it fails! As such we only + // attempt NvFBC as a last resort, or if configured via the app:capture + // option. if (!NvFBCToSysCreate(privData, privDataLen, &this->nvfbc, &this->maxWidth, &this->maxHeight)) { free(privData);