|
|
|
@ -103,7 +103,7 @@ static void MortonCopyPixels(CachedSurface::PixelFormat pixel_format, u32 width,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool RasterizerCacheOpenGL::BlitTextures(GLuint src_tex, GLuint dst_tex,
|
|
|
|
|
void RasterizerCacheOpenGL::BlitTextures(GLuint src_tex, GLuint dst_tex,
|
|
|
|
|
CachedSurface::SurfaceType type,
|
|
|
|
|
const MathUtil::Rectangle<int>& src_rect,
|
|
|
|
|
const MathUtil::Rectangle<int>& dst_rect) {
|
|
|
|
@ -158,21 +158,14 @@ bool RasterizerCacheOpenGL::BlitTextures(GLuint src_tex, GLuint dst_tex,
|
|
|
|
|
buffers = GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool can_blit = OpenGLState::CheckFBStatus(GL_READ_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE &&
|
|
|
|
|
OpenGLState::CheckFBStatus(GL_DRAW_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE;
|
|
|
|
|
|
|
|
|
|
if (can_blit) {
|
|
|
|
|
glBlitFramebuffer(src_rect.left, src_rect.top, src_rect.right, src_rect.bottom,
|
|
|
|
|
dst_rect.left, dst_rect.top, dst_rect.right, dst_rect.bottom, buffers,
|
|
|
|
|
buffers == GL_COLOR_BUFFER_BIT ? GL_LINEAR : GL_NEAREST);
|
|
|
|
|
}
|
|
|
|
|
glBlitFramebuffer(src_rect.left, src_rect.top, src_rect.right, src_rect.bottom, dst_rect.left,
|
|
|
|
|
dst_rect.top, dst_rect.right, dst_rect.bottom, buffers,
|
|
|
|
|
buffers == GL_COLOR_BUFFER_BIT ? GL_LINEAR : GL_NEAREST);
|
|
|
|
|
|
|
|
|
|
// Restore previous framebuffer bindings
|
|
|
|
|
cur_state.draw.read_framebuffer = old_fbs[0];
|
|
|
|
|
cur_state.draw.draw_framebuffer = old_fbs[1];
|
|
|
|
|
cur_state.Apply();
|
|
|
|
|
|
|
|
|
|
return can_blit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool RasterizerCacheOpenGL::TryBlitSurfaces(CachedSurface* src_surface,
|
|
|
|
@ -186,9 +179,9 @@ bool RasterizerCacheOpenGL::TryBlitSurfaces(CachedSurface* src_surface,
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return BlitTextures(src_surface->texture.handle, dst_surface->texture.handle,
|
|
|
|
|
CachedSurface::GetFormatType(src_surface->pixel_format), src_rect,
|
|
|
|
|
dst_rect);
|
|
|
|
|
BlitTextures(src_surface->texture.handle, dst_surface->texture.handle,
|
|
|
|
|
CachedSurface::GetFormatType(src_surface->pixel_format), src_rect, dst_rect);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void AllocateSurfaceTexture(GLuint texture, CachedSurface::PixelFormat pixel_format,
|
|
|
|
|