Merge branch 'master' of github.com:ancurio/mkxp

This commit is contained in:
Jonas Kulla 2017-05-11 12:53:12 +02:00
commit 91f042197b
1 changed files with 15 additions and 29 deletions

View File

@ -92,11 +92,9 @@ struct PingPong
{ {
screenW = width; screenW = width;
screenH = height; screenH = height;
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
{ TEXFBO::allocEmpty(rt[i], width, height);
TEX::bind(rt[i].tex);
TEX::allocEmpty(width, height);
}
} }
void startRender() void startRender()
@ -476,9 +474,7 @@ struct GraphicsPrivate
bool frozen; bool frozen;
TEXFBO frozenScene; TEXFBO frozenScene;
TEXFBO currentScene;
Quad screenQuad; Quad screenQuad;
TEXFBO transBuffer;
/* Global list of all live Disposables /* Global list of all live Disposables
* (disposed on reset) */ * (disposed on reset) */
@ -504,26 +500,15 @@ struct GraphicsPrivate
TEXFBO::allocEmpty(frozenScene, scRes.x, scRes.y); TEXFBO::allocEmpty(frozenScene, scRes.x, scRes.y);
TEXFBO::linkFBO(frozenScene); TEXFBO::linkFBO(frozenScene);
TEXFBO::init(currentScene);
TEXFBO::allocEmpty(currentScene, scRes.x, scRes.y);
TEXFBO::linkFBO(currentScene);
FloatRect screenRect(0, 0, scRes.x, scRes.y); FloatRect screenRect(0, 0, scRes.x, scRes.y);
screenQuad.setTexPosRect(screenRect, screenRect); screenQuad.setTexPosRect(screenRect, screenRect);
TEXFBO::init(transBuffer);
TEXFBO::allocEmpty(transBuffer, scRes.x, scRes.y);
TEXFBO::linkFBO(transBuffer);
fpsLimiter.resetFrameAdjust(); fpsLimiter.resetFrameAdjust();
} }
~GraphicsPrivate() ~GraphicsPrivate()
{ {
TEXFBO::fini(frozenScene); TEXFBO::fini(frozenScene);
TEXFBO::fini(currentScene);
TEXFBO::fini(transBuffer);
} }
void updateScreenResoRatio(RGSSThreadData *rtData) void updateScreenResoRatio(RGSSThreadData *rtData)
@ -729,8 +714,15 @@ void Graphics::transition(int duration,
setBrightness(255); setBrightness(255);
/* The PP frontbuffer will hold the current scene after the
* composition step. Since the backbuffer is unused during
* the transition, we can reuse it as the target buffer for
* the final rendered image. */
TEXFBO &currentScene = p->screen.getPP().frontBuffer();
TEXFBO &transBuffer = p->screen.getPP().backBuffer();
/* Capture new scene */ /* Capture new scene */
p->compositeToBuffer(p->currentScene); p->screen.composite();
/* If no transition bitmap is provided, /* If no transition bitmap is provided,
* we can use a simplified shader */ * we can use a simplified shader */
@ -743,7 +735,7 @@ void Graphics::transition(int duration,
shader.bind(); shader.bind();
shader.applyViewportProj(); shader.applyViewportProj();
shader.setFrozenScene(p->frozenScene.tex); shader.setFrozenScene(p->frozenScene.tex);
shader.setCurrentScene(p->currentScene.tex); shader.setCurrentScene(currentScene.tex);
shader.setTransMap(transMap->getGLTypes().tex); shader.setTransMap(transMap->getGLTypes().tex);
shader.setVague(vague / 256.0f); shader.setVague(vague / 256.0f);
shader.setTexSize(p->scRes); shader.setTexSize(p->scRes);
@ -754,7 +746,7 @@ void Graphics::transition(int duration,
shader.bind(); shader.bind();
shader.applyViewportProj(); shader.applyViewportProj();
shader.setFrozenScene(p->frozenScene.tex); shader.setFrozenScene(p->frozenScene.tex);
shader.setCurrentScene(p->currentScene.tex); shader.setCurrentScene(currentScene.tex);
shader.setTexSize(p->scRes); shader.setTexSize(p->scRes);
} }
@ -798,7 +790,7 @@ void Graphics::transition(int duration,
/* Draw the composed frame to a buffer first /* Draw the composed frame to a buffer first
* (we need this because we're skipping PingPong) */ * (we need this because we're skipping PingPong) */
FBO::bind(p->transBuffer.fbo); FBO::bind(transBuffer.fbo);
FBO::clear(); FBO::clear();
p->screenQuad.draw(); p->screenQuad.draw();
@ -809,7 +801,7 @@ void Graphics::transition(int duration,
FBO::clear(); FBO::clear();
GLMeta::blitBeginScreen(Vec2i(p->winSize)); GLMeta::blitBeginScreen(Vec2i(p->winSize));
GLMeta::blitSource(p->transBuffer); GLMeta::blitSource(transBuffer);
p->metaBlitBufferFlippedScaled(); p->metaBlitBufferFlippedScaled();
GLMeta::blitEnd(); GLMeta::blitEnd();
@ -952,17 +944,11 @@ void Graphics::resizeScreen(int width, int height)
p->screen.setResolution(width, height); p->screen.setResolution(width, height);
TEX::bind(p->frozenScene.tex); TEXFBO::allocEmpty(p->frozenScene, width, height);
TEX::allocEmpty(width, height);
TEX::bind(p->currentScene.tex);
TEX::allocEmpty(width, height);
FloatRect screenRect(0, 0, width, height); FloatRect screenRect(0, 0, width, height);
p->screenQuad.setTexPosRect(screenRect, screenRect); p->screenQuad.setTexPosRect(screenRect, screenRect);
TEX::bind(p->transBuffer.tex);
TEX::allocEmpty(width, height);
shState->eThread().requestWindowResize(width, height); shState->eThread().requestWindowResize(width, height);
} }