MYST3: Improve the node transition performance

On 4K displays, taking a screenshot and processing the pixels on the CPU
was taking a noticeable amount of time. Now the screenshot is copied
directly to a texture without going through the CPU.
This commit is contained in:
Bastien Bouclet 2019-11-08 14:50:20 +01:00
parent 93929be2c1
commit 056912f4b2
11 changed files with 99 additions and 27 deletions

View file

@ -249,6 +249,7 @@ void ShaderRenderer::drawTexturedRect2D(const Common::Rect &screenRect, const Co
_boxShader->setUniform("verSizeWH", scaled(sWidth, sHeight));
_boxShader->setUniform("texOffsetXY", Math::Vector2d(tLeft, tTop));
_boxShader->setUniform("texSizeWH", Math::Vector2d(tWidth, tHeight));
_boxShader->setUniform("flipY", glTexture->upsideDown);
glDepthMask(GL_FALSE);
@ -398,6 +399,15 @@ Graphics::Surface *ShaderRenderer::getScreenshot() {
return s;
}
Texture *ShaderRenderer::copyScreenshotToTexture() {
OpenGLTexture *texture = new OpenGLTexture();
Common::Rect screen = viewport();
texture->copyFromFramebuffer(screen);
return texture;
}
} // End of namespace Myst3
#endif