washingtondc-emu / washingtondc

Open-source Sega Dreamcast emulator
http://www.washemu.org
GNU General Public License v3.0
240 stars 7 forks source link

menus are not working 18 wheeler american pro trucker #107

Open snickerbockers opened 2 years ago

snickerbockers commented 2 years ago
c5cc2eea8180be2edcbfd0db9242b4632bd9cfbb is the first bad commit
commit c5cc2eea8180be2edcbfd0db9242b4632bd9cfbb
Author: snickerbockers <snickerbockers@washemu.org>
Date:   Thu Oct 29 15:47:34 2020 -0700
    pvr2: calculate clip limits correctly for sprites

    previously i was using z instead of 1/z

    this commit fixes the menus in Ferrari F355 Challenge.
 src/libwashdc/hw/pvr2/pvr2_core.c | 58 +++++++++++++++++++++++----------------
 src/libwashdc/hw/pvr2/pvr2_core.h |  1 +
 src/libwashdc/hw/pvr2/pvr2_ta.c   |  6 ++++
 src/libwashdc/hw/pvr2/pvr2_ta.h   |  1 +
 4 files changed, 43 insertions(+), 23 deletions(-)
snickerbockers commented 2 years ago

This appears to be related to the depth buffer range. OpenGL requires games to normalize depth coordinates between -1.0 and 1.0; any fragments outside of that range are not rendered. PowerVR2 does not have this limitation, so WashingtonDC is forced to attempt to compress an unlimited range of depth values into a limited range; this is difficult to get correct in all cases.

The new infrastructure being developed in the pvr_trace branch will make it much easier to analyze these problems and come up with an equation that works well for all games.