Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] VideoCommon: Add epsilon to work around Nvidia rounding issue in texture lookup #3807

Closed
wants to merge 1 commit into from

Conversation

endrift
Copy link
Contributor

@endrift endrift commented Apr 30, 2016

Fixes ea-vp6 on Nvidia (at least on OS X). Also a terrible hack. Probably breaks a lot of stuff. I'm mostly posting this to see how much fifoci complains, and also to try and spur conversation about how to actually fix it.


This change is Reviewable

@JMC47
Copy link
Contributor

JMC47 commented Apr 30, 2016

I've been testing this and it doesn't seem to break anything. It only fixes a bunch of weird video problems. Excite Truck and EA VP6, for instance.

@JMC47
Copy link
Contributor

JMC47 commented Apr 30, 2016

We may need to change the tag to "merge immediately." I mean, what's one more epsilon hack?

@mimimi085181
Copy link
Contributor

@JMC47: Take another look at:
https://fifoci.dolphin-emu.org/compare/1500812-1497673/

I'd say that looks bad. The question is if it's a fifo log issue, or if it's as bad when playing the game. (or if it's even proper emulation...)

@JMC47
Copy link
Contributor

JMC47 commented Apr 30, 2016

Twilight Princess is fine. It's a fifolog issue.

@endrift endrift changed the title [WIP] [DON'T MERGE] VideoCommon: Add epsilon to work around Nvidia rounding issue in texture lookup [WIP] VideoCommon: Add epsilon to work around Nvidia rounding issue in texture lookup May 2, 2016
@endrift
Copy link
Contributor Author

endrift commented May 2, 2016

Odd that this doesn't actually break anything. In that case, it might make sense to merge for 5.0 if we're feeling daring, but otherwise, we should fix it properly post-5.0 by integerizing texture lookups (e.g. with texelFetch)

@@ -836,7 +836,7 @@ static void WriteStage(T& out, pixel_shader_uid_data* uid_data, int n, API_TYPE
uid_data->SetTevindrefTexmap(i, texmap);

out.Write("\ttextemp = ");
SampleTexture<T>(out, "float2(tevcoord.xy)", texswap, texmap, ApiType);
SampleTexture<T>(out, "(float2(tevcoord.xy) + 0.05)", texswap, texmap, ApiType);

This comment was marked as off-topic.

This comment was marked as off-topic.

@Parlane Parlane added the WIP / do not merge Work in progress (do not merge) label May 3, 2016
@endrift
Copy link
Contributor Author

endrift commented Jun 27, 2016

Talked to @degasus about this in -dev, and while I think that going the integerization approach would be more correct, we agreed that it would be much slower, to the point of not being worthwhile. As such, an epsilon that's no more than 1/2 (according to degasus) or 1/4 (according to me, to avoid over-correcting the rounding), would be the fastest approach and might still give correct-enough results. An epsilon of 1/20 (what's in this patch) does appear to fix the issue (at least on Nvidia; haven't tried Intel), without noticeable ill effect, so this might be the "right enough" fix. I should probably try it on Intel, but I don't have anything newer than Ivy Bridge on Windows or Linux, (I have Haswell on my Mac and Skylake on my FreeBSD box, but the former is a proprietary driver and the latter doesn't have an IGP driver at all) which will hopefully be new enough to test on.

Any other opinions from GPU people?

@JMC47
Copy link
Contributor

JMC47 commented Jun 27, 2016

I'd rather have it working somewhat now. We have The Simpson's game to remind us that we need to do this perfectly.

@endrift
Copy link
Contributor Author

endrift commented Jun 27, 2016

Are we sure that The Simpson's game's bug is the same bug? I know that this epsilon patch fixed Excite Truck as well, but I thought it didn't affect anything else?

@JMC47
Copy link
Contributor

JMC47 commented Jun 27, 2016

I believe @magumagu could answer as he looked into it a long time ago? I'm 90% sure it's the same bug...

@magumagu
Copy link
Contributor

The Simpsons thing is very closely related; see magumagu@f96aab6 . That hack shoves the texture sampling coordinate 1/128 of a pixel the other way.

@endrift
Copy link
Contributor Author

endrift commented Jun 28, 2016

Is there a fifolog for the Simpsons bug? Which platforms does it affect?

@magumagu
Copy link
Contributor

See https://bugs.dolphin-emu.org/issues/4570 . All platforms, as far as I know. I think the simpsons dff on fifoci contains the issue; the server is acting up so I can't double-check.

@endrift
Copy link
Contributor Author

endrift commented Jun 28, 2016

I just updated to master, and upped the epsilon to 0.25, as discussed above.

@endrift
Copy link
Contributor Author

endrift commented Jun 28, 2016

@dolphin-emu-bot rebuild

1 similar comment
@JMC47
Copy link
Contributor

JMC47 commented Aug 16, 2016

@dolphin-emu-bot rebuild

@dolphin-emu-bot
Copy link
Contributor

FifoCI detected that this change impacts graphical rendering. Here are the behavior differences detected by the system:

  • ab11-homebrew on ogl-lin-nv: diff
  • aeon-charge-attack on ogl-lin-nv: diff
  • cel-damage-lighting on ogl-lin-nv: diff
  • chibi-robo-fastdepth on ogl-lin-nv: diff
  • chibi-robo-zfighting on ogl-lin-nv: diff
  • custom-brawl-char on ogl-lin-nv: diff
  • djfny-menu on ogl-lin-nv: diff
  • DKCR-Char on ogl-lin-nv: diff
  • DKCR-fast-depth on ogl-lin-nv: diff
  • ea-vp6 on ogl-lin-nv: diff
  • ed-updated on ogl-lin-nv: diff
  • et-vid on ogl-lin-nv: diff
  • fifa-street on ogl-lin-nv: diff
  • find-mii on ogl-lin-nv: diff
  • fishing-resort-map on ogl-lin-nv: diff
  • fortune-street on ogl-lin-nv: diff
  • fortune-street-fog on ogl-lin-nv: diff
  • fortune-street-white-box on ogl-lin-nv: diff
  • fsa-layers on ogl-lin-nv: diff
  • f-zero-rain on ogl-lin-nv: diff
  • goldeneye-depth on ogl-lin-nv: diff
  • hb-discgolf on ogl-lin-nv: diff
  • inverted-depth-range on ogl-lin-nv: diff
  • kirby-shadows on ogl-lin-nv: diff
  • last-story-shadows on ogl-lin-nv: diff
  • lego-star-wars-crane-shadow on ogl-lin-nv: diff
  • lesson08 on ogl-lin-nv: diff
  • luigi-shadows on ogl-lin-nv: diff
  • mario-baseball-shadows on ogl-lin-nv: diff
  • mario-sluggers-bar on ogl-lin-nv: diff
  • mario-tennis-menu on ogl-lin-nv: diff
  • MaS-LOG-wiimote on ogl-lin-nv: diff
  • medabots-crash on ogl-lin-nv: diff
  • megaman-heat on ogl-lin-nv: diff
  • melee-depth on ogl-lin-nv: diff
  • melee-lighting on ogl-lin-nv: diff
  • metroid-visor on ogl-lin-nv: diff
  • mii-channel on ogl-lin-nv: diff
  • milotic-texture on ogl-lin-nv: diff
  • mini-ninjas on ogl-lin-nv: diff
  • mkdd-babypark on ogl-lin-nv: diff
  • mkdd-efb on ogl-lin-nv: diff
  • mkwii-bluebox on ogl-lin-nv: diff
  • monkeyball-fuse on ogl-lin-nv: diff
  • mp3-bloom on ogl-lin-nv: diff
  • mp7-text on ogl-lin-nv: diff
  • mtennis-zfreeze on ogl-lin-nv: diff
  • my-word-coach on ogl-lin-nv: diff
  • nddemo-bumpmapping on ogl-lin-nv: diff
  • nddemo-lighting on ogl-lin-nv: diff
  • nfsu-purplerect on ogl-lin-nv: diff
  • nfsu-reflections on ogl-lin-nv: diff
  • nsmbw-coins on ogl-lin-nv: diff
  • nsmbw-intro on ogl-lin-nv: diff
  • pm-hc-jp on ogl-lin-nv: diff
  • pw-black-bars on ogl-lin-nv: diff
  • rs2-bumpmapping on ogl-lin-nv: diff
  • rs2-glass on ogl-lin-nv: diff
  • rs2-skybox on ogl-lin-nv: diff
  • rs2-zfreeze on ogl-lin-nv: diff
  • rs3-bumpmapping on ogl-lin-nv: diff
  • sadx-ui on ogl-lin-nv: diff
  • sfa-shadows on ogl-lin-nv: diff
  • sf-assault-flashing on ogl-lin-nv: diff
  • simpsons-game on ogl-lin-nv: diff
  • smg2-fog on ogl-lin-nv: diff
  • smg-marioeyes on ogl-lin-nv: diff
  • sms-bubbles on ogl-lin-nv: diff
  • sms-gc on ogl-lin-nv: diff
  • sms-water on ogl-lin-nv: diff
  • soa-black on ogl-lin-nv: diff
  • soniccolors-mm on ogl-lin-nv: diff
  • sonic-riders-blur on ogl-lin-nv: diff
  • sonicriderszg-gb on ogl-lin-nv: diff
  • spyro-bloom on ogl-lin-nv: diff
  • spyro-depth on ogl-lin-nv: diff
  • ssbb-mod-lloyd on ogl-lin-nv: diff
  • ssbm-pointsize on ogl-lin-nv: diff
  • ss-map on ogl-lin-nv: diff
  • ss-timestone on ogl-lin-nv: diff
  • super-sluggers-white-out on ogl-lin-nv: diff
  • sw3-dt on ogl-lin-nv: diff
  • taiko-depth on ogl-lin-nv: diff
  • thps3-earlyz on ogl-lin-nv: diff
  • thps4-shadow on ogl-lin-nv: diff
  • tla-menu on ogl-lin-nv: diff
  • tos-invis-char on ogl-lin-nv: diff
  • tsp3-pinkgrass on ogl-lin-nv: diff
  • vegas-party-depth on ogl-lin-nv: diff
  • xenoblade-menu on ogl-lin-nv: diff
  • ztp-grass on ogl-lin-nv: diff
  • zww-armos on ogl-lin-nv: diff
  • zww-water on ogl-lin-nv: diff
  • zww-waves on ogl-lin-nv: diff

automated-fifoci-reporter

@RisingFog
Copy link
Member

Any progress on this PR?

@endrift
Copy link
Contributor Author

endrift commented Sep 16, 2016

I believe there was another PR relating to this sort of thing that wasn't an epsilon hack, but I don't know where it is or if it got merged.

@JMC47
Copy link
Contributor

JMC47 commented Oct 5, 2016

I think it got abandoned. @degasus is this worth pursuing so we can make EA games look less broken on NVIDIA for a while?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WIP / do not merge Work in progress (do not merge)
9 participants