RPCS3 / rpcs3

PS3 emulator/debugger
https://rpcs3.net/
GNU General Public License v2.0
15.2k stars 1.89k forks source link

Condemned 2:Bloodshot is flickering #5495

Open Realmantik opened 5 years ago

Realmantik commented 5 years ago

RPCS3 v0.0.5-7645-a4f67ccb Alpha CPU: AMD FX-6300 Six-Core Processor | 6 Threads | 7.96 GiB RAM | AVXx GPU: AMD Radeon R7 265 running on driver 1.5.0

Game: Condemned 2:Bloodshot. Graphics is flickering and audio is stuttering. Fps 20-40.

BLUS30115_20190103153538_capture.rrc.gz

RPCS3.log.gz

legend800 commented 5 years ago

Put the name of the game in titles please.

Xcedf commented 5 years ago

I can confirm this issue have the same Condemned 2 with the same id, always had this bug, but for some reason, now on current builds it flickering a lot less, previously it was kinda fine on PPU interperter fast and flickering as hell on LLVM, now LLVM kinda fine too but still happens rare.

NotEvenFlinched commented 5 years ago

I think it is worthy to check this game on newest build, it could be fixed accidentally.

AccountZeroName commented 5 years ago

Yes, I hope they fix it.

NotEvenFlinched commented 5 years ago

I never used rpcs3 before, but I will test Condemned 2 on latest version this weekend, because I have some interest to this game, original Condemned was very good btw.

Realmantik commented 5 years ago

Still the same, audio is not properly playing because of my CPU.

kd-11 commented 5 years ago

Is graphics flickering still an issue?

Realmantik commented 5 years ago

Still an issue, but now main hero of the game has semi-transparent hands. Cpu blit or WCB does not help, it happens on Vulkan and OpenGL. Video(without semi-transparent hands): https://drive.google.com/open?id=1rmfr81GhNNU_9obyB2cjUdI87RNdnhFs

Realmantik commented 5 years ago

Semi-transparent hands are gone and currently i am able to capture render data using RenderDoc. So couple of files that shows the problem in this game is here and here (i've bookmarked interesting drawcalls):

Zangetsu38 commented 5 years ago

lkast time tested not have see fdlickering , is fixed old time for me, but i remember i continue get smal flash white, like gow 3

Realmantik commented 5 years ago

@Zangetsu38 , Do you have processor like i7-8700K, i9-9900K or similar intel?

NEXAnomaly commented 4 years ago

I want to confirm the graphics flickering is still happening. Changing PPU Decoder to interpreter (both Fast and Precise) fixes it but reduces FPS from full speed to around 15-20fps. I have an AMD Ryzen 7 1700 3.0Ghz and happy to test things out as I'd be psyched to play it properly.

fgRuslan commented 4 years ago

I want to confirm the graphics flickering is still happening. Changing PPU Decoder to interpreter (both Fast and Precise) fixes it but reduces FPS from full speed to around 15-20fps. I have an AMD Ryzen 7 1700 3.0Ghz and happy to test things out as I'd be psyched to play it properly.

Can you reply to me if you find a way to optimize the game so it is playable? Please! As I have FX-6300 CPU, an optimized game is really important to me.

Asinin3 commented 4 years ago

@fgRuslan Use our discord server for that, this is an issue tracker. https://discord.me/rpcs3 Your CPU doesn't meet recommended requirements though.. So you're going to have problems with anything intensive.

digitaldude555 commented 3 years ago

Still an an issue.

SmokeyMcGames commented 3 years ago

It seems the flickering keeps the shader cache building constantly like it's looping. The hands are still an issue as well.

This game is frame locked to 40 by default with an autoexec config file in the game folder. Change this value to unlock the frame rate.

This is on .14-11725 Vulkan https://streamable.com/m3vk07

boomercore commented 3 years ago

Ongoing issue.

bujinkanrn commented 3 years ago

Transparent hands and color-flickering graphics still an issue with latest build.

Sh087 commented 3 years ago

Still present on 0.0.16-12301

sergeymild commented 3 years ago

still flickering on 0.0.17-12624. is there some possibility to fix it?. I really want to play(((

fgRuslan commented 3 years ago

still flickering on 0.0.17-12624. is there some possibility to fix it?. I really want to play(((

Me too :( I heard that Xenia (Xbox360 emulator) plays Condemned 2 normally, but I tried on Vulkan and it had problems with rendering. However, I heard that if you set the DirectX 12 mode in Xenia, everything will be fine

kd-11 commented 3 years ago

This seems to be a problem with the game itself, its leaving some random texturing bits active which will generate different shaders each time. The best I can do is try to find a way to make it not flicker when using single threaded shader compilation (legacy)

SolomonGrundyThanksForTheTurkey commented 3 years ago

Hopefully there’s a solution found soon.

I’ve been dying to play this game for years now. The first is an absolute classic.

kd-11 commented 3 years ago

After looking at this for a while, I now understand why it is flickering. Unfortunately, RSX rendering has nothing to do with the underlying cause here.

There are 2 types of flicker I found:

  1. Motion blur filter incorrectly applied to surfaces.
  2. Red/green artifact flashing.

For the second type (the most distracting and easiest to catch with tracing tools) I found it happens because of a shader swap. The game has some other shader that is loaded sometimes instead of the correct one. It is the same bad shader each time, even if you reboot the game, so this is not a case of memory being corrupt. It seems to be a valid shader just loaded to the wrong place. I also isolated it to a situation where the right shader is used before and after the affected draw calls. This is also not a race condition - the bad shader is there even if you wait forever. It is however related to performance, i.e the graphics are mostly stable when using PPU interpreter (though still not perfect) and worst with PPU LLVM. Of course performance is very poor using interpreters. Other notes:

  1. The game definitely thinks the correct shader is loaded at the memory address. I can verify this by inspecting other changes around the binding to show it is expecting textures and also matches the shader structure (register allocations, etc) of the correct shader.
  2. The game does not have proper shader allocation. Each 'shader' is being allocated in a ring buffer with a page alignment. All the addresses of all shaders are 4096 bytes apart.
  3. The game does not have any sort of feedback with RSX, it does not sample the framebuffer, nor does it use ZCULL query data.
  4. It can be proven that the fragment shader is the wrong one, since the previous calls use the same vertex program as the bad draws, but their fragment stage interprets the shaders completely differently (wrongly in fact).
  5. The shader transfer is done purely in CELL code, RSX is not involved here. The ring buffer corrupts at specific offsets as well, which to me sounds like some broken math in the game itself. It is likely that rpcs3 returns addresses that are not exactly what was expected with PS3 and this fucks up the game's logic somehow.

With that, I'll have to stop there for now especially since I don't know which part of the system is having issues and it seems to be some broken game logic outside the rendering pipeline for now. I will revisit at a later date.

SolomonGrundyThanksForTheTurkey commented 2 years ago

Tested on most recent build (0.0.18-12878-479150b2 Alpha)

The game flickers (still, no surprise) but now it freezes and often causes RPCS3 to force close - and NOT create a log report.

The Freeze seems to be easily replicated when toggling the flashlight on for the first time.

this is the only information I can offer at this time, because a log will not generate:

S RSX: Program compiled successfully x130 E RSX: ERROR: 0:268: 'textureProj' : no matching overloaded function found ERROR: 0:268: 'process_texel' : no matching overloaded function found ERROR: 0:268: 'assign' : cannot convert from ' const float' to ' temp highp 4-component vector of float' ERROR: 0:268: '' : compilation terminated ERROR: 4 compilation errors. No code generated.

E RSX: F SIG: Thread terminated due to fatal error: Failed to compile fragment shader (in file D:\a\1\s\rpcs3\Emu\RSX\VK\VKProgramPipeline.cpp:29[:25], in function compile) (e=0x0000007e[126])

Attached is a screenshot of the game frozen - closing the condemned 2 window also forces RPCS3 to close without warning and does NOT create a log after closing.

Capture

kd-11 commented 2 years ago

Provide a log. EDIT: If you cannot get a log normally, set your log window to capture notice level and then paste the output in gist or some other external location. Otherwise that single line isn't much to go on.

SolomonGrundyThanksForTheTurkey commented 2 years ago

Okay, I will provide a log using your method in a few minutes.

kd-11 commented 2 years ago

This is a symptom of the previously discovered problem. Basically, we have a texture with the cubemap flag set that is used in a shader for a tex instruction that has the projective operation enabled. This is an impossible combination. My thinking is that we're supposed to clear memory to 0s somewhere and we fail to do so, or the game is truly broken and works by pure chance.

kd-11 commented 2 years ago

https://github.com/RPCS3/rpcs3/pull/10993 should allow the game to run with the broken shaders again. I'll have to run some tests on real hardware to determine what is supposed to happen when a game messes up texture modes like this. It may be a clue to what is causing the flickering.

SolomonGrundyThanksForTheTurkey commented 2 years ago

Sorry, I wasn’t able to provide a log - I had to deal with some real world situations. But, I’m happy to see some progress!

As always, the work you guys all do kicks so much ass.

I have supreme faith that you will figure this out.

kd-11 commented 1 year ago

This is fixed by https://github.com/RPCS3/rpcs3/pull/12762 There is some minor glitching while shaders are compiling but that is expected. The previous investigation was correct, the wrong shaders were being used, but this is a bug in RSX afterall. The RSX shaders were picked correctly, but the backend shaders were wrong because previous shaders sometimes would get incorrectly loaded for a next draw due to a bug. Fixing this also solves the crashes as the shader mismatch was causing all kinds of problems to show up.

Realmantik commented 1 year ago

I tried version v0.0.24-55d1b466 Alpha | pull/12762, but the problems are still the same RPCS3.log.zip

kd-11 commented 1 year ago

Try using default settings + legacy compiler. You can toss in accurate rsx reservations + fifo atomic. I am not able to reproduce the glitching any more. I can trigger it easily with crashes on master. If it's still not fixed I'm out of ideas and ways to repro/test.

kd-11 commented 1 year ago

Removed from PR desc.

boomercore commented 1 year ago

Ongoing in 0.0.26-14637, Vulkan, defaults + legacy + atomic + accurate RSX. 3060, Win10, Nvidia 528.24.

LeRutY commented 1 year ago

Still an issue. i7 7700K, GTX 1080, Windows 10 22H2

kd-11 commented 9 months ago

Still happens. Another one for the software renderer bin.