Blit two textures

Seems like General is locked so I’ll post it here:

Currently in OpenGL to blit two textures the following has to be done (in pseudo-code):

glBindFramebuffer(GL_READ_FRAMEBUFFER, srcFb);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, dstFb);

if (stencil && depth) {
    glFramebufferTexture2D(src); // bind depth+stencil
    glFramebufferTexture2D(dst);
    glFramebufferTexture2D(src); // unbind color
    glFramebufferTexture2D(dst);
} else if (depth) {
    glFramebufferTexture2D(...); // bind depth
    glFramebufferTexture2D(...); // unbind stencil
    glFramebufferTexture2D(...); // unbind color
    // ...
} else if (stencil) {
    // same for stencil-only
} else if (color) {
    // same for color-only
}

glBlitFramebuffers(...);

// restore previous state if it's not DSA

It’s a bit of a boilerplate to do this for every time two textures have to be blitted.
ARB_copy_image is nice but it doesn’t allow texture resizing or flipping. Vulkan introduced vkCmdBlitImage which does pretty much the same but without using framebuffers (that here are just a dummy container instead of a real framebuffer).

My suggestion is an API similar to this:

glBlitImages(
        GLuint srcTex,
  	GLuint dstTex,
  	GLint srcX0,
  	GLint srcY0,
  	GLint srcZ0,
  	GLint srcX1,
  	GLint srcY1,
  	GLint srcZ1,
  	GLint dstX0,
  	GLint dstY0,
  	GLint dstZ0,
  	GLint dstX1,
  	GLint dstY1,
  	GLint dstZ1,
        GLenum filter?);

I’m probably skipping some variables that come into play here, but it’s a template.

Looking forward to your opinions about this!