Pcsx2: Meta: GSdx top left corner issue

Created on 28 Apr 2016  路  107Comments  路  Source: PCSX2/pcsx2

I'm trying to implement a solution to handle properly the top left corner post-processing effect. Let's centralize information here.

Game impacted (from the top of my head, likely more).

  • [x] MGS 2
  • [x] Prince of Persia
  • [x] Urban Chaos
  • [x] killzone
  • [x] destroy all humans
  • [x] Star wars battle front 1
  • [x] star war battle front 2
  • [x] horsez
  • [x] JamesBondEverythingOrNothing
  • [x] DeathByDegreesTekkenNinaWilliams
  • [x] Catwoman
  • [x] Mercenaries (unfortunately suffer of half screen bug)
  • [ ] Summoner
  • [ ] Stolen
  • [ ] Hitman: Contracts
  • [ ] Midnight Club 2 #2708

Better but still broken

  • [x] MGS3 (codec might suffer from another tc issue)
  • [x] GSC_TouristTrophy (better but still has a couple of issue)
  • [x] kung fu panda (remain plenty of other effects)

Broken due to bad detection of the effect

  • [ ] GSC_Manhunt2 => (will need dedicated CRC shader) #2758
  • [x] Tekken5 => dedicated shader must be good now
  • [ ] Ridge Racer V #1327
  • [ ] Ratchet & Clank #914
  • [ ] Ghost in the shell #1327
  • [ ] GT4 (better but still has a couple of issue) #1313
  • [ ] Steambot Chronicles #2722
  • [x] TalesOfAbyss => dedicated shader must be good now

Need test:

  • [ ] GSC_BlackHawkDown (night filter)
  • [ ] GSC_ZettaiZetsumeiToshi2
  • [ ] tales of legendia
Hardware Texture Cache Meta Issue

Most helpful comment

OoO
urban_chaos_trophy

All 107 comments

having a scan through my games to see if i can find any others that do it.

Destroy All Humans - it's not overly noticable (due to the shadow mess on the screen)but its there.
Hitman Blood Money - Seems to have 2 levels of it? one shows more than the other (wrong colour though)

Edit: Totally O/T but you've nearly fixed Driver 3's graphics! The text is still a bit broken but it's readable and most of the texture flicker is gone, you just get the odd little bit now.

I have a dump of this game, but I don't see it. Maybe not the good scene. However there are various postprocessing effect.

ill try and get another one if you'd like, it even does it on the menu, but im not totally sure it's right.

I'm updating that post as i find games btw

Ok. So far I have enough gs dump to implement somethings

Stuntman also crashes with a RAM spike with OpenGL(this happens more often now than on 1.4.0).

Ok. I'm nearly sure it is a variation of a similar effect. Currently my detection is based on FrameBuffer address == Texture address.
However Prince Of Persia. Copy the Framebuffer to another place. So my detection is dull. (and move is badly emulated in texture cache).
However detection work nicely for MGS and killzone.

That's progress :)

OK finished going through my DVD ISO's, there wasn't really many that weren't already mentioned that I could find. There might be more but I'm totally not going through all my discs ;)

Ok. Let's me first try to correct MGS/KillZone. For PoP, I need to find a way to detect the mess. Or maybe we could rely on crc/option.

For PoP, I need to find a way to detect the mess. Or maybe we could rely on crc/option.

That all depends how often that effect is used and what drain on performance it is. If this is the only game to use it, or there is a huge performance drop, then yeh, option it (so people have an option)

Without CRC ;)

sub_rt

The trick is to properly detect the effect. My current implementation replace current draw call by an alternate draw call. Option or CRC will help to avoid side effect. Anyway, I need to find a way to correct the move first.

@ssakash you need to check several open issues.

At all
I pushed my implementation on master. Time to give it a shot.

Good job! ill give it a go :)

Rachet & Clank - Don't think it ever had this issue, that has mipmapping problems.
MGS 3 - Yay looks much better now! :)
Prince of Persia - Screen is completely blue
GT4 - Still has the weird colours when transitioning between scenes (it was blue this time)
Urban Chaos - screen is completely pink tinted but now the box in the top left IS the correct colours and no longer wrong, nor is it sliced!
Killzone - has a half screen cut off now. bottom half being darker but you can see the game.
Destroy All Humans - Still has the box in the top left, it looks like it is used to fade the background when you have a menu open (this is probably why you never saw it)
Hitman Blood Money - Seems to be fixed now! :)

3/6(or 8 if you count possible different issues) fixed! :)
i might give you 3.5, half a mark for Prince of Persia ;)

Killzone already had the half screen issue. The infrared view is now fixed.

Splinter Cell: Pandora Tomorrow infrared view is also fixed.

Try this hack for killzone UserHacks_ColorDepthClearOverlap = 1 If it doesn't work, I think I know the issue. Various game suffers of this half-screen issue.

It doesn't work(yes, userhacks was on).

Thanks for the test, so it is the 2nd bug ;)

GT seem to be a different issue. Urban Chaos effect is halfly detected. It also moves the RT as pop (but differently).

Can confirm (checked with depth enabled on OGL as well, just in case) that the colourdepthclear line doesn't affect Killzone, so yeh, its the half screen issue, which is another one of those affects a ton of games bugs :P

Oh nice, PoP is pink now. You can chose the rendering for boys or girls ;)

Oh nice, PoP is pink now. You can chose the rendering for boys or girls ;)

lol xD

Hum, actually I think it is working for PoP but it fails to handle the old texture shuffle. It is implemented very strangely (it is maybe not a texture shuffle).

I'm sure you'll sus it :)

My god, I don't know what they smoke but it must be very strong!

Here are the step

  • copy the framebuffer 0x0 to 0x2300
  • channel shuffle: move the red channel (0x0) to others channel (0x2300)
  • change brigthness of 0x2300 to 0x0.
  • texture shuffle: move RGBA_RGBA_... (0x0) to RRGB_ARGB_A...(0x2300) (I think, dunno if it wrap at the end)
  • use alpha channel of 0x2300 to render into 0x0
  • channel shuffle: move the blue channel (0x0) to others channel (0x2300)

....

_blinks_...... _blinks again_...... _tries rubbing eyes_...... What the hell??? That seems an awfully long way around doing things.

Yes it is a nightmare. I don't count the number of texture conversion and the number of draw call to emulate this mess... It is due to the fixed behavior of GS. It will be free on a modern GPU (a single draw call no conversion...)
I need to create a new shader to move the blue channel to the alpha channel (for the texture shuffle). I hope will be enough.

Fingers crossed.

I feel almost like we should hle this crap and get a fingerprint of the setup of the gs for each type of draw and do it all the pc way and just copy the result back instead of having to do what the gs would normally do.

Devil May Cry still has the box in the top left corner as well

@MrCK1 does the game require lots of memory (set scaling to 4x-6x).

@refractionpcsx2
well it is more less what I'm trying to do. I don't emulate texture conversion, and I skip various draw call. But 1 PC draw call can do N GS draw calls (N could be bigger than 300), even a basic effect requires 2/3 GS draw calls. So actually my texture shuffling is partially working so it is maybe not the issue. And finally understood what the game is trying to do with all this mess. It is only a color (gamma?) correction. So rendering is basically

out.r = color_table_r(out.r);
out.g = color_table_g(out.g);
out.b = color_table_b(out.b);

Because GS can access a single channel, the game uses various trick to move thing around. So the first color channel trick will handle the Red. The "old" texture shuffle will do the Green. And the last color channel trick will manage the Blue.

Awesome :) I'm expecting the next fix to sort it completely then! :)

Let's hope so.

So, issue is that I'm dumb. Current implement expects that texture and RT are the same, so I sampled the RT directly. New code can detect case where texture and RT are different. But RT was still sampled...

Here the status of PoP now (4x by the way, without crash)
pop

Edit: however require preload hack.

That looks much better :)

TBH I leave the preload hack on, now it doesn't crash :P Doesn't seem to do any harm.

TBH, preload is a pseudo hack. It feels more correct to enable it (however it could impact the perf). But FlatOut told me that he got some glitches on FMV.

UrbanChaos is still wrong but better (on 4 frames we now skip 1112 draw calls....)

nice! That's some impressive work :) optimising ftw! Maybe one day we will be as fast as Dolphin lol

@MrCK1 does the game(Devil May Cry) require lots of memory (set scaling to 4x-6x).

I've just tried it and it does not. I can run it on 6x native OpenGL, hw depth, accurate date, Blending on Ultra at full speed. :P
It still has the small duplicate frame in the top left though.

Do you have this duplicate frame on SW ?

I opened a PR #1322 with the new code. Hope it won't generate any regression. I'm currently looking urban chaos now but I'm afraid there is another effects...

Destroy All Humans - Background fading effect thing is fixed and has the right pattern on it, good job!
Urban Chaos - Yes much much better, still has a horrible "fog" effect
MGS3 - Ingame still looks fine, Codec is now a cartoony grey colour, which I think it is supposed to be going from google images! I don't know about infrared, haven't got that far.

OoO there is bad interaction with my depth implementation. The game read back the depth buffer 16 bits as an 8 bits index. I expected no sane dev would do that because everything will be scrambled. It seem someone manage to find an idea, they draw 320 sprites (by page) to unscramble data...

Genius? :p

Do you have this duplicate frame on SW ?

No, it seems it's a scaling issue as it doesn't appear in HW native resolution either.

I have a dump for a similar issue on another game.

So Urban Chaos reads the 16 bits depth as a 8 bits index and store the result into a 32 bits color. I think the operation is close of that (mult and div through palette).

lsb   = Depth  & 0xFF;
msb = (Depth >> 8 ) & 0xFF;
color1 = (lsb / 7 )  + (lsb * 36)
color2 = (msb / 7) + (msb * 36)

But I miss somethings. The first draw which does the /7 gives a band rendering because of lsb/msb. But the 2nd part is normal.

Here a picture of the expected result after the 1st draw
01586_f5001_rt0_02440_0

And after the 2nd draw which does + color_index * 36
01796_f5001_rt0_02440_0

Or maybe the game try to do something like that lsb / 7 + msb * 36. It would make more sense.
Depth is ABBBBBGG GGGRRRRR. It will make sense to shift the GreenRead part on the right. And the BlueGreen part on the left. So it roughly equivalent to (lsb >> 3) + (msb << 5).

Now I need to understand how we can select between lsb and msb so I can implement a hack for it.

Edit: so sampling line from [0;2] * N give you the LSB. And from [2;4] * N give you the MSB.

They don't make it easy do they lol

Hum it is even worse. What I did so far, is to detect the 8 bits effect, apply it to the full screen and skip the following draw call. Because they call it twice in a row, I can't do that neither. If I don't skip draw call, the texture cache will do extra lookup (huge memory consumption) and apply various conversion (huge gpu slowdown)...
I need to implement something to handle offset inside the framebuffer. Ofc without breaking others renderers.

Call me weak, but I think I will put a CRC hack for this one. At least to drop the useless draw call. (well except CRC hacks are after texture lookup and not before...). What a mess.

OoO
urban_chaos_trophy

Lookin' good! :)

And likely much faster than master (and even for normal gpu)

hope so lol

Tried latest commit build for GT4. It doesn't crash during Car selection but it still crash during racing with 3xnative if your GPU VRAM only 2GB

Which commit did you try exactly? I'm a few behind now :p

Oh, I'm actually past that. It's going to be a while until there's a proper fix, I can tell you that ;)

Tried latest commit build for GT4. It doesn't crash during Car selection but it still crash during racing with 3xnative if your GPU VRAM only 2GB

The weird thing is it only still crashes during races. Time trials, which still crashed a few commits/GITversions ago are absolutely fine now...

Tekken 5 still has top left corner issue
v1.5.0-dev-683
8nxh1ff

That is a master build, it is only fixed in the pull request

GT4 => please test the crc level impact too.
Tekken5 => Ref is it ok in the pr? Nobody report it (or I miss it).

I didn't see any problem with it, I'll check it again to make sure it hasn't changed...

I will merge the pr soon. I'm adding a comment for man hunt2.

Just checked tekken, looks absolutely fine to me..

This is a different stage so I don't know if it's just happening on that one (I don't even know which stage it is), but this one is okay

tekken5

(The dark bit in the top left is supposed to be dark :P )

I tested acid rain stage
v1.5.0-dev-695 still had this issue
Urban jungle stage is maybe fine

Could you post a GS Dump of the stage for us to check? when I say us I mean @gregory38 :P

Does this Tekken 5 graphics issue relate to GSdx top left corner issues ?

Attached GS dump https://www.sendspace.com/file/8u363i

https://cloud.githubusercontent.com/assets/10874582/14942179/806db73a-0fe7-11e6-82f3-c5da0ed8e1b1.jpg

I need to find a better way to detect the effect.

It start well and then boom.

T:Error ID:1380 S:Mid   => Channel shuffle effect detected (2nd shot)
T:Error ID:1383 S:Mid   => Red channel
T:Error ID:1383 S:Mid   => Channel shuffle effect detected SKIP
T:Error ID:1383 S:Mid   => Channel shuffle effect detected SKIP
T:Error ID:1383 S:Mid   => Channel shuffle effect detected SKIP
T:Error ID:1383 S:Mid   => Channel shuffle effect detected SKIP
T:Error ID:1383 S:Mid   => Channel shuffle effect detected SKIP
T:Error ID:1419 S:Mid   => ERROR: Update RenderTarget 0x34e0
T:Error ID:1440 S:Mid   => ERROR: Update RenderTarget 0x3500
T:Error ID:1461 S:Mid   => ERROR: Update RenderTarget 0x3520
T:Error ID:1482 S:Mid   => ERROR: Update RenderTarget 0x3540

Tested Tales of the Abyss using 6430e41fb524f9f8e6a994bafd61d090fd4c2a13
It should be noted that the CRC hack effect is first encountered in the Engeve village. That said it does not seem to be fixed. (Preload data frame also made no difference)

Software: pcsx2 2016-05-02 14-07-06-34
OpenGL native (CRC off): pcsx2 2016-05-02 14-07-09-08
OpenGL scaling (CRC off): pcsx2 2016-05-02 14-07-23-22

Could you give me a dump please.

Thanks you. I can reproduce it. It is indeed the same channel effect. And maybe I know the issue. I suspect the game does 3 effect in a raw but my code only detect the first one. I need to stop when a new palette is uploaded but I need to change urbans chaos behavior. I need to come up with a more generic solution.

@gregory38 I don't know if it was related but it has the same effect as third screenshot of bositman on VP2

OpenGL Scaling (CRC on)
Boxes are visible
1

OpenGL Native (CRC off) Speed 19%
2

OpenGL Native (CRC Full) Speed 104%
3

OpenGL Native (CRC off)
2

OpenGL Scaled 3x (CRC Fullest)
3

Ghost Issues or probably post processing effects not aligned.
2
3

I found a bad interaction with accurate blending that could explain some issues. Tales of the Abyss seem to be fine now.

If it fixes another games, raise your hand :+1:

@gregory38
EDIT: Oops nvm me though nothing has changed in VP2.

Seriously! Are previous build working without accurate blending.

@gregory38 Both v1.5.0-dev-701-g90af611 & v1.5.0-dev-700-ge190841 on VP2 needs Basic Blending Accuracy to emulate properly.

What is the status with BA basic? Edit and what is the VP2 forest glitch?

@gregory38
Accurate Blending (None)
1

Accurate Blending (Basic)
2

Question was basic on 700 vs 701. Normally it mustn't have any impact. And my dump seem to be fine. Or you mean the line when upscaling?

@gregory38 Actually the 700 and 701 are the same , same as the screenshot on BA Basic.

No I was referring to the none BA screenie, the red rectangle on the top of the screenshot. NVM nothing has changed on VP2.

Note for myself otherwise my head will explode :p

Ghost in the shell

foreach page of the rt do
      // Note: some channel effects require 2 draws instead of 1, I don't know why
      channel effect red to tmp_page_0
      channel effect green to tmp_page_1
      channel effect blue to tmp_page_2
      // Then copy the tmp data to the RT (done with 3 draw calls)
      rt_page_N = Frag_Color_0 * tmp_page_0 + Frag_Color_1 * tmp_page_1 + Frag_Color_2 * tmp_page_2
end foreach
data 0x1400
tmp 0x3000
**********************************************************************
channel from 0x1400 to 0x3000
X: & 1015 (gauche)
Y:
* & 1017 | 4
* no mask
* & 1017 | 2
* no mask
X: & 1015 | 8 (droite)
y:
* & 1017 | 4
* no mask

Likely Red / Green / Blue
Clamp register

copy ? 0x1400 to 0x3000
**********************************************************************
Fr * 0x3000 + Fg * 0x3020 + Fb* 0x3040

lut:0x3060

Man hunt2:

3 lut CBP:0x3c08/CBP:0x3c04/CBP:0x3c08

GT4:

RT = 0x1a40

Fragment color to select R/B/G

Blend : R += B += G

CBP = 0x3580 for all colors (DC 1891 1894 1897)
target = 0x3560

target read back as palette
texture is 0x3584 (which is the palette actually) (unsizzle?)

Urban Chaos (extract green of 16 bit format)

Upload lut : shift right
effect
Upload lut : shift left
effect + blend

Guys I need some test on the new PR #1349

It woud love some Tekken5/Gran Turismo/Tales of Abyss tests :smile:

thermal goggles half-fixed too (mgs3)
pcsx2 2016-05-15 14-28-32-51

What is your mgs3 version exactly.

subsistence PAL

Conflict Desert Storm.zip

Conflict Desert Storm has top left corner issue at 60hz.

It isn't the same effect. However it could be a regression. Do you have the issue in older build? By the way, you could use the dump to quickly test version. (don't ask me how to use dump on windows ;) )

The issue is there from at least v1.0.0.

There seems to be transparent square in the top left corner of Midnight Club 3: DUB Edition Remix(might be related to worse issue in NTSC version of the game):
MC3DER top left corner.zip

There's a top left corner issue in Metal Arms:
Metal Arms top left issue.zip

I think my report for GT4 counts as well.
https://github.com/PCSX2/pcsx2/issues/1636

1610

Black box with black noodles in top left corner in many of the stages in software mode (the noodles are only supposed to appear on top of the image when you go down a rank)

image

image

According to a new bug report, Silent Hill 3 (PAL) is affected. Somebody else care to investigate this?

http://forums.pcsx2.net/Thread-Silent-Hill-3-PAL-A-couple-of-minor-issues?pid=570004#pid570004

Not at home so i can't post a screenshot,

Add Summoner to the list, there is a darkened rectangle in the upper left hand corner of the screen.

Added "Stolen" to the list. The game uses a channel shuffle effect (blue channel) for shadows and bloom/specular.

GS Dump: Stolen_hw_outdoor_gsdump.zip (rename to .gs)
Raw Dump: stolen_outdoor_hw.zip (rename to .7z)
Debug Log (IDs match Raw Dump): GSdx_opengl_debug_hw_stolen.txt
Block Dump (for anybody who feels like making a CRC hack ;) : https://drive.google.com/open?id=1UCSgDVBmb_SVNsLL_CVwtuQDIk2_VmFj
OGL HW: (shadows/lighting only present in top-left corner)
gsdx_20180115014905

OGL HW (indoor - same shuffle effect)
gsdx_20180115023644

OGL SW:
gsdx_20180115021150

Added Hitman: Contracts. Side note, the camera is higher than it's supposed to be in HW mode. That's another good issue to investigate at some point.

gsdx_20180128090644

Fixing the remaining issues for a 1.6 release milestone seems out of the scope so let's aim for 1.8 instead.

Similar to what was mentioned in #2753 Zettai Zetsumei Toshi 2 has this issue with some sort of depth + color effect. This effect occurs on the PAL version, and should also occur on NTSC-U/J versions unless there has been any recent CRC hacks that were applied to those versions only.


Yes it does have a crc hack, can you tell me the crc id and serial ?

Actually it might be better to upload a gs dump, multiframe preferred.
https://forums.pcsx2.net/Thread-How-to-create-a-proper-GS-dump

SLES-54587, A98B5B22.
That said the CRC hack simply skips drawing the effect, and is a bit out of date in general.

Here are two dumps I made a while back, the first of which has the filter enabled and the second has it forcefully disabled using Cheat Engine.
enabled.zip
disabled.zip

Latest build should be better on hw mode.

The effect is skipped, but unfortunately a good amount of effects are also skipped (e.g. snow, godrays, cutscene borders, fade transitions) that no longer need to be skipped. I'll make a meta issue about it or poke at the hack when I have the time.

Yes the game has plenty of hacks, some of which may not be needed any longer.
Debugging each will be a pita. It will help if you can upload gs dumps for each of the effects when they appear.

I've attached an archive with a few dumps for missing effects.
snaps.zip

Was this page helpful?
0 / 5 - 0 ratings