Skip to content

Build each rendering phase's GL debug group name once, not on every setPhase - #871

Open
BonsUnleashed wants to merge 1 commit into
Asek3:1.20.1-newfrom
BonsUnleashed:bons-furious/oculus-phase-labels
Open

BonsUnleashed wants to merge 1 commit into
Asek3:1.20.1-newfrom
BonsUnleashed:bons-furious/oculus-phase-labels

Conversation

@BonsUnleashed

Copy link
Copy Markdown

IrisRenderingPipeline.setPhase builds the GL debug group name on every call: StringUtils.capitalize of the lower-cased phase name with the underscores replaced. The phase changes each time an entity or block entity render type is drawn, and for particles, terrain layers and the sky, so in a busy scene the same few strings were rebuilt and discarded hundreds of times per frame, whether or not GL debug output was on.

Now each WorldRenderingPhase constant builds its name once, with the same expression, and setPhase reads it through getDebugName(). All 24 names equal what the old expression returns, and the pop, the push with phase.ordinal() and the phase field write stay in the same order. The two imports setPhase no longer needs are removed. It does not touch the files of #869 or #870.

The same change ships as a patch for Oculus 1.8.0 in Bons and Furious (since 1.0.21); timed outside the game with the real WorldRenderingPhase, the name went from about 32 ns to about 1.4 ns per phase change, and setPhase was 0.14% and 0.06% of the render thread in two profiles of a large Forge pack, nearly all of it this expression.

Compiles on 1.20.1-new (compileJava compileSodiumCompatibilityJava). Not tested in game on this branch.

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.

1 participant