Repository navigation
B8: a refused frame always has an explicit result; front end tested against the real backend - #228
Draft
phantoslayer21 wants to merge 6 commits into
Draft
phantoslayer21 wants to merge 6 commits into
phantoslayer21 wants to merge 6 commits into
Conversation
…ested against the real backend The front end's refused-frame contract (clean/fsr/src/frontend.cpp) is explicit for every model: WrongGPU's upscaler, then the stand-in, then AMD's FSR, and last, when none of them could upscale the frame (the stand-in cannot be made or fails, AMD's FSR is missing or its dispatch fails, including for a context WrongGPU already handed to AMD), the game's own colour is copied into the output unscaled (new passthrough_d3d12.cpp, Platform::passThrough) with one warning line, and the game gets FFX_API_RETURN_OK instead of an error with no output. When that is impossible too the error goes back with one line saying why, as before; an OptiScaler custom slot keeps getting the error (its host upscales). Tests: test_frontend.cpp covers each failure case for models M, K and L. New test_refusal_integration.cpp drives refused frames through the REAL network backend (the runtime DLL's Context) and the real front end on a D3D12 device, with a scripted executor (executor=dx12-test, executor_test.cpp) standing in for the D3D12 executor: K and the M control, with and without AMD's FSR, repeated refusals, the stand-in working and not, the real pass-through checked on the output's pixels, and no HIP runtime ever loaded. Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21
marked this pull request as draft
November 15, 2026 02:36
…y (REVIEW-228) Drop the raw CopyTextureRegion pass-through (it wrote only the render-sized corner, transitioned unrelated subresources and copied bits between format families). When the stand-in and AMD's FSR could not upscale a frame, the front end now asks the upscaler for its existing bilinear output pass: WgFrame::flags WG_FRAME_BILINEAR (the backend says it answers it with WG_BACKEND_BILINEAR_FRAME), and the runtime records the Converter's fallback pass (format aware, the full output size, its own barrier handling, no HIP). The game gets OK with one warning line per context; the counts are logged at destroy. When that is impossible too, the error goes back and the reason is logged for the first such frame, also after earlier successes. AMD's failures are logged once per context and counted, however long the run; AMD's per-frame context create is retried at 1, 2, 3, 10, 100 ... A frame flagged non-linear (sRGB / PQ) is mapped before the AMD-only fallback, so it gets the same last resort. Tests: test_frontend.cpp (every failure case for models M, K and L over 300 frames, log size bounded, success then an invalid output, AMD create failing, non-linear frames). test_refusal_integration.cpp (the real backend, the scripted executor) checks every pixel of the backend's bilinear output for consecutive frames after a sentinel fill, with a negative control, that model K's alpha follows the colour's alpha and M's is 1, that wgDiagHipExecutorsMade stays 0, and fails without the runtime DLL. Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21
marked this pull request as ready for review
November 15, 2026 03:06
phantoslayer21
marked this pull request as draft
November 15, 2026 03:10
…ne; no ABI change (REVIEW-228b) Drop the frame flag, the backend flag and the bilinear last resort: no change to wronggpu_upscaler.h, none of the backend's frame path. The contract that stays: when AMD's FSR and the stand-in have both failed for a frame, the error goes back with ONE line naming both failures per context (also after an earlier success or a takeover) and a count at the context's end. A failing AMD takeover now tries the stand-in before the error. A non-linear (sRGB / PQ) frame never reaches the stand-in on any path, the takeover and a context already handed to AMD included. AMD's failures are logged once per context; AMD's per-frame create is retried at the 1st, 2nd, 3rd, 10th ... frame. Tests: test_frontend.cpp (every failure case for models M, K and L over 300 frames, success then failure, sRGB and PQ on four paths). test_refusal_integration.cpp, a release check built from source by the release script, drives the real backend through the scripted executor=dx12-test; the runtime DLL's wgDiagHipExecutorsMade (not in a public header) stays 0. Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21
marked this pull request as ready for review
November 15, 2026 03:27
phantoslayer21
marked this pull request as draft
November 15, 2026 03:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #15 (0.6.5 item B8, from the #215 review). Based on main. No public header change, no ABI change.
The front end's refused-frame path (a frame WrongGPU's upscaler answers
WG_ERROR_UNSUPPORTEDfor) is shared by every model since 0.6.0. When AMD's FSR and the stand-in both failed it ended in an error with a log line per frame (or, after a takeover, with no line at all). This PR makes that result explicit and bounded, and tests the path against the real backend.What changes
clean/fsr/src/frontend.cpp,frontend.h): when AMD's FSR (missing, not created, or its dispatch failed) and the stand-in (not made, or its dispatch failed) have both failed for a frame, the error goes back to the game with one line naming both failures, once per context, also after an earlier success or after a takeover; the count is logged when the context is destroyed. Nothing else about the result changes: the answer is the same error as before, and the frames AMD or the stand-in can take keep being taken. In OptiScaler's custom slot the error goes back to its host as before.executor.h,executor_test.cpp,backend.cpp,executor_select.h):executor=dx12-testis an executor on the D3D12 route (records into the game's list, no slots, no fences) scripted frame by frame (test_script=orrro...:otaken,rrefused with the D3D12 executor's "frame not taken (nothing recorded)" error,fa failure inside the network; the last character repeats). It stands in for the default D3D12 executor in the backend's own refused-frame code (dispatch_record,refused_frame_action), which therefore runs unchanged. It is selectable only by that option name. The runtime DLL also exportswgDiagHipExecutorsMade(how many HIP executors the process's contexts made), for the release check below; it is not in any public header.clean/fsr/README.md("Frames the upscaler does not take").WG_FRAME_BILINEARframe flag). Both are gone: no frame flag, no new backend flag, no change towronggpu_upscaler.h.Tested
test_frontend.cpp(8984 checks, 0 failures; built with clang++ here, ctest in CI) andtest_fsr30.cpp(185 checks): for models M, K and L, each of: no AMD with the stand-in failing at create, failing at dispatch; AMD that cannot be created with the stand-in working and failing; AMD's dispatch failing with the stand-in working, failing at create, failing at dispatch; a custom slot. Each runs 300 refused frames and checks the answer for every frame (the stand-in's frame, or the error), that the one line names both failures exactly once, that AMD's failure is one line, that the count is logged at the end and that the log stays small. Also: a success followed by a failure (reported although earlier frames succeeded), and sRGB and PQ frames on four paths (AMD missing; AMD failing from the start, 40 frames, which includes the takeover threshold; a taken-over context whose AMD starts failing, with an ordinary frame after it that still gets the stand-in): the stand-in is never used for them. One older case changed on purpose: AMD's dispatch failing after the upscaler failed is now a stand-in frame (it was an error).test_refusal_integration.cpp(119 checks, 0 failures; WARP, no GPU needed): the front end with the REAL backend (the runtime DLL'sContext, built from this tree) and the scripted executor, a real D3D12 device and real textures, for model K and the M control, three scenarios each: AMD available (the first refusal hands the context to AMD, the rest are AMD's); no AMD with the stand-in working (five refusals in a row, each a stand-in frame, then the taken frames are the backend's again: no counter, the context stays usable); no AMD with the stand-in unavailable (the refused frames return the error with the one line, the frames the backend takes afterwards are fine). In every scenario the refusal comes from the backend's code (one line, K's and M's own),wgDiagHipExecutorsMadestays 0 (no HIP executor constructed), no HIP runtime line is logged and noamdhip64module is loaded.public_gates.pymust-pass gates pass, LOOK counts equal main's.Where the real check lives and how it is built
clean/fsr/tests/test_refusal_integration.cppis a release check, not a CI test: it needs the runtime DLL of a build (CI has none) and a D3D12 device (WARP is enough). The release script undertools/release(the release lead's) builds it from that source and runs it with the DLL of the build; the build command is in the file's header (the front end's core sources,-ld3d12 -ldxgi; the registry header generated withclean/wgshared/tools/gen_registry.py), and the DLL comes fromclean/runner/build.py --runtime-only. Run without a DLL it exits 2 (a gate that runs it cannot pass by skipping;--skip-if-missingis for a developer's loop). It does not check pixels: no path of this contract writes pixels of its own any more.Not tested
hip_switch=onfor models M and L (an explicit option that moves a context to HIP) is not driven here.frontend.cpp/frontend.hedits on that platform (they are plain C++ and were built and tested here).