mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Effect: glFlush instead of glFinish on tex output
This is much faster (~2-3x) than glFlush. While there's a risk that GL commands queued to the GL server may not be complete by the time non-GL commands access the texture, this should be unlikely as we only access the texture from GL. PiperOrigin-RevId: 527641520
This commit is contained in:
parent
655c727043
commit
5c02210305
1 changed files with 7 additions and 1 deletions
|
|
@ -360,7 +360,13 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||||
outputTexture.fboId, outputTexture.width, outputTexture.height);
|
outputTexture.fboId, outputTexture.width, outputTexture.height);
|
||||||
GlUtil.clearOutputFrame();
|
GlUtil.clearOutputFrame();
|
||||||
checkNotNull(defaultShaderProgram).drawFrame(inputTexture.texId, presentationTimeUs);
|
checkNotNull(defaultShaderProgram).drawFrame(inputTexture.texId, presentationTimeUs);
|
||||||
GLES20.glFinish();
|
|
||||||
|
// glFlush is used here instead of glFinish due to the performance regression that blocking this
|
||||||
|
// thread would do when calling glFinish. As glFlush is non-blocking, it's possible that non-GL
|
||||||
|
// access to the output texture may read stale data (ex. from the prior frame). If we see issues
|
||||||
|
// (ex. flakiness) from glFlush, consider requiring apps reading the texture to call glFinish,
|
||||||
|
// or reconsider using glFinish here.
|
||||||
|
GLES20.glFlush();
|
||||||
checkNotNull(textureOutputListener).onTextureRendered(outputTexture, presentationTimeUs);
|
checkNotNull(textureOutputListener).onTextureRendered(outputTexture, presentationTimeUs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue