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

D3D: Depth range inversion. #2448

Merged
merged 2 commits into from
May 26, 2015
Merged

Conversation

CrossVR
Copy link
Contributor

@CrossVR CrossVR commented May 24, 2015

Credits go to @galop1n for designing this technique and to @BhaaLseN for cleaning up the commit.

This makes FastDepth accurate for D3D together with PR #2419 for OGL. After both PRs have been merged we can remove FastDepth as an option (forcing it on) and concentrate on fixing bugs with accurate depth buffers.

If you're interested in how this equation works you can read the derivation in section 5 of the depth equations.

@galop1n
Copy link
Contributor

galop1n commented May 24, 2015 via email

@CrossVR
Copy link
Contributor Author

CrossVR commented May 24, 2015

@galop1n SlowDepth became console accurate after we changed the depth divisor to a power-of-two. Now your technique gets rid of the last floating point rounding error to make FastDepth console accurate, good job.

Do you want me to change the author of the commit, since it's based on your code?

@galop1n
Copy link
Contributor

galop1n commented May 24, 2015

Hehe thanks, i always hate the "fast depth" option as there was no reason
for it to not work in the first place, and writing depth kill early depth
test.

I have some good plans for when coming back to dolphin, like a dx12
version. But i would probably not be able to save time to work on it until
black op 3 is out !
On May 24, 2015 7:31 AM, "Jules Blok" notifications@github.com wrote:

@galop1n https://github.com/Galop1n After we changed the divisor of the
depth to a power-of-two SlowDepth became console accurate. Now your
technique gets rid of the last floating point rounding error to make
FastDepth console accurate, good job.


Reply to this email directly or view it on GitHub
#2448 (comment).

@CrossVR
Copy link
Contributor Author

CrossVR commented May 24, 2015

@galop1n I had a look at DirectX12 this morning, it should lower the overhead a bit since state tracking will become our responsibility (we already do so). But isn't the real advantage in having multiple threads assemble command lists and adding those to the command queue? It'll be difficult to take advantage of that in Dolphin.

@galop1n
Copy link
Contributor

galop1n commented May 24, 2015

The ability ( and duty ) of fencing ourself memory usage should help a bit
to improve the cpu read back and other patterns not pc friendly of the
unified wii memory.
On May 24, 2015 8:09 AM, "Jules Blok" notifications@github.com wrote:

@galop1n https://github.com/galop1n I had a look at DirectX12 this
morning, it should lower the overhead a bit since state tracking will
become our responsibility (which we already do so). But isn't the real
advantage having multiple thread assemble commands and add those to the
queue? It'll be difficult to take advantage of that in Dolphin.


Reply to this email directly or view it on GitHub
#2448 (comment).

@CrossVR
Copy link
Contributor Author

CrossVR commented May 24, 2015

Ah, I didn't take a look at the memory management yet, that looks very relevant indeed.

@CrossVR
Copy link
Contributor Author

CrossVR commented May 24, 2015

@galop1n Btw, you probably wrote your code before we were preparing to change the license. All new contributions are done under the GPLv2+ license, meaning your code is automatically also licensed under GPLv3. Are you okay with that?

@CrossVR CrossVR force-pushed the depth-inversion branch 4 times, most recently from de7652d to e36be98 Compare May 24, 2015 22:44
@JMC47
Copy link
Contributor

JMC47 commented May 26, 2015

He already gave permission for this to be put into Dolphin I thought? This was in his old PR, and he responded positively in the licensing sheet.

@purpasmart96
Copy link

Can't believe it's almost been a year since galop1n implemented it. yeah this would be really nice. Fast depth is a nice perform boost.


WRITE(p, " depth = clamp(depth * 16777216.0, 0.0, float(0xFFFFFF));\n");
WRITE(p, " depth *= 16777216.0;\n");

This comment was marked as off-topic.

@@ -150,12 +150,12 @@ const char depth_matrix_program[] = {

This comment was marked as off-topic.

This comment was marked as off-topic.

galop1n and others added 2 commits May 26, 2015 15:31
Credits go to Galop1n for designing this technique and to BhaaLseN for cleaning up the commit.
@degasus
Copy link
Member

degasus commented May 26, 2015

LGTM

CrossVR added a commit that referenced this pull request May 26, 2015
@CrossVR CrossVR merged commit 0b61a0d into dolphin-emu:master May 26, 2015
@CrossVR CrossVR deleted the depth-inversion branch May 26, 2015 13:39
@dolphin-emu-bot
Copy link
Contributor

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

  • chibi-robo-fastdepth on dx-win-nv: diff
  • chibi-robo-zfighting on dx-win-nv: diff
  • ed-lighting on dx-win-nv: diff
  • fifa-street on dx-win-nv: diff
  • fortune-street on dx-win-nv: diff
  • fortune-street-fog on dx-win-nv: diff
  • fortune-street-white-box on dx-win-nv: diff
  • kirby-shadows on dx-win-nv: diff
  • line-width-test on dx-win-nv: failed to render
  • luigi-shadows on dx-win-nv: diff
  • mario-sluggers-bar on dx-win-nv: diff
  • mario-tennis-menu on dx-win-nv: diff
  • megaman-heat on dx-win-nv: diff
  • melee-lighting on dx-win-nv: diff
  • mii-channel on dx-win-nv: diff
  • mini-ninjas on dx-win-nv: diff
  • mkdd-efb on dx-win-nv: diff
  • mkwii-bluebox on dx-win-nv: diff
  • monkeyball-fuse on dx-win-nv: diff
  • mtennis-zfreeze on dx-win-nv: diff
  • my-word-coach on dx-win-nv: diff
  • nfsu-reflections on dx-win-nv: diff
  • nsmbw-intro on dx-win-nv: diff
  • rs2-glass on dx-win-nv: diff
  • rs2-zfreeze on dx-win-nv: diff
  • sadx-ui on dx-win-nv: diff
  • sf-assault-flashing on dx-win-nv: diff
  • simpsons-tev on dx-win-nv: diff
  • smg2-fog on dx-win-nv: diff
  • sms-bubbles on dx-win-nv: diff
  • soa-black on dx-win-nv: diff
  • ssbm-pointsize on dx-win-nv: diff
  • ss-timestone on dx-win-nv: diff
  • thps4-shadow on dx-win-nv: diff
  • tos-invis-char on dx-win-nv: diff
  • tsp3-pinkgrass on dx-win-nv: diff
  • xenoblade-menu on dx-win-nv: diff
  • ztp-grass on dx-win-nv: diff
  • zww-armos on dx-win-nv: diff
  • zww-water on dx-win-nv: diff
  • zww-waves on dx-win-nv: diff

automated-fifoci-reporter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants