Cleanup of FBO+blit flags. Requires the change in native to stop lying.

This commit is contained in:
Henrik Rydgard 2015-09-05 22:40:45 +02:00
parent 5b2ffd1434
commit 186d624ef3
6 changed files with 24 additions and 34 deletions

View File

@ -408,7 +408,6 @@ struct GLExtensions {
bool OES_depth_texture;
bool EXT_discard_framebuffer;
bool FBO_ARB;
bool FBO_EXT;
};
extern GLExtensions gl_extensions;

View File

@ -818,24 +818,21 @@ void FramebufferManager::BlitFramebufferDepth(VirtualFramebuffer *src, VirtualFr
src->renderWidth == dst->renderWidth &&
src->renderHeight == dst->renderHeight) {
#ifndef USING_GLES2
if (gl_extensions.ARB_framebuffer_object) {
bool useNV = false;
#else
if (gl_extensions.GLES3 || gl_extensions.NV_framebuffer_blit) {
bool useNV = !gl_extensions.GLES3;
#endif
if (gstate_c.Supports(GPU_SUPPORTS_ARB_FRAMEBUFFER_BLIT | GPU_SUPPORTS_NV_FRAMEBUFFER_BLIT)) {
// Only use NV if ARB isn't supported.
bool useNV = !gstate_c.Supports(GPU_SUPPORTS_ARB_FRAMEBUFFER_BLIT);
// Let's only do this if not clearing depth.
fbo_bind_for_read(src->fbo);
glDisable(GL_SCISSOR_TEST);
#if defined(USING_GLES2) && defined(ANDROID) // We only support this extension on Android, it's not even available on PC.
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);
} else
#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);
}
// If we set dst->depthUpdated here, our optimization above would be pointless.
glstate.scissorTest.restore();
@ -1278,7 +1275,7 @@ void FramebufferManager::BlitFramebuffer(VirtualFramebuffer *dst, int dstX, int
bool useNV = false;
#ifndef USING_GLES2
if (gstate_c.Supports(GPU_SUPPORTS_FBO_ARB)) {
if (gstate_c.Supports(GPU_SUPPORTS_FBO)) {
useNV = false;
useBlit = true;
}
@ -1555,15 +1552,7 @@ void FramebufferManager::PackFramebufferAsync_(VirtualFramebuffer *vfb) {
}
GLenum fbStatus;
#ifndef USING_GLES2
if (!gl_extensions.ARB_framebuffer_object) {
fbStatus = glCheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER);
} else {
fbStatus = glCheckFramebufferStatus(GL_READ_FRAMEBUFFER);
}
#else
fbStatus = glCheckFramebufferStatus(GL_READ_FRAMEBUFFER);
#endif
fbStatus = (GLenum)fbo_check_framebuffer_status(vfb->fbo);
if (fbStatus != GL_FRAMEBUFFER_COMPLETE) {
ERROR_LOG(SCEGE, "Incomplete source framebuffer, aborting read");

View File

@ -496,9 +496,14 @@ void GLES_GPU::CheckGPUFeatures() {
}
}
// Note: there's a lie going on in the codebase about what ARB_FBO really is. It's not equal to the FBO in ES 2.0.
if (gl_extensions.ARB_framebuffer_object) {
features |= GPU_SUPPORTS_FBO_ARB;
if (gl_extensions.ARB_framebuffer_object || gl_extensions.EXT_framebuffer_object || gl_extensions.IsGLES) {
features |= GPU_SUPPORTS_FBO;
}
if (gl_extensions.ARB_framebuffer_object || gl_extensions.GLES3) {
features |= GPU_SUPPORTS_ARB_FRAMEBUFFER_BLIT;
}
if (gl_extensions.NV_framebuffer_blit) {
features |= GPU_SUPPORTS_NV_FRAMEBUFFER_BLIT;
}
bool useCPU = false;

View File

@ -169,17 +169,13 @@ bool FramebufferManager::NotifyStencilUpload(u32 addr, int size, bool skipZero)
bool useBlit = false;
bool useNV = false;
#ifndef USING_GLES2
if (gl_extensions.ARB_framebuffer_object) {
if (gstate_c.Supports(GPU_SUPPORTS_ARB_FRAMEBUFFER_BLIT)) {
useNV = false;
useBlit = true;
}
#else
if (gl_extensions.GLES3 || gl_extensions.NV_framebuffer_blit) {
useNV = !gl_extensions.GLES3;
} else if (gstate_c.Supports(GPU_SUPPORTS_NV_FRAMEBUFFER_BLIT)) {
useNV = true;
useBlit = true;
}
#endif
// Our fragment shader (and discard) is slow. Since the source is 1x, we can stencil to 1x.
// Then after we're done, we'll just blit it across and stretch it there.

View File

@ -453,10 +453,11 @@ enum {
GPU_SUPPORTS_UNPACK_SUBIMAGE = FLAG_BIT(3),
GPU_SUPPORTS_BLEND_MINMAX = FLAG_BIT(4),
GPU_SUPPORTS_LOGIC_OP = FLAG_BIT(5),
GPU_SUPPORTS_NV_FRAMEBUFFER_BLIT = FLAG_BIT(10),
GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH = FLAG_BIT(20),
GPU_SUPPORTS_FBO_ARB = FLAG_BIT(25),
GPU_SUPPORTS_OES_TEXTURE_NPOT = FLAG_BIT(26),
GPU_SUPPORTS_FBO = FLAG_BIT(25),
GPU_SUPPORTS_ARB_FRAMEBUFFER_BLIT = FLAG_BIT(26),
GPU_SUPPORTS_NV_FRAMEBUFFER_BLIT = FLAG_BIT(27),
GPU_SUPPORTS_OES_TEXTURE_NPOT = FLAG_BIT(28),
GPU_IS_MOBILE = FLAG_BIT(29),
GPU_PREFER_CPU_DOWNLOAD = FLAG_BIT(30),
GPU_PREFER_REVERSE_COLOR_ORDER = FLAG_BIT(31),

2
native

@ -1 +1 @@
Subproject commit 2b24f76d34437941d3d6444c39e190d3c3fe979f
Subproject commit 6934d31090a25d44b23a05b6eaa7576cc4a4f4b9