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

add an optional, less-accurate-but-faster sprite render and fix silly math bug #1102

Merged
merged 6 commits into from
Jan 22, 2022

Conversation

water111
Copy link
Collaborator

It's off by default, but you can pick it (sprite-3) with:
image

It does a few tricks to be faster:

  • It reorders all sprite draws to be per-draw mode. This cuts the draw count down a lot. For example, in village 2 near the waterfall there's a spot where you can get around 270 draws with the old and this does 7. It improves frame time from about 7.3 ms to 4.0 ms. (This is a particularly good example, and most of the time the difference is smaller.)
  • It uses an index buffer and draws triangle strips. This reduces the number of uploaded vertices, and copying of them from buckets to buffers (you only have to copy indices from the buckets, not entire vertices).
  • It uses a more accurate blending mode (the "double draw") for HUD, so the green eco HUD looks right.

But has some disadvantages:

  • It doesn't have the fancy multiple-texture trick. If we did this right, we could probably reduce the draw count even more.
  • It sorts the sprite draws by their draw mode "key". The developers didn't really have control over sprite draw order, so they got a random order. In some cases, having a non-random ordering looks a bit different (see the waterfall). But, in my opinion, if your computer wasn't fast enough to run the normal sprite renderer, you'd be happier with the slightly wrong sprites than running at <60 fps.

@coveralls
Copy link

coveralls commented Jan 22, 2022

Pull Request Test Coverage Report for Build 1731688309

  • 63 of 509 (12.38%) changed or added relevant lines in 22 files are covered.
  • 8 unchanged lines in 5 files lost coverage.
  • Overall coverage decreased (-0.2%) to 50.116%

Changes Missing Coverage Covered Lines Changed/Added Lines %
game/graphics/opengl_renderer/Shader.cpp 0 1 0.0%
game/graphics/opengl_renderer/Sprite3.h 0 1 0.0%
game/graphics/opengl_renderer/tfrag/Tfrag3.cpp 0 1 0.0%
game/kernel/kscheme.cpp 0 1 0.0%
game/runtime.cpp 1 2 50.0%
goalc/compiler/Env.cpp 15 16 93.75%
common/type_system/TypeSystem.cpp 0 2 0.0%
common/type_system/deftype.cpp 4 6 66.67%
game/graphics/opengl_renderer/tfrag/Tie3.cpp 0 2 0.0%
game/kernel/klink.cpp 7 9 77.78%
Files with Coverage Reduction New Missed Lines %
common/dma/gs.h 1 0%
game/graphics/opengl_renderer/BucketRenderer.cpp 1 0%
game/graphics/opengl_renderer/Shader.cpp 1 0%
game/graphics/opengl_renderer/tfrag/tfrag_common.cpp 2 0%
goalc/listener/Listener.cpp 3 84.23%
Totals Coverage Status
Change from base Build 1721793615: -0.2%
Covered Lines: 41149
Relevant Lines: 82108

💛 - Coveralls

@water111 water111 merged commit 35bdc9b into master Jan 22, 2022
@water111 water111 deleted the w/rider-bugs branch January 22, 2022 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants