DLSS Enabler static-embedding compatibility #1035

Open
artur-graniszewski wants to merge 1 commit from artur-graniszewski/feature/dlss-enabler-compat into release/0.9
artur-graniszewski commented 2026-06-16 19:38:41 +00:00 (Migrated from github.com)

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.
## 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.
darkxex commented 2026-07-29 20:09:13 +00:00 (Migrated from github.com)

this is pretty cool. A compact dll.

this is pretty cool. A compact dll.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin artur-graniszewski/feature/dlss-enabler-compat:artur-graniszewski/feature/dlss-enabler-compat
git switch artur-graniszewski/feature/dlss-enabler-compat

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch release/0.9
git merge --no-ff artur-graniszewski/feature/dlss-enabler-compat
git switch artur-graniszewski/feature/dlss-enabler-compat
git rebase release/0.9
git switch release/0.9
git merge --ff-only artur-graniszewski/feature/dlss-enabler-compat
git switch artur-graniszewski/feature/dlss-enabler-compat
git rebase release/0.9
git switch release/0.9
git merge --no-ff artur-graniszewski/feature/dlss-enabler-compat
git switch release/0.9
git merge --squash artur-graniszewski/feature/dlss-enabler-compat
git switch release/0.9
git merge --ff-only artur-graniszewski/feature/dlss-enabler-compat
git switch release/0.9
git merge artur-graniszewski/feature/dlss-enabler-compat
git push origin release/0.9
Sign in to join this conversation.
No description provided.