Implement EFB pokes in the OpenGL backend. #167
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
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).