xenia-project / xenia

Xbox 360 Emulator Research Project
https://xenia.jp
Other
8.3k stars 1.14k forks source link

Black screen space of 3D part #742

Open Parovozik opened 7 years ago

Parovozik commented 7 years ago

For some games 3D part unvisible (just black space, maybe color buffers or something else). Last working build 1.0.639 (https://github.com/benvanik/xenia/commit/257fbfc40846a5301d91c7e512c1be10a19fc649) After changes 1.0.640-1.0.641 (https://github.com/benvanik/xenia/commit/f87e55d0306a4e645bcc97bbd26dc9eea676cb05) (https://github.com/benvanik/xenia/commit/c0ee30c6b45691200b22409aa71745911d911f2a) and next (src/xenia/gpu/texture_info.cc) include last 1.0.778 this still not fixed. Additionaly this give memory leak (VRAM) for some games (RDR, MCLA for example)

Catherine

LOG Catherine1.0.778_LOG.txt . bandicam1 bandicam2

Oblivion

LOG Oblivion1.0.778_LOG.txt . bandicam3 bandicam4

MCLA

LOG MCLA639.txt LOG MCLA778.txt . bandicam7 bandicam8

RDR

LOG RDR778.txt . bandicam5 bandicam6

Parovozik commented 7 years ago

Way of the Samurai 3

LOG WaySamurai3_VK_77043ead_1.0.787.txt . bandicam 2017-07-07 05-45-01-616 bandicam 2017-07-07 05-43-30-791

Mortal Kombat vs DCU

LOG MKDCU_VK_77043ead_1.0.787.txt . bandicam 2017-07-07 05-38-55-478 bandicam 2017-07-07 05-37-12-401

Parovozik commented 7 years ago

Kengo ZERO: Legend of the 9

LOG: KengoZERO_VK_77043ead_1.0.787.txt . bandicam 2017-07-07 20-02-49-026 bandicam 2017-07-07 20-01-15-860 bandicam 2017-07-07 20-03-03-245 bandicam 2017-07-07 20-01-40-228

Parovozik commented 7 years ago

G.I.Joe

1.0.639_March7.2017 (https://github.com/benvanik/xenia/commit/257fbfc40846a5301d91c7e512c1be10a19fc649) 1.0.826_Jule11.2017 (https://github.com/benvanik/xenia/commit/a3bc6b0c04aeccf39a6312fa3aa53c017e7903ed) LOG GiJoe_Vulkan_1.0.826_a3bc6b0c.txt . bandicam 2017-07-14 02-54-52-415 bandicam 2017-07-14 02-56-44-730 bandicam 2017-07-14 02-55-27-289 bandicam 2017-07-14 02-57-20-657

AllanCat commented 7 years ago

I did some tests about this, f87e55d and c0ee30c didn't cause this issue. It turns out that what breaks games is caused by b34350e, there's probably something wrong with DemandResolveTexture. Reverting this commit makes background rendering again with the latest version. You can find the changelog in my xenia fork (also with some fixes for sth06, might work for other games as well).

Parovozik commented 7 years ago

Thanks. I will try it :)

Parovozik commented 7 years ago

Yes, this works is fine and given effect only on games which was with 'black space'. If compiled build as 'debug', then game on starting often say about error on file texture_cache.cc, at line 352, but still full works. If compiled build as 'release', then all ok. I used last 'xenia-master' + your 3 files (texture_cache.cc, texture_cache.h and vulkan_command_processor.cc). bandicam 2017-07-15 00-43-10-162 bandicam 2017-07-15 00-45-36-547 bandicam 2017-07-15 00-48-04-064 bandicam 2017-07-15 00-49-10-284 bandicam 2017-07-15 00-55-47-510 . Colors bug only there. All games which works earlier, still works correctly bandicam 2017-07-15 00-57-57-596 bandicam 2017-07-15 00-59-03-569 . How can add these fixes to the master build from here? https://github.com/benvanik/xenia.git (https://github.com/benvanik/xenia/commit/e11ba02e06f06559337a12971ad05eee0f846704)

ActualMandM commented 7 years ago

Sonic Unleashed (Preview/Demo/Final) is also affected by this black screen bug.

Before: 2017-07-14_16-03-48 After: 2017-07-14_22-18-46

And for those who want to try @AllanCat's fork, I compiled it with AppVeyor.

AllanCat commented 7 years ago

I did some tests on the current build, it seems there's problem with finding resolve texture's texture_info. (if (it->second->texture_info == texture_info) seems hitting wrong textures?)

By adjusting Demand and DemandResolveTexture's for loop, some textures are showing again(Sonic06's light shader, Catherine's background), but not for Sonic Unleashed and Fist of the North Star.

Here's the change i tried.

Also Is there any reason why we combined normal texture and resolve texture?

Parovozik commented 7 years ago

@AllanCat Thanks, i will try it :) I think for SonicU and Fist of the North Star other type of error - there problem with lighting a scene or objects

AllanCat commented 7 years ago

@Parovozik Thanks for testing :) With old build(separated texture cache) both of them are showing some textures ingame but covered with lighting error, with current build(even with my attempt↑) they shows nothing but ui.

Here's screenshots of FotN on old build fist3 fist2

You can see it working by looking at right/bottom of screen, pause also showing correct background.

AllanCat commented 7 years ago

btw combined with my attempt, adjusting PrepareResolve's info.width/height in texture_info.cc can yield correct texture alignment in some games. (eliminated noise at right/bottom edge, random screen flicking and some effect artifacts)

Change from

  info.width = width - 1;
  info.height = height - 1;

to

  info.width = (width > 2) ? width - 2 : width - 1;
  info.height = (height > 2) ? height - 2 : height - 1;

Comparison

Catherine before kat2 after cat1

Sonic06 before kdv2 after kdv1

motion blur is fixed too before offb after noaa4

Parovozik commented 7 years ago

Cool. I tried last master + fixes for [texture_cache.cc]. It works equally as previous fixes for [texture_cache.cc] [texture_cache.h][vulkan_command_processor.cc] and repair Black Screen, but look as more correct :) FotNS: desktop 07 27 2017 - 06 04 47 01 mp4_snapshot_01 59_ 2017 07 27_06 11 21

DrChat commented 7 years ago

I believe I documented this somewhere - this is a known issue and easy to fix. When the game wants to read from a resolve texture, sometimes it uses a special format that converts the texture on the fly. I've actually already written a function in texture_info.h (GetBaseFormat) which can revert those special formats back to their base, but have not hooked it up yet.

AllanCat commented 7 years ago

Is there an exact place to do this trick? I tried hooked it on some spots and they didn't seem to work. Thanks!

cooperate commented 7 years ago

Is this issue related to why character models don't render in many games? Sprites don't render in Guardian Heroes. Player models don't render in NHL 3 on 3 Arcade.

DrChat commented 7 years ago

Pinpointed the issue. In RDR, they resolve to a k_2_10_10_10_FLOAT, and sample it as a k_2_10_10_10. Currently, we don't support aliasing, so a new (empty) texture is created.

Parovozik commented 7 years ago

@AllanCat Your last 'black screen fix' give improve for some games, example Fast Furious Showdown: Master: bandicam 2017-08-11 01-14-36-292 Master+BSF: bandicam 2017-08-11 01-13-27-590 Master: bandicam 2017-08-11 01-09-26-435 Master+BSF: bandicam 2017-08-11 01-11-16-998 Master: bandicam 2017-08-11 01-15-02-542 Master+BSF: bandicam 2017-08-11 01-16-18-978

0x8080 commented 7 years ago

I'll see what I can do tomorrow, I need to get some sleep.

ActualMandM commented 6 years ago

Still happens on master with Sonic Unleashed 2018-02-24_15-25-15 xenia.log