mirror of
https://github.com/libretro/ppsspp.git
synced 2025-03-01 21:26:19 +00:00
Merge pull request #8467 from unknownbrackets/gpu-depth
Blit depth when current, not max, size matches
This commit is contained in:
commit
c0954d7218
@ -773,10 +773,11 @@ void FramebufferManager::ReformatFramebufferFrom(VirtualFramebuffer *vfb, GEBuff
|
||||
}
|
||||
|
||||
void FramebufferManager::BlitFramebufferDepth(VirtualFramebuffer *src, VirtualFramebuffer *dst) {
|
||||
if (src->z_address == dst->z_address &&
|
||||
src->z_stride != 0 && dst->z_stride != 0 &&
|
||||
src->renderWidth == dst->renderWidth &&
|
||||
src->renderHeight == dst->renderHeight) {
|
||||
bool matchingDepthBuffer = src->z_address == dst->z_address && src->z_stride != 0 && dst->z_stride != 0;
|
||||
bool matchingSize = src->width == dst->width && src->height == dst->height;
|
||||
if (matchingDepthBuffer && matchingSize) {
|
||||
int w = std::min(src->renderWidth, dst->renderWidth);
|
||||
int h = std::min(src->renderHeight, dst->renderHeight);
|
||||
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_ARB_FRAMEBUFFER_BLIT | GPU_SUPPORTS_NV_FRAMEBUFFER_BLIT)) {
|
||||
// Only use NV if ARB isn't supported.
|
||||
@ -788,10 +789,10 @@ void FramebufferManager::BlitFramebufferDepth(VirtualFramebuffer *src, VirtualFr
|
||||
|
||||
if (useNV) {
|
||||
#if defined(USING_GLES2) && defined(ANDROID) // We only support this extension on Android, it's not even available on PC.
|
||||
glBlitFramebufferNV(0, 0, src->renderWidth, src->renderHeight, 0, 0, dst->renderWidth, dst->renderHeight, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
|
||||
glBlitFramebufferNV(0, 0, w, h, 0, 0, w, h, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
|
||||
#endif // defined(USING_GLES2) && defined(ANDROID)
|
||||
} else {
|
||||
glBlitFramebuffer(0, 0, src->renderWidth, src->renderHeight, 0, 0, dst->renderWidth, dst->renderHeight, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
|
||||
glBlitFramebuffer(0, 0, w, h, 0, 0, w, h, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
|
||||
}
|
||||
// If we set dst->depthUpdated here, our optimization above would be pointless.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user