Duplicated code from the attach functions has been collapsed into a
helper function.
Attaching a texture does not need binding it, so there's little point
in deferring the allocation to update_attachment. By calling the type-
specific allocate function in attach, update_attachment can be simpler.