mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-28 00:33:34 +01:00
Duplicate framebuffers textured onto themselves.
This fixes #2917. I verified that, at least for my card, blitting is much faster than glReadPixels (by quite a margin.)
This commit is contained in:
1 parent
60cf5df571
commit
b48de952fd
5 files changed
+64
-20
No files matched your search
@@ -305,7 +305,8 @@ FramebufferManager::FramebufferManager() :
|
||||
shaderManager_(0),
|
||||
usePostShader_(false),
|
||||
postShaderAtOutputResolution_(false),
|
||||
resized_(false)
|
||||
resized_(false),
|
||||
renderCopy_(0)
|
||||
#ifndef USING_GLES2
|
||||
,
|
||||
pixelBufObj_(0),
|
||||
@@ -907,6 +908,7 @@ void FramebufferManager::BindFramebufferDepth(VirtualFramebuffer *sourceframebuf
|
||||
if (MaskedEqual(sourceframebuffer->z_address, targetframebuffer->z_address) &&
|
||||
sourceframebuffer->renderWidth == targetframebuffer->renderWidth &&
|
||||
sourceframebuffer->renderHeight == targetframebuffer->renderHeight) {
|
||||
|
||||
#ifndef USING_GLES2
|
||||
if (gl_extensions.FBO_ARB) {
|
||||
#else
|
||||
@@ -922,7 +924,48 @@ void FramebufferManager::BindFramebufferDepth(VirtualFramebuffer *sourceframebuf
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FramebufferManager::BindFramebufferColor(VirtualFramebuffer *framebuffer) {
|
||||
if (!framebuffer->fbo || !useBufferedRendering_) {
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
gstate_c.skipDrawReason |= SKIPDRAW_BAD_FB_TEXTURE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (MaskedEqual(framebuffer->fb_address, gstate.getFrameBufRawAddress())) {
|
||||
#ifndef USING_GLES2
|
||||
if (gl_extensions.FBO_ARB) {
|
||||
#else
|
||||
if (gl_extensions.GLES3) {
|
||||
#endif
|
||||
#ifdef MAY_HAVE_GLES3
|
||||
|
||||
// TODO: Maybe merge with bvfbs_? Not sure if those could be packing, and they're created at a different size.
|
||||
if (!renderCopy_ || renderCopyWidth_ != framebuffer->renderWidth || renderCopyHeight_ != framebuffer->renderHeight) {
|
||||
if (renderCopy_)
|
||||
fbo_destroy(renderCopy_);
|
||||
renderCopy_ = fbo_create(framebuffer->renderWidth, framebuffer->renderHeight, 1, true, framebuffer->colorDepth);
|
||||
renderCopyWidth_ = framebuffer->renderWidth;
|
||||
renderCopyHeight_ = framebuffer->renderHeight;
|
||||
}
|
||||
|
||||
fbo_bind_as_render_target(renderCopy_);
|
||||
glViewport(0, 0, framebuffer->renderWidth, framebuffer->renderHeight);
|
||||
fbo_bind_for_read(framebuffer->fbo);
|
||||
glBlitFramebuffer(0, 0, framebuffer->renderWidth, framebuffer->renderHeight, 0, 0, framebuffer->renderWidth, framebuffer->renderHeight, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
|
||||
fbo_bind_as_render_target(currentRenderVfb_->fbo);
|
||||
if (gl_extensions.gpuVendor != GPU_VENDOR_POWERVR)
|
||||
glstate.viewport.restore();
|
||||
fbo_bind_color_as_texture(renderCopy_, 0);
|
||||
#endif
|
||||
} else {
|
||||
fbo_bind_color_as_texture(framebuffer->fbo, 0);
|
||||
}
|
||||
} else {
|
||||
fbo_bind_color_as_texture(framebuffer->fbo, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void FramebufferManager::CopyDisplayToOutput() {
|
||||
|
||||
Reference in new issue
Block a user