skmp / reicast-emulator

Reicast was a multiplatform Sega Dreamcast emulator
https://reicast.emudev.org
Other
1.1k stars 345 forks source link

Low Brightness/Contrast #1451

Closed kikeminchas closed 5 years ago

kikeminchas commented 6 years ago

Please Note: This form is the minimum required information for submitting bugs.
Removing this form may lead to your issue being closed until it is completed.

Platform Branch Hash CIDL
Android TV 8.0 (Nvidia Shield TV) master All (official r8.1 and latest beta) No

Description of the Issue

The image is dark, brightness and or contrast are off. It looks the image as a whole is dimmed but certain parts seem to have correct brightness values (see screenshots below). In some games, liek Crazy Taxi, issue appears always. In some others, like Dead or Alive, the brightness is correct while the camera rotates and zooms before starting a fight but as soon as fight starts the issue appears. This happens in both master r8.1 and beta releases. I have tried r7 but I was not able to select the bios and games folders so I was not able to load a game to check if issue is still there. This problem does not appear in the libretro core (see screenshot below)

Debugging Steps Tested

Logs Gathered

Screenshots

Reicast r8.1 Reicast r8.1 (Whole screen is dimmed but some elements like road lines and Axel's hair seem to have correct brightness, or at least they look much brighter than the rest of the screen)

crazy taxi v1 004 1999 sega ntsc us 6s 51035 -181029-171428 Libretro Reicast Core

flyinghead commented 5 years ago

this https://github.com/reicast/reicast-emulator/commit/9c4085ee1ee42f85fc31aaf0bc2e01e3e16024d8 fixes the issue @baka0815 ?

baka0815 commented 5 years ago

The conment above the line you changed does indicate that your change is correct. :) I'm currently a little sick, but can take a look at backporting this in the upcoming days.

kikeminchas commented 5 years ago

I confirm this is fixed in fh's 9c4085e . Thanks flyinghead!

Does this fix affect performance somehow? I got surprised at how bad it performs now, I would say even worse than libretro now, but then again could be due to this being a debug build?

flyinghead commented 5 years ago

It's not really a debug build in that the native code is optimized the same way as a release build.

However I also fixed another problem on NVidia Shield TV that requires each rendered frame to be copied to the next rendering buffer. This is due to Tegra X1 not preserving swap buffers.

This might have an impact on performance but some numbers would be helpful here to figure out by how much. I just ran the Crazy Taxi demo on both standalone and libretro and didn't notice a significant difference at first glance (although libretro is rendering at the default 640x480 whereas standalone is rendering at full HD 1920x1080)

kikeminchas commented 5 years ago

Sure, I can get you some comparisons. I would need to know how some options compare though ,so the comparisons are fair:

In Libretro I normally use: per strip alpha sorting DIV matching on Threaded Rendering on Synchronous Rendering on DSP on Resolution: 1280x960

In standalone I use the same settings when comparable (DSP, Sync Rendering ...) but there are some options I'm not sure how they compare: Bypass DIV matching (on) Unstable Optimisations (on)

With these settings:

Now, I'm not sure if we can compare the raw figures, Standalone's fps specially goes all over the place at times (it kinda works now at least, I remember some time ago it didn't work at all). However, even if the figures are not 100% accurate there is a significant difference in smoothness. Standalone is pretty choppy and there are obviously lots of frameskipping going on. Libretro is not butter smooth 60 fps but it is very close, with minor stutters here and there.

flyinghead commented 5 years ago

This is weird. With standalone (my branch) the FPS counter hovers between 40 and 60, sometimes briefly down to 34. I tried both a local build and the one from http://builds.reicast.com/#fh/mymaster with the same result.

Are you testing retroarch 32 or 64 bits? The 64-arm dynarec is slower than the 32-bit one. When using my branch the 64-bit dynarec is used.

kikeminchas commented 5 years ago

I am using retroarch 32 bits. You mean when using your standalone branch 64bit dynarec is used?

flyinghead commented 5 years ago

Yes, my branch contains both 32-bit and 64-bit builds. The 64-bit one is used on the NVidia Shield and other 64-bit platforms

kikeminchas commented 5 years ago

Ok, i tried again, this time with Retroarch 64bit. Still much better performance, I even tried disabling DSP in standalone and enabling it in Retroarch but no even so, performance is better in Retroarch. The only way I found to make Retroarch perform similarly bad as standalone (still a bit better though I would say) is if I enable Render to Texture in Retroarch. There is no such option in standalone so I am assuming there is no RTT there? Unless is enabled by default?

flyinghead commented 5 years ago

Render to Texture is always enabled in my branch, never on standalone iirc.

Which game are you testing Render to Texture with?

kikeminchas commented 5 years ago

All my tests are done in Crazy Taxi. Checking FPS and general smoothness during the demo.

baka0815 commented 5 years ago

@kikeminchas could you test with #1495 to see if your problem is fixed with that?

kikeminchas commented 5 years ago

@baka0815 I have tried the latest available build in master from Feb 19th but it's not fixed there. I think your pull request is still pending, right?

baka0815 commented 5 years ago

Sorry @kikeminchas for me beeing unclear. Before I merge this change I would like to know if it really fixes the problem. Use the baka/full-screen-shadow branch.

kikeminchas commented 5 years ago

Oh, right, I confirm that the change flyinghead applied to his branch does fix this issue.

EDIT: sorry, just saw you want me to test your branch, I will do shortly and let you know.

baka0815 commented 5 years ago

Thanks! Just want to make sure that this is allbthat's necessary and not something different missing.

kikeminchas commented 5 years ago

OK, installed 7e9a545 from your branch and I'm sorry to say that the issue is still not fixed :( . so as you mentioned there must be something else?

baka0815 commented 5 years ago

Hmm, any idea @flyinghead?

flyinghead commented 5 years ago

@kikeminchas can you verify that the issue doesn't happen if you disable the modifier volumes? I believe you can do this in the per-game config.

This will confirm that this is a problem of missing stencil buffer.

kikeminchas commented 5 years ago

Sorry, I am not able to check if that would work. The dropdown list that should contain the game name in the PGC page cannot be selected in the Shield with the gamepad. I even tried with a mouse but it does nothing, no list of games appear, even after just launching one from the PGC page as instructed in the help. It is not the only setting that cannot be changed in the Shield, the interface is not designed for Android TV...

flyinghead commented 5 years ago

@baka0815 I think there's another change needed to fix this: https://github.com/reicast/reicast-emulator/blob/7e9a545a05e94394d3824e4cf0acac662427c2ce/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java#L206 The parameter after renderDepth is the size in bits of the stencil buffer. Here it's zero and it should be set to 8.

baka0815 commented 5 years ago

The same was in shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/EditVJoyActivity.java, I changed both to 8.

@kikeminchas when the CI is done, could you try again with my last changes (https://github.com/reicast/reicast-emulator/pull/1495/commits/1d51ff565de2c77c2ff42504d799baa5741bbf28) please?

kikeminchas commented 5 years ago

Happy to confirm that the issue is fixed in 1d51ff5. Thanks both!

baka0815 commented 5 years ago

I merged #1495 so thanks @flyinghead for the code and help and @kikeminchas for testing.