Skip to content

DLSS Enabler static-embedding compatibility #1035

Open
artur-graniszewski wants to merge 1 commit into
optiscaler:release/0.9from
artur-graniszewski:feature/dlss-enabler-compat
Open

DLSS Enabler static-embedding compatibility #1035
artur-graniszewski wants to merge 1 commit into
optiscaler:release/0.9from
artur-graniszewski:feature/dlss-enabler-compat

Conversation

@artur-graniszewski

Copy link
Copy Markdown

Summary

Adds the ability to build OptiScaler as a static library and embed it into a
host DLL (e.g. DLSS Enabler), alongside the existing standalone DLL build.
All new behavior is gated behind the OPTISCALER_STATIC macro and a dedicated
build configuration, so the default DLL build path is completely unaffected.

Changes

  • New ReleaseStatic build configuration. Builds OptiScaler as a static .lib
    with the static CRT (/MT) and defines OPTISCALER_STATIC. Because the CRT is
    linked statically, any static dependencies it pulls in (e.g. the FSR3 /
    FidelityFX SDK) must be compiled in the same /MT mode — mixing /MT and /MD
    within one module causes CRT symbol conflicts.
  • DllMain demotion (static build only). Under OPTISCALER_STATIC, DllMain
    is renamed to org_dllMain via a forced-include macro. It stops being the module
    entry point and becomes a regular function the host can call. In standard DLL
    builds the macro is not defined, so DllMain remains the entry point as before.
  • Public embedding API. OptiScaler_Init(HMODULE self, const OptiScalerConfig* cfg)
    and OptiScaler_Shutdown() forward to the original DllMain logic with
    DLL_PROCESS_ATTACH / DLL_PROCESS_DETACH, preserving the existing init and
    cleanup paths. The host passes its own module handle for module-relative lookups.
  • OptiScalerConfig struct for future use.
  • Duplicate-symbol fixes that surfaced when linking statically alongside the
    host's own version-check code.

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.

1 participant