Skip to content

rsx/cfg/fp: Rewrite fragment program decompiler dependency tracking - #17837

Merged
kd-11 merged 36 commits into
RPCS3:masterfrom
kd-11:cfg
Dec 10, 2025
Merged

rsx/cfg/fp: Rewrite fragment program decompiler dependency tracking#17837
kd-11 merged 36 commits into
RPCS3:masterfrom
kd-11:cfg

Conversation

@kd-11

@kd-11 kd-11 commented Dec 7, 2025

Copy link
Copy Markdown
Contributor

Rewrites everything about how we determine aliasing register dependencies making use of the CFG. Everything is also unit tested for sanity reasons.

This should help close out graphics glitches that make no sense in some titles with the capacity left to diagnose more bugs in future easily and add custom passes to handle requirements.

Closes #6897
Closes #6229

@MarioSonic2987

MarioSonic2987 commented Dec 7, 2025

Copy link
Copy Markdown
Contributor

Fixes graphical issues in the following games:

Beyond: Two Souls image image
Topatoi image image

Comment thread rpcs3/Emu/RSX/Program/Assembler/FPToCFG.cpp
Comment thread rpcs3/Emu/RSX/Program/FragmentProgramDecompiler.cpp Outdated
@kd-11
kd-11 marked this pull request as draft December 7, 2025 23:30
@kd-11

kd-11 commented Dec 7, 2025

Copy link
Copy Markdown
Contributor Author

There's an issue with epilogue injection before loop and branch blocks to be fixed.
I'm also seeing epilogues where they have no business existing.

@kd-11

kd-11 commented Dec 7, 2025

Copy link
Copy Markdown
Contributor Author

I need to handle IF-ELSE successor to merge block with input dependency.
If both IF and ELSE clobber, there is no point checking their parents since any emitted barriers will be clobbered anyway.

Comment thread rpcs3/Emu/RSX/Program/Assembler/FPASM.cpp Outdated
Comment thread rpcs3/Emu/RSX/Program/Assembler/FPASM.cpp Outdated
Comment thread rpcs3/Emu/RSX/Program/Assembler/Passes/FP/RegisterAnnotationPass.cpp Outdated
Comment thread rpcs3/Emu/RSX/Program/Assembler/Passes/FP/RegisterAnnotationPass.cpp Outdated
Comment thread rpcs3/Emu/RSX/Program/Assembler/Passes/FP/RegisterAnnotationPass.cpp Outdated
Comment thread rpcs3/Emu/RSX/Program/Assembler/Passes/FP/RegisterDependencyPass.cpp Outdated
Comment thread rpcs3/Emu/RSX/Program/Assembler/Passes/FP/RegisterDependencyPass.cpp Outdated
Comment thread rpcs3/Emu/RSX/Program/Assembler/Passes/FP/RegisterDependencyPass.cpp Outdated
Comment thread rpcs3/Emu/RSX/Program/Assembler/Passes/FP/RegisterDependencyPass.cpp Outdated
@Triticum0

This comment was marked as outdated.

@Xcedf

Xcedf commented Dec 8, 2025

Copy link
Copy Markdown

Fixes #6229 indeed, both flickering surfaces and wierd shading

@woj1993

woj1993 commented Dec 8, 2025

Copy link
Copy Markdown

Most of builds didn't compile

@Asinin3

Asinin3 commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

Most of builds didn't compile

Its just FreeBSD that failed.. click the X icon and you will see everything else succeeds

@kd-11
kd-11 marked this pull request as ready for review December 9, 2025 00:05
@kd-11

kd-11 commented Dec 9, 2025

Copy link
Copy Markdown
Contributor Author

This is now in a reasonable state. Feel free to check more games.

@Triticum0

Copy link
Copy Markdown

I did test a couple with no real improvement than ones mentioned. Is there any behaviour i look out for having improved behaviour. Most games I've tested spu or buffer related so saw no improvement i go through my issues. If nothing to note, l will just comment tested games. great work as always kd👍

@kd-11

kd-11 commented Dec 9, 2025

Copy link
Copy Markdown
Contributor Author

If no difference is observed that is also a win. The rewrite is very extensive so observing no change is a positive outcome.
Most affected games fixed by the PR have broken shading such as blocky aritfacts especially ones that swim in screen space. It is likely most improvements will not be obvious.

@kunit1

kunit1 commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

Briefly tested Dante's Inferno. Crashed once very early on but couldn't reproduce it again.
No regressions from my perspective on Dante's Inferno.
I don't have a save file to test 7308 so can't tell if it makes any difference there or not.

@digant73

digant73 commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

all intro sequences in Fight Night Champion demo are corrupted when Asynchronous Texture Streaming is enabled. Similar issue on Fight Night Round 4 demo. They are ok on current master. Below a screenshot for FNC

image

@kd-11 kd-11 changed the title [TESTERS NEEDED] rsx/cfg/fp: Rewrite fragment program decompiler dependency tracking rsx/cfg/fp: Rewrite fragment program decompiler dependency tracking Dec 9, 2025
@kd-11

kd-11 commented Dec 9, 2025

Copy link
Copy Markdown
Contributor Author

all intro sequences in Fight Night Champion demo are corrupted when Asynchronous Texture Streaming is enabled

This work does not interact with RSX's host subsystems in such a way. Only recompiled PS3 shaders are changed and those certainly do not care about things like memory streaming. Memory decoding shaders are separate and unaffected.

@digant73

digant73 commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

text in splinter cell blacklist is blue.

image

kd-11 added 20 commits December 10, 2025 00:38
… (ELSE).

- In that case, find the node's END node and link to that instead. ELSE nodes are not reachable from children of the preceding IF.
- ELSE nodes are special this way, all other types of nodes are reachable by adjacency.
- Different from C++ amateur.
- Addresses code review suggestions to step up the C++
@kd-11

kd-11 commented Dec 9, 2025

Copy link
Copy Markdown
Contributor Author

text in splinter cell blacklist is blue.

image

I can reproduce this one.

@digant73

digant73 commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

good. As a separate bug (present also on master), Resolution Scale is broken in this game. objects disappear at short and long distance (e.g. in the place of my previous screenshot). Just in case it is something that can be fixed in a further PR. I never saw this issue on any other game

@kd-11

kd-11 commented Dec 9, 2025

Copy link
Copy Markdown
Contributor Author

good. As a separate bug (present also on master), Resolution Scale is broken in this game. objects disappear at short and long distance (e.g. in the place of my previous screenshot). Just in case it is something that can be fixed in a further PR. I never saw this issue on any other game

Blue text is fixed, it was a regression from one of the optimizations.

As for the flickering - this game has a custom occlusion implementation that uses compute which on PS3 is indistinguishable from normal render passes. You can use resolution scale, but of course you just cannot upscale an occlusion pass output since it contains discrete data. You need to set the threshold to something like 256x256 to avoid touching it (the VRAM resource for the compute pass is 256x128 in size)

@digant73

digant73 commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

ok, text is now fixed. There is some flickering (same place of screenshot) as in master. I'm using only RWCB. Tried Threshold 256x256 even without RS but that issue is still present. However it is also present on master (not a regression on this PR)

@kd-11
kd-11 merged commit 0f1eadc into RPCS3:master Dec 10, 2025
8 of 9 checks passed
@RPCS3 RPCS3 deleted a comment from maricelase Dec 10, 2025
@RPCS3 RPCS3 locked and limited conversation to collaborators Dec 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

I AM ALIVE [NPUB30383] graphic glitches Topatoi [NPUB30063] graphical issues.

9 participants