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

Implement EFB pokes in the OpenGL backend. #167

Merged
merged 1 commit into from Mar 20, 2014

Conversation

neobrain
Copy link
Member

EFB pokes are a hardware feature used in a very small number of games to directly write data to the framebuffer from the CPU.

The feature has been emulated in the D3D backend for ages, but the code wasn't moved over to OpenGL until now. The algorithm in OpenGL uses clears instead of drawing little quads, which might be slightly faster (or not) than drawing 1x1 pixel quads, but surely the code is fairly clean. This code path is pretty much a "meh, if games use this we have a problem anyway" thing, so performance is not really a problem anyway.

This code was tested briefly and shown to work, I'll test it further against games known to use EFB pokes (Monster Hunter Tri, the GC Mario soccer game) before merging. Meanwhile, people can comment on the patch :)

A possibly important consequence of this patch is that games which make extensive use of EFB pokes (Monster Hunter Tri, and under very certain circumstances Mario Kart Wii) will get ridiculously slow. EFB pokes should probably be queued as an optimization. I'm not interested in coding this optimization though, especially since it's general enough for someone else to do. Regardless, as a workaround EFB accesses can be skipped to make things work fast (without the EFB pokes being accepted, of course).

@delroth
Copy link
Member

delroth commented Mar 14, 2014

Haven't tested, but code LGTM.

@Sonicadvance1
Copy link
Contributor

There is a good chance that something like this will demolish performance on Mali and Adreno due to stupidity in the drivers.
I'll have to test and find out. Might be hard with the TFN merge now though.

@degasus
Copy link
Member

degasus commented Mar 16, 2014

LGTM, but I'd prefer quads because of performance changes. glClear might use a faster code path on the 2d acceleration hardware, but this is only faster per pixel. For small rects, the per pixel performance doesn't matter but the huge cpu overhead does.

nvm, thx for implementing this feature and I'll change them to quads when someone reports this to be slow.

@degasus
Copy link
Member

degasus commented Mar 16, 2014

Btw, about this queuing optimization, this should be done after moving efb cache into videocommon. So this queue could also be there.

Sonicadvance1 added a commit that referenced this pull request Mar 20, 2014
Implement EFB pokes in the OpenGL backend.
@Sonicadvance1 Sonicadvance1 merged commit 89efec6 into dolphin-emu:master Mar 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants