| 255 | #define CR_SL( res ) ReportSlError( res, __FILE__, __LINE__, #res ) |
| 256 | |
| 257 | sl::Result InitializeStreamline( uint32_t appID ) |
| 258 | { |
| 259 | if( STREAMLINE_INITIALIZED ) |
| 260 | { |
| 261 | CCP_LOGERR( "Streamline already initialized with result code %d", STREAMLINE_INITIALIZATION_RESULT ); |
| 262 | |
| 263 | return STREAMLINE_INITIALIZATION_RESULT; |
| 264 | } |
| 265 | |
| 266 | |
| 267 | // load the DLL |
| 268 | { |
| 269 | wchar_t abs_path[4096]; |
| 270 | auto size = SearchPathW( nullptr, L"sl.interposer.dll", L"", 4096, abs_path, nullptr ); |
| 271 | if( size == 0 ) |
| 272 | { |
| 273 | CCP_LOGERR( "Unable to find sl.interposer.dll in path for secure load." ); |
| 274 | |
| 275 | return sl::Result::eErrorIO; //Most fitting error... |
| 276 | } |
| 277 | else if( g_upscalingDebug ) |
| 278 | { |
| 279 | STREAMLINE_MODULE = LoadLibraryW( abs_path ); |
| 280 | } |
| 281 | else if( sl::security::verifyEmbeddedSignature( abs_path ) ) |
| 282 | { |
| 283 | STREAMLINE_MODULE = LoadLibraryW( abs_path ); |
| 284 | } |
| 285 | # |
| 286 | CCP_LOGNOTICE( "NVidia Streamline library loaded" ); |
| 287 | } |
| 288 | |
| 289 | // initialize function pointers |
| 290 | { |
| 291 | INITIALIZE_FUNCTION( slInit ); |
| 292 | INITIALIZE_FUNCTION( slShutdown ); |
| 293 | INITIALIZE_FUNCTION( slFreeResources ); |
| 294 | |
| 295 | INITIALIZE_FUNCTION( slSetD3DDevice ); |
| 296 | INITIALIZE_FUNCTION( slUpgradeInterface ); |
| 297 | |
| 298 | INITIALIZE_FUNCTION( slIsFeatureSupported ); |
| 299 | INITIALIZE_FUNCTION( slSetFeatureLoaded ); |
| 300 | INITIALIZE_FUNCTION( slGetFeatureFunction ); |
| 301 | |
| 302 | INITIALIZE_FUNCTION( slGetNewFrameToken ); |
| 303 | |
| 304 | INITIALIZE_FUNCTION( slSetTagForFrame ); |
| 305 | INITIALIZE_FUNCTION( slSetConstants ); |
| 306 | INITIALIZE_FUNCTION( slEvaluateFeature ); |
| 307 | } |
| 308 | |
| 309 | if( !FUNCTIONS.m_slInit || !FUNCTIONS.m_slShutdown || !FUNCTIONS.m_slIsFeatureSupported ) |
| 310 | { |
| 311 | CCP_LOGERR( "Library sl.interposer.dll is missing critical functions slInit, slShutdown, slIsFeatureSupported making streamline unusable. Updating nVidia driver version may halp." ); |
| 312 | ReleaseStreamline(); |
| 313 | return sl::Result::eErrorDriverOutOfDate; |
| 314 | } |
no test coverage detected