hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.43k stars 2.19k forks source link

graphic glitch in Super Robot War Z2 #6093

Closed daniel229 closed 10 years ago

daniel229 commented 10 years ago

going into or finished the battle,the screen glickering a moment like the following showing.since https://github.com/hrydgard/ppsspp/commit/c31a1b18f7ab78e72ab5867000e9849cff9a3214 ,Sorry for finding out the problem after Merged.@raven02 03

WRONG:

NOT CORRECT (but no issue):

CORRECT: (most games that use 480x272)

hrydgard commented 10 years ago

I knew it, there are always regressions after changing that function :)

daniel229 commented 10 years ago

breaks video in VP 02

unknownbrackets commented 10 years ago

Valkyrie Profile. And also the text, wow. It's horrible. It seems to think the framebuffers are 394x224, which they actually are, but it seems to draw in a region of the framebuffer.

This causes lines in the character faces and makes the text scale up very poorly.

To explain more, imagine this is the 394x224 buffer:

+------------------------+
|                        |
|                        |
|                        |
|                        |
+------------------------+

When drawing, you can see it then draw only in the top left corner (and the vertex preview is misaligned to where it actually draws):

XXXXXXXXXXXXXXXXXX-------+
XXXXXXXXXXXXXXXXXX       |
XXXXXXXXXXXXXXXXXX       |
XXXXXXXXXXXXXXXXXX       |
|                        |
+------------------------+

Then, it draws this (with linear filtering) to the screen. It uses the "right" percentage of the framebuffer, so it's full screen, but this means it's using afaik approx 323x194 (btw, 323 = 394 * (394/480)...) to actually render. Here's a screenshot of the terrible-ness:

valkprof-render

All of this rendering is done in throughmode. I suppose this is the same reason the video is wrong.

It draws the video to a 512x512 texture framebuffer that is detected as 320x224, and then copies it onto itself (ugh, silly game) in the top left 320x240 quadrant. Then it copies that (as a 512x512 texture) to the primary framebuffer which is correctly detected as 512x512.

If I force 0x04110000 to always be detected as 394x224, it fixes the text (the menu looks wrong, but that's because I'm forcing it incorrectly for some places.) This does not help the video, which needs it to be >= 480x272 of course.

-[Unknown]

unknownbrackets commented 10 years ago

This also affects some areas of Tales of Phantasia X.

-[Unknown]

daniel229 commented 10 years ago

Super Robot War Z2 get lots of. 06 07

daniel229 commented 10 years ago

Ikuze Gen San Flickering

unknownbrackets commented 10 years ago

Gungnir is also affected in a similarish way to Valkyrie Profile, where some things are rendered (in throughmode) at a significantly lower resolution than they should be. In this case, it's only on the second of two framebuffers.

It does set the scissor while drawing, so I guess that's making it misdetect.

-[Unknown]

unknownbrackets commented 10 years ago

So, the general problem here for Valkyrie Profile seems to be like this:

Step 1. Framebuffer is created at 394x224. Step 2. At some point, framebuffer is detected as 480x272. Step 3. This stops happening, and it returns to 394x224. if (v->width < drawing_width && v->height < drawing_height) { prevents the width/height from being decreased, so they stay at 480x272. Step 4. In renderWidthFactor = (float)renderWidth / framebufferManager_->GetTargetWidth();, renderWidth = 394 but TargetWidth = 480, so it draws in the top corner.

This is the same thing affecting Gungnir and Tales of Phantasia X (when you watch a skit.)

Commenting out v->width = drawing_width; etc. fixes it, but I'm sure that'll break something.

The video in Valkyrie Profile is a separate problem, since it really is the case that there's an FBO of the wrong size there. Probably need to resize it after X frames when there's no render.

-[Unknown]

unknownbrackets commented 10 years ago

This also affects Aedis Eclipse, which seems to be unplayable due to this problem (can't see most any graphics.)

-[Unknown]

daniel229 commented 10 years ago

Gran Turismo Driving Challenge mode lower resolution. 01

revert 02

daniel229 commented 10 years ago

Castlevania Rondo of Blood original total black screen.

unknownbrackets commented 10 years ago

I've added some notes at the top from games that have and don't have problems with non-480x272 buffers.

I'm curious about games I don't have, like GTA.

This also logs some useful info:

    if (drawing_width != 480 || drawing_height != 272) {
        NOTICE_LOG(SCEGE, "%08x V: %ix%i, R: %ix%i, S: %ix%i, STR: %i, THR:%i, Z:%08x", gstate.getFrameBufAddress(), viewport_width,viewport_height, region_width, region_height, scissor_width, scissor_height, fb_stride, gstate.isModeThrough(), gstate.isDepthWriteEnabled() ? gstate.getDepthBufAddress() : 0);
    }

-[Unknown]

daniel229 commented 10 years ago

Yes,above games fixed,however, boku no natsuyasumi 1 and 4 broken again natsuyasumi 1 display in a wrong size and flickering natsuyasumi 4 black in the sea 01 02

beats crashes on startup 03

Tactics Ogre black 04

dragon ball tgavs transparent block box sometime on the ground 05

GTA VCS looks fine.

unknownbrackets commented 10 years ago

I don't have the first three, but I've made some improvements.

Dragon Ball Z needs the framebuffer size to reduce. The problem is, the code in StateMapping seems to work under the impression that width/height is the real width/height, and scales through drawing up. I tried fixing that and it helped, but then in some games I got things not copied to the framebuffer at the right size. Grr.

-[Unknown]

daniel229 commented 10 years ago

beats and Tactics Ogre are fiexd,the others no change.

daniel229 commented 10 years ago

kingdom heart also seeing transparent black box 06

solarmystic commented 10 years ago

@daniel229 I'm not seeing the transparent black box in KH BBS using @unknownbrackets test build:-

988

988a

daniel229 commented 10 years ago

@solarmystic yes,not every area,it's specific,that area is where fight the last boss.

unknownbrackets commented 10 years ago

The Dragon Ball Z shadows issue is the Frogger issue. Anything that makes it "work" by not showing the shadows at all is just a bug in disguise.

-[Unknown]

daniel229 commented 10 years ago

So the kingdom heart might be the same.

unknownbrackets commented 10 years ago

Hmm, it could be. Does it use that same matrix tex gen mode? I don't have Final Mix... maybe I can find the issue somewhere.

Edit: I found it, right near the beginning, it is using that same mode. But shadows work at the very very beginning. Interesting, because it's using that mode both times.

-[Unknown]

daniel229 commented 10 years ago

fixed in https://github.com/hrydgard/ppsspp/pull/6211