Repository navigation
D3D12.X: keep untranslated console graphics and stream shaders out of the driver - #303
pedrocalazans05 wants to merge 1 commit into
Conversation
|
Independent test run on commit Tested
Not tested
AI use
|
|
Tested 80fb3be merged onto main 4017f8f (merge 365c47f, no conflicts). The change does what the description says; three things to settle. 1. The new tests cover the two predicates and
2. It conflicts with #214 in
3. From reading, where the graphics guard applies: Tested RTX 5070 Ti (NVIDIA 610.74), Ryzen 9 9950X, Windows 11 26200, debug.
Not tested
🤖 Claude Fable 5.2 |
… the driver Mirror dev_create_compute_pso's console-bytecode guard in graphics_pso and dev_create_pipeline_state so untranslated Xbox DXIL (NOBC/XDAT) never reaches the PC shader compiler (AMD's amdxc64.dll fails fast with 0xc0000409 instead of returning E_INVALIDARG). Also fall through to the stand-in PSO when translated_graphics_pso returns a failed HRESULT (e.g. translated_gs_pso on GPUs without mesh shaders), and rewrite console topology (subobject 14 -> TRIANGLE since HS/DS are stripped), RTV (subobject 15), and DSV (subobject 16) formats inside fallback_stream. Adds unit tests for the predicates and fallback_stream rewrites plus fake-device behavioral tests calling graphics_pso and dev_create_pipeline_state directly.
80fb3be to
1193d2c
Compare
|
Thanks for the thorough review and negative-control check, @Kalmarv! Updated the PR on commit
Also thank you @Fizzonaut and @jleybourne for the independent RDNA3 and NVIDIA test runs on |
|
Test run of Tested
Review: Untranslated console shaders are kept out of the driver and the stand-in is used, while PC-only graphics and stream PSOs pass through unmodified, as the tests check. At 499 lines I reviewed the structure, not every line. Not tested: no retail title or regression run (I have no unpacked game), no Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code. |
|
Test report and review for Tested
Head shows 99.9 % of base's frames and the same peak commit; no device removal or crash in either. Review (diff read at
Not tested
AI use |
The RX 580 (AMD Polaris) reports no conservative rasterization tier, and its driver refuses every pipeline that asks for it with E_INVALIDARG: the translated pipeline, its stand-in and the dummy fallback alike. In a retail title run on main (80f4819, with logging added), all 12 stand-ins with ConservativeRaster on were refused and all 54,193 without it were made. After the translated pipeline was refused, graphics_pso handed the title's own description, console shaders included, to the driver, and AMD's shader compiler ended the process with 0xc0000409 before the first frame (xcl-dev#303 guards that path on its own). XCL now asks D3D12_OPTIONS for the tier and turns conservative rasterization off in the descriptions it makes (translated, stand-in, fallback) where the GPU has none. Those draws then cover the pixels whose centres their triangles cover. On the RX 580 the title ran its menus for 120 s at 30 fps with default settings, with no pipeline refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mirrors
dev_create_compute_pso's console-bytecode guard ingraphics_psoanddev_create_pipeline_stateso untranslated console DXIL (NOBC/XDAT) never reaches the PC shader compiler. On AMD GPUs (amdxc64.dll), passing stripped console DXIL directly toCreateGraphicsPipelineState/CreatePipelineStatetriggers a fail-fast crash (0xc0000409) instead of returningE_INVALIDARG.When
translated_graphics_psoreturns a failedHRESULT(for exampletranslated_gs_psoon a GPU without D3D12 mesh shaders),graphics_psonow falls through to the stand-in PSO instead of returning the failedHRESULTdirectly. Insidefallback_stream, console topology types (subobject 14— anything outside1..=3, includingUNDEFINED,PATCHsinceHS/DSare stripped, and consoleRECT_LIST_TYPE = 19), RTV formats (subobject 15), and DSV formats (subobject 16) are rewritten to PC-compatible values.What is in it
crates/xcl/src/hle/d3d12x/real.rs:graphics_has_console_shaderandstream_has_console_shaderguards before rawfinish_psoingraphics_psoanddev_create_pipeline_statetranslated_graphics_psoreturnshr < 014→TRIANGLE), RTV (15→pc_target_format), and DSV (16→pc_view_format) translation infallback_stream(aligned with D3D12.X: bound driver PSO compile concurrency and surface stage progress (#156) #214'sfallback_streamsubobjects14/15/16)console_pso_guard_tests: predicate tests,fallback_streamrewrite test, plus an isolatedFakeAdoptedDeviceharness callinggraphics_psoanddev_create_pipeline_statedirectly to verify driver call counts, console shader blocking,translated_gs_psofailure fallthrough,fallback_streamrewriting, and PC-only passthroughTested
31.0.21925.1001), Intel Core i3-10100F, Windows 11 Build26300,rustc 1.100.0 (0ef1bc386 2026-11-09), debug (cargo test) & release (cargo build --release -p xcl)1193d2c(rebased cleanly ontoorigin/main7ebf1b8)cargo test -p xcl --lib console_pso_guard_tests -- --test-threads=4: 7 passed, 0 failed, 0 ignored (also 7 passed withXCL_ASYNC_PSO=0)1193d2c(temporarily removing each runtime change and runningconsole_pso_guard_tests):graphics_has_console_shaderguard: 2 behavioral tests fail (CreateGraphicsPipelineStatecalled twice with console bytecode first)if hr >= 0fallthrough ingraphics_pso:graphics_pso_falls_through_to_standin_when_translated_gs_pso_failsfails (E_INVALIDARGreturned, 0 driver calls)stream_has_console_shaderguard:dev_create_pipeline_state_blocks_console_stream_and_rewrites_fallbackfails (CreatePipelineStatecalled twice with console stream first)cargo test -p xcl --lib hle::d3d12x:: -- --test-threads=4: 95 passed, 0 failed, 1 ignored, 0 skippedcargo test -p xcl --test '*' -- --test-threads=4 --skip test_title_runs_and_game_folder_is_untouched: 39 passed, 0 failed, 20 ignored, 1 filtered outcargo clippy -p xcl --lib --tests: 0 warnings on added/modified lines inreal.rsamdxc64.dll31.0.21925.1001), untranslated console shaders reachingCreateGraphicsPipelineState/CreatePipelineStatecausedamdxc64.dllfail-fast0xc0000409during extended runs before this guard; with this guard in place, extended runs and the 60 s smoke run below hit 0amdxc64.dllcrashes.Regression run
Not tested
gpu::recomp::tests::gpu_*suite on this RX 580 (Polaris lacks Wave32 / native f16 / SM 6.6;gpu_wave64_ps_whole_wave_reductionshits a pre-existing Polaris driver access violation, unrelated toreal.rs)80fb3be)test_title_runs_and_game_folder_is_untouched(noSystem32\xgameruntime.dll/ Gaming Services installed on this PC)XCL_SAMPLE_*game-data tests (variables unset)AI use
amdxc64.dll0xc0000409crash from logs, implemented the console-shader guards,fallback_streamsubobject14/15/16rewrites, andFakeAdoptedDevicebehavioral tests + negative controls, ran the local tests/smoke runs above, and performed an adversarial code review (APPROVE). Reviewed and verified by the author.