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

Render UI and multiple sheets without breaking the batch. #15194

Merged
merged 6 commits into from Jun 4, 2018

Conversation

Projects
None yet
8 participants
@pchote
Copy link
Member

pchote commented May 31, 2018

This PR follows on from #15149 by merging RGBA sprite rendering into the same shader as normal sprites and colors, and then takes a much more dramatic step for reducing batch breakage by managing 8 parallel texture bindings (limited by our minspec gfx target).

This gives a significant performance win for the UI, especially in the lobby where we are constantly switching between rendering images and text. This also helps a lot in TS, where the ingame sprites don't fit within a single sheet.

This also disables the requirement that depth sprites must live on the same sheet as the sprite it is attached to, which simplifies our sequence and sprite building code.

Some numbers from my laptop, with #15177 disabled in order to disambiguate the render times from tick:

Testcase Bleed This PR
TS Shellmap ~18-20ms, 220 batches ~5-6ms, 35 batches
TS lobby (Drawbridges map) ~29-30ms, 315 batches ~6-7ms, 38 batches
RA map selector ~14-15ms, 210 batches ~4-5ms, 11 batches

pchote added some commits May 31, 2018

Merge RGBA sprite rendering into SpriteRenderer.
Renderer.RgbaSpriteRenderer is kept as a thin
wrapper to maintain compatibility with consumer
code.

@pchote pchote added this to the Next release milestone May 31, 2018

@pchote pchote referenced this pull request May 31, 2018

Merged

Rendering Thread #15177

@pchote pchote requested a review from chrisforbes May 31, 2018

@pchote pchote force-pushed the pchote:moar-gfx-perf branch 3 times, most recently from 8d803c5 to a0b7329 May 31, 2018

@pchote pchote force-pushed the pchote:moar-gfx-perf branch from a0b7329 to 2144d41 May 31, 2018

@GraionDilach

This comment has been minimized.

Copy link
Contributor

GraionDilach commented Jun 1, 2018

This also disables the requirement that depth sprites must live on the same sheet as the sprite it is attached to, which simplifies our sequence and sprite building code.

Pinging @ABrandau for interest.

@GraionDilach

This comment has been minimized.

Copy link
Contributor

GraionDilach commented Jun 1, 2018

Care to elaborate on that minspec gfx target limit - asin where that limit comes from? Is it from the OpenGL specification?

@pchote

This comment has been minimized.

Copy link
Member Author

pchote commented Jun 1, 2018

8 comes from the Raspberry Pi, which is my main motivation for working on these optimizations right now. Pretty much all proper hardware that we care about support between 16 and 192 units [ref].

@Sininini

This comment has been minimized.

Copy link

Sininini commented Jun 1, 2018

Looks like a major improvement, thanks a lot! Also thanks to RoosterDragon for the separate render thread as well.

@MunWolf

This comment has been minimized.

Copy link
Contributor

MunWolf commented Jun 1, 2018

@pchote You could try and query OpenGL how many it supports so you can try to lift the number of sheets higher then 8.
Not sure how important it is for performance, depends mostly on how many textures we have, are we sorting them before rendering etc.

C equivalent glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &texture_units);

@pchote

This comment has been minimized.

Copy link
Member Author

pchote commented Jun 1, 2018

That would require dynamically writing the shader at runtime to support the different options. Possible, sure, but adds a lot of complexity with no clear gain. 8 sheets is enough for the default mods (including TS).

@GraionDilach

This comment has been minimized.

Copy link
Contributor

GraionDilach commented Jun 1, 2018

I was asking out of interest alone, even 8 textures are more than 1 and any improvement is better over no improvement afterall. Thanks for the list, it was really interesting to look at.

@chrisforbes

This comment has been minimized.

Copy link
Member

chrisforbes commented Jun 1, 2018

Nak to dynamic array size tricks. Working my way through the actual change now.

@ltem ltem added the PR: Needs +2 label Jun 3, 2018

@reaperrr
Copy link
Contributor

reaperrr left a comment

Don't know if you changed something major since the earlier revision I tested, but batch reduction and and worst-case render ticks improved by another order of magnitude since then 👍 Didn't come across any issues, either 👍

@reaperrr reaperrr merged commit 8461a82 into OpenRA:bleed Jun 4, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@ABrandau

This comment has been minimized.

Copy link
Contributor

ABrandau commented Jun 18, 2018

I updated my mods yesterday, and I want to share the results.

On Shattered Paradise the amount of batches reduced from 300 when zooming out a map to 30, on the earlier version the amount of batches would increase with less zoom, but this is not the case anymore, so it remains around 30 all the time. I will hand the build to an user who didnt had a high end PC to see if there are any improvements when playing.

On Nomad Galaxy the perf improvement isnt that noticeable because there isnt much content, but one thing that calls my attention is that my laptop ventilator isnt running at full speed when testing anymore, thats a nice change, thanks.

@pchote pchote deleted the pchote:moar-gfx-perf branch Jul 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.