Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ jobs:
run: |
$PSNativeCommandUseErrorActionPreference = $true
cmake -S clean/installer -B out/launcher-tests -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DWRONGGPU_PAYLOAD_DIR="$PWD/out/no-payload" -DWRONGGPU_TESTING=OFF -DWRONGGPU_PRESET_K=OFF -DWRONGGPU_DIRECT_ROUTE=OFF
cmake --build out/launcher-tests --target wg-core-tests launcher-core-tests coexist-core-tests convert-ignore-tests model-choice-tests
ctest --test-dir out/launcher-tests --output-on-failure -R "^(wg-core|launcher-core|coexist-core|convert-ignore|model-choice|source-size|wording)$"
cmake --build out/launcher-tests --target wg-core-tests launcher-core-tests coexist-core-tests convert-ignore-tests model-choice-tests model-choice-k-tests model-choice-k-only-tests
ctest --test-dir out/launcher-tests --output-on-failure -R "^(wg-core|launcher-core|coexist-core|convert-ignore|model-choice|model-choice-k|model-choice-k-only|source-size|wording)$"

rr-plugin:
name: "CPU: Ray Reconstruction plugin"
Expand Down
26 changes: 26 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,29 @@ These load a Direct3D 12 or HIP device: the front end's D3D12 tests (`ctest --te
without `--no-tests`), `clean\runtime\interop\tests` (the D3D12 interop harness), `clean\dx12\tests`, the Ray
Reconstruction end-to-end test (`clean\rr_f\runtime\tests\e2e.py`), the timing tools, and the GPU test modules listed
in 6. Run them on an RX 9000-series card; `WG_GPU_LOCK` can serialise them when several shells share one GPU.

## 8. A build with Model K (development; not part of any release)

Model K is off in every build that players get: the release commands above pass `--no-model-k`, `-DWG_MODEL_K=OFF` and
`-DWRONGGPU_PRESET_K=OFF`, and CI builds them the same way. To build all three parts with Model K, change those lines:

```bat
rem 3.3 runtime: leave out --no-model-k (Model K's code objects and map are then built in)
python clean\runner\build.py --rocm "%ROCM_PATH%" --out out\runtime --extra-archs gfx1200 --with-rr out\rr-rt\obj

rem 4.1 front end: Model K's entry in the hosted list and model=K (the option's default is ON; CI and releases say OFF)
cmake -S clean\fsr -B out\frontend %CMAKE_FLAGS% -DWG_MODEL_K=ON -DWG_BUILD_ID=dev-k -DWG_BUILD_ASI=ON

rem 5.2 launcher: Preset K (Model K's converter map) and the per-game model choice K (set <game> model=K)
cmake -S clean\installer -B out\launcher %CMAKE_FLAGS% -DWRONGGPU_PAYLOAD_DIR=%CD%\out\payload -DWRONGGPU_RR_DIR=%CD%\out\rr ^
-DWRONGGPU_VERSION=0.6.0 -DWRONGGPU_BUILD_ID=dev-k -DWRONGGPU_PAYLOAD_NAME=0.6.0 -DWRONGGPU_TESTING=OFF ^
-DWRONGGPU_PRESET_K=ON -DWRONGGPU_MODEL_K=ON -DWRONGGPU_DIRECT_ROUTE=OFF
```

`-DWRONGGPU_MODEL_K=ON` needs `-DWRONGGPU_PRESET_K=ON` (configuring without it stops with an error) and the front end and
runtime of the same build. Model K runs its exact network: nothing in these builds, the launcher or the front end offers or
sets another mode of it. The CPU tests of section 6 cover the K-less builds; the front end's build also tests the other
state of Model K (`fsr_frontend_model_k_unit` in a build with `-DWG_MODEL_K=OFF`, `fsr_frontend_no_model_k_unit` in one with
it ON), and the launcher's `model-choice-k` and `model-choice-k-only` tests run the K choice whatever the build's option is.
`clean\installer\tests\run_model_k_tests.py` (its header says how to prepare the payload, the test maps and a launcher with
the choices on) runs the choice end to end on generated fixtures, with no game and no GPU.
46 changes: 39 additions & 7 deletions clean/fsr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@ option(WG_SPLIT_PROGRESS_QA "Private read-only split fence diagnostics; no produ
# provider label. OFF (a release that ships Model M only): none of that; the list is "3.1.5 WrongGPU (Model M)" and
# AMD's versions, the Model K id is an unknown override like any other, model=K from wronggpu.ini or
# WG_RUNTIME_OPTIONS is dropped with one log line and Model M runs (src/model_k.h).
# Like Model L's definition below, it is set on wg_fsr_core (and so on everything that links it) and not for the whole
# directory, so that the tests can also build a front end with the other state: a build with Model K OFF (releases, CI)
# also tests a front end with Model K, a build with it ON also tests one without. The few targets that do not link
# wg_fsr_core get the definition from the loop at the end of this file.
option(WG_MODEL_K "Offer Model K (hosted list entry, model=K); OFF = Model M only" ON)
if(WG_MODEL_K)
add_compile_definitions(WRONGGPU_MODEL_K=1)
set(WG_MODEL_K_VALUE 1)
set(WG_OTHER_K_VALUE 0)
else()
add_compile_definitions(WRONGGPU_MODEL_K=0)
set(WG_MODEL_K_VALUE 0)
set(WG_OTHER_K_VALUE 1)
endif()
# Model L in the front end (#89; src/model_l.h): its entry "WrongGPU Model L" in the hosted version list, its id,
# sr_model=L / model=L passed to the runtime (which needs WG_MODEL_L too), the model lookup's <place>\L\model.wgcm, its
Expand All @@ -52,7 +58,7 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../wgshared ${CMAKE_BINARY_DIR}/wgs
# folder, spec 65.6): not built unless asked for. Its header-only unit tests still run.
option(WG_BUILD_ASI "Build the retired OptiScaler menu-patching plugin WrongGPU.asi" OFF)
add_executable(test_provider_label tests/test_provider_label.cpp)
target_compile_definitions(test_provider_label PRIVATE WRONGGPU_MODEL_L=${WG_MODEL_L_VALUE})
target_compile_definitions(test_provider_label PRIVATE WRONGGPU_MODEL_L=${WG_MODEL_L_VALUE} WRONGGPU_MODEL_K=${WG_MODEL_K_VALUE})
if(MSVC)
set_property(TARGET test_provider_label PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
Expand All @@ -69,12 +75,12 @@ set(WG_FSR_CORE_SOURCES
src/fsr30_hook.cpp
src/fsr30_map.cpp
src/param_map.cpp)
function(wg_fsr_core_library name model_l)
function(wg_fsr_core_library name model_l model_k)
add_library(${name} STATIC ${WG_FSR_CORE_SOURCES})
target_include_directories(${name} SYSTEM PUBLIC ${FFX_SDK_DIR})
target_include_directories(${name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(${name} PUBLIC wg_shared_headers)
target_compile_definitions(${name} PUBLIC WRONGGPU_MODEL_L=${model_l})
target_compile_definitions(${name} PUBLIC WRONGGPU_MODEL_L=${model_l} WRONGGPU_MODEL_K=${model_k})
set_target_properties(${name} PROPERTIES POSITION_INDEPENDENT_CODE ON)
if(MSVC)
target_compile_options(${name} PRIVATE /Zi)
Expand All @@ -88,7 +94,7 @@ function(wg_fsr_core_library name model_l)
target_compile_definitions(${name} PUBLIC WIDL_EXPLICIT_AGGREGATE_RETURNS)
endif()
endfunction()
wg_fsr_core_library(wg_fsr_core ${WG_MODEL_L_VALUE})
wg_fsr_core_library(wg_fsr_core ${WG_MODEL_L_VALUE} ${WG_MODEL_K_VALUE})

# Host unit tests (any platform).
add_executable(test_amd_provider tests/test_amd_provider.cpp)
Expand All @@ -102,11 +108,26 @@ target_link_libraries(test_fsr30 PRIVATE wg_fsr_core)
add_test(NAME fsr30_hook_unit COMMAND test_fsr30)
# A build without Model L (the default) also tests a front end with it: the same tests, Model L built in.
if(NOT WG_MODEL_L)
wg_fsr_core_library(wg_fsr_core_model_l 1)
wg_fsr_core_library(wg_fsr_core_model_l 1 ${WG_MODEL_K_VALUE})
add_executable(test_frontend_model_l tests/test_frontend.cpp)
target_link_libraries(test_frontend_model_l PRIVATE wg_fsr_core_model_l)
add_test(NAME fsr_frontend_model_l_unit COMMAND test_frontend_model_l)
endif()
# The same for Model K (the other state than this build's): a release build (WG_MODEL_K=OFF, also CI) tests a front end
# with Model K built in (its list entry, id and overlay names, model=K), a build with it tests one without (no entry,
# model=K dropped with one log line). The product front end and its DLLs stay as WG_MODEL_K says.
if(WG_MODEL_K)
set(WG_OTHER_K_NAME no_model_k)
else()
set(WG_OTHER_K_NAME model_k)
endif()
wg_fsr_core_library(wg_fsr_core_${WG_OTHER_K_NAME} ${WG_MODEL_L_VALUE} ${WG_OTHER_K_VALUE})
add_executable(test_frontend_${WG_OTHER_K_NAME} tests/test_frontend.cpp)
target_link_libraries(test_frontend_${WG_OTHER_K_NAME} PRIVATE wg_fsr_core_${WG_OTHER_K_NAME})
add_test(NAME fsr_frontend_${WG_OTHER_K_NAME}_unit COMMAND test_frontend_${WG_OTHER_K_NAME})
add_executable(test_fsr30_${WG_OTHER_K_NAME} tests/test_fsr30.cpp)
target_link_libraries(test_fsr30_${WG_OTHER_K_NAME} PRIVATE wg_fsr_core_${WG_OTHER_K_NAME})
add_test(NAME fsr30_hook_${WG_OTHER_K_NAME}_unit COMMAND test_fsr30_${WG_OTHER_K_NAME})

# WrongGPU OptiScaler ASI plugin: thunk logic (any OS) and the offline anchor scan of an OptiScaler binary
# (any OS; skips when WRONGGPU_OPTISCALER_BIN is not set). Header-only resolver/thunk, no extra libraries.
Expand All @@ -133,12 +154,16 @@ if(WIN32)
if(TARGET test_frontend_model_l)
set_property(TARGET wg_fsr_core_model_l test_frontend_model_l PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
set_property(TARGET wg_fsr_core_${WG_OTHER_K_NAME} test_frontend_${WG_OTHER_K_NAME} test_fsr30_${WG_OTHER_K_NAME}
PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
if(MINGW)
target_link_options(test_frontend PRIVATE ${WG_STATIC_RUNTIME})
if(TARGET test_frontend_model_l)
target_link_options(test_frontend_model_l PRIVATE ${WG_STATIC_RUNTIME})
endif()
target_link_options(test_frontend_${WG_OTHER_K_NAME} PRIVATE ${WG_STATIC_RUNTIME})
target_link_options(test_fsr30_${WG_OTHER_K_NAME} PRIVATE ${WG_STATIC_RUNTIME})
target_link_options(test_fsr30 PRIVATE ${WG_STATIC_RUNTIME})
target_link_options(test_asi_thunk PRIVATE ${WG_STATIC_RUNTIME})
target_link_options(test_asi_scan PRIVATE ${WG_STATIC_RUNTIME})
Expand Down Expand Up @@ -425,3 +450,10 @@ if(WIN32)
endforeach()
endif()
endif()

# Targets that do not link wg_fsr_core but read Model K's state (the ASI plugin's header and its tests): the build's value.
foreach(wg_k_target test_asi_thunk test_asi_status wronggpu_asi)
if(TARGET ${wg_k_target})
target_compile_definitions(${wg_k_target} PRIVATE WRONGGPU_MODEL_K=${WG_MODEL_K_VALUE})
endif()
endforeach()
32 changes: 28 additions & 4 deletions clean/installer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ if(WRONGGPU_MODEL_L)
else()
set(MODEL_L_DEFINITION WRONGGPU_MODEL_L=0)
endif()
# The Model K choice in the launcher (src/wizard_policy.h): a development build for a front end with WG_MODEL_K and a runtime
# with Model K, never for a release that players get (K is off by default). `model` becomes a setting with the value k
# (m|k, m|k|l with WRONGGPU_MODEL_L) and `set <game> model=K` writes wronggpu.ini's model=K and OptiScaler's UpscalerIndex.
# It needs Preset K's converter map and model folder (WRONGGPU_PRESET_K).
option(WRONGGPU_MODEL_K "The Model K choice in the launcher (model=K, the OptiScaler entry; needs WRONGGPU_PRESET_K); OFF = no Model K choice" OFF)
if(WRONGGPU_MODEL_K)
if(NOT WRONGGPU_PRESET_K)
message(FATAL_ERROR "WRONGGPU_MODEL_K needs WRONGGPU_PRESET_K=ON (Model K's converter map and model folder).")
endif()
set(MODEL_K_DEFINITION WRONGGPU_MODEL_K=1)
else()
set(MODEL_K_DEFINITION WRONGGPU_MODEL_K=0)
endif()
option(WRONGGPU_DIRECT_ROUTE "The direct FSR route in the installer (the wizard's advanced choice, /DIRECTFSR, a silent install without /OPTISCALER=); OFF = OptiScaler is required" ON)
if(WRONGGPU_DIRECT_ROUTE)
set(DIRECT_ROUTE_PAYLOAD_ARGS)
Expand Down Expand Up @@ -133,7 +146,7 @@ add_library(wg_core STATIC
target_include_directories(wg_core PUBLIC src)
target_compile_definitions(wg_core PUBLIC ${PRESET_K_DEFINITION} ${DIRECT_ROUTE_DEFINITION})
# (private: model-choice-tests compiles profile.cpp with the Model L choice on, against this library)
target_compile_definitions(wg_core PRIVATE ${MODEL_L_DEFINITION})
target_compile_definitions(wg_core PRIVATE ${MODEL_L_DEFINITION} ${MODEL_K_DEFINITION})
if(WRONGGPU_TESTING)
target_compile_definitions(wg_core PUBLIC WRONGGPU_TESTING)
endif()
Expand Down Expand Up @@ -199,7 +212,7 @@ add_executable(WrongGPU WIN32 src/app/main.cpp src/app/wizard.cpp src/app/cli.cp
add_dependencies(WrongGPU WrongGPU-Restore)
if(WRONGGPU_TESTING)
add_executable(wizard-policy-tests tests/wizard_policy_tests.cpp)
target_compile_definitions(wizard-policy-tests PRIVATE ${PRESET_K_DEFINITION} ${DIRECT_ROUTE_DEFINITION} ${MODEL_L_DEFINITION})
target_compile_definitions(wizard-policy-tests PRIVATE ${PRESET_K_DEFINITION} ${DIRECT_ROUTE_DEFINITION} ${MODEL_L_DEFINITION} ${MODEL_K_DEFINITION})
endif()
# wg_core's unit tests (strings and paths, install record, wronggpu.ini keys, the log file; no game, payload or GPU).
add_executable(wg-core-tests tests/wg_core_tests.cpp)
Expand All @@ -208,7 +221,7 @@ target_link_libraries(wg-core-tests PRIVATE wg_core)
# job files, the update reply, the game environment; no game, payload or GPU).
add_executable(launcher-core-tests tests/launcher_core_tests.cpp)
target_link_libraries(launcher-core-tests PRIVATE wg_core)
target_compile_definitions(launcher-core-tests PRIVATE ${MODEL_L_DEFINITION})
target_compile_definitions(launcher-core-tests PRIVATE ${MODEL_L_DEFINITION} ${MODEL_K_DEFINITION})
# The coexistence tests (M2): fingerprints on synthetic bytes, the proxy picker, byte-exact OptiScaler.ini edits and the
# inikey journal, the OptiScaler tab's key rules, the record's inikey and coexist lines, the log warnings.
add_executable(coexist-core-tests tests/coexist_tests.cpp)
Expand All @@ -230,15 +243,26 @@ add_test(NAME wg-core COMMAND wg-core-tests)
add_executable(model-choice-tests tests/model_choice_tests.cpp src/wg_core/profile.cpp)
target_compile_definitions(model-choice-tests PRIVATE WRONGGPU_MODEL_L=1)
target_link_libraries(model-choice-tests PRIVATE wg_core)
# The Model K choice (profile.cpp with WRONGGPU_MODEL_K on, whatever this build's switch, so that CI, which keeps Model K off,
# runs it): with the Model L choice too (the setting m|k|l: K, and an L and an M control) and without (m|k). Each has its own
# copy of profile.cpp.
add_executable(model-choice-k-tests tests/model_choice_k_tests.cpp src/wg_core/profile.cpp)
target_compile_definitions(model-choice-k-tests PRIVATE WRONGGPU_MODEL_K=1 WRONGGPU_MODEL_L=1)
target_link_libraries(model-choice-k-tests PRIVATE wg_core)
add_executable(model-choice-k-only-tests tests/model_choice_k_tests.cpp src/wg_core/profile.cpp)
target_compile_definitions(model-choice-k-only-tests PRIVATE WRONGGPU_MODEL_K=1 WRONGGPU_MODEL_L=0)
target_link_libraries(model-choice-k-only-tests PRIVATE wg_core)
add_test(NAME launcher-core COMMAND launcher-core-tests)
add_test(NAME model-choice COMMAND model-choice-tests)
add_test(NAME model-choice-k COMMAND model-choice-k-tests)
add_test(NAME model-choice-k-only COMMAND model-choice-k-only-tests)
add_test(NAME coexist-core COMMAND coexist-core-tests)
add_test(NAME convert-ignore COMMAND convert-ignore-tests)
if(WRONGGPU_TESTING)
add_test(NAME wizard-policy COMMAND wizard-policy-tests)
endif()
target_include_directories(WrongGPU PRIVATE ${GEN})
target_compile_definitions(WrongGPU PRIVATE ${PRESET_K_DEFINITION} ${DIRECT_ROUTE_DEFINITION} ${MODEL_L_DEFINITION})
target_compile_definitions(WrongGPU PRIVATE ${PRESET_K_DEFINITION} ${DIRECT_ROUTE_DEFINITION} ${MODEL_L_DEFINITION} ${MODEL_K_DEFINITION})
target_link_libraries(WrongGPU PRIVATE wg_ui wg_core wgc_core comctl32 shell32 ole32 oleaut32 uuid advapi32 user32 gdi32 gdiplus dwmapi uxtheme d2d1 d3d11 dxgi dwrite windowscodecs uiautomationcore)
if(MSVC)
target_compile_options(WrongGPU PRIVATE /Zi)
Expand Down
24 changes: 24 additions & 0 deletions clean/installer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,30 @@ Tested by `model-choice` (ctest: profile.cpp built with the choice on) and `test
(a build with the choice on: refusal, both files, record hashes, back to M byte for byte, repair without the data,
uninstall), and with it off by `launcher-core` and the same script's build without the choice.

**The Model K choice** (CMake `WRONGGPU_MODEL_K`, default `OFF`; a development build for a front end built with
`WG_MODEL_K=ON` and a runtime with Model K, never part of a release that players get; it needs `WRONGGPU_PRESET_K=ON`,
whose converter map and model folder Model K's data uses, and configuring without it stops with an error). It is the Model
L choice again for one more value: `model` is a setting with the values `m|k` (`m|k|l` together with `WRONGGPU_MODEL_L`),
and with it off `model=K` is not a value (the setting's refusal names the allowed ones). `set <game> model=K`:
- is accepted only while Model K's data on this PC (`model\K\model.wgcm`) passes its check against Model K's converter
data; otherwise "Model K can't be chosen. Model K's data on this PC is not ready (...). Convert it first: WrongGPU.exe
model convert --preset=K ..." (exit 5, nothing changed);
- writes wronggpu.ini's `runtime_options`: every model item out, `model=K` last, and OptiScaler.ini's `UpscalerIndex`: 1,
Model K's entry right after Model M's (`[WrongGPU]` in OptiScaler 10's slot, else `[FSR]`), as the installer's Preset K
start has always written it. With the K choice built in, Model L's entry is 2 in every build (it follows Model K's).
- `set <game> model=M` (the profile says M) puts Model K's item back to `model=M` and an index naming Model K's entry back to
0, as for Model L; the profile has a `model` line only for K and L. The profile is the truth in a build with the K
choice: an install that starts on Preset K (`/PRESET=K`) writes no profile, so the game's profile is imported from its
files (`model=K` becomes `model=k`), but a `profile.ini` saved by a build without the K choice has no model line and
says M, so the next settings apply puts the game's Model K item back to M. A game saved on K whose Model K data is gone
is not refused: its files say Model M with a warning, the profile keeps K.

The network is Model K's exact one: the launcher does not offer, write or document any other mode of Model K (the
runtime's `network` and `k_fast` options stay at their defaults; nothing here sets them). Tested by `model-choice-k` and
`model-choice-k-only` (ctest: profile.cpp built with the K choice, with and without the L choice; they run in CI, which
keeps the product builds K-less) and by `tests/run_model_k_tests.py` (a build with both choices: refusal, both files,
record hashes, an L control, back to M byte for byte, repair without the data, uninstall).

**Ignore lists** (`src/wg_core/convert_ignore.*`): WrongGPU converts only the vendor DLL files that came with the player's
own games, never a copy that another program's installer placed in a game. Such an installer registers the files it placed
in a list the launcher always reads, and the player does nothing. Every search for a file to convert (the model and the Ray
Expand Down
Loading
Loading