Questions about Scope of Mapped Buffer Validity

Hello, I have a couple of questions about the scope of mapped buffer validity that I have not been able to determine the answers for concretely from reading the docs and would appreciate it if someone could provide some clarity.

Question 1)
If a buffer has been bound to GL_ARRAY_BUFFER, and mapped (using GL_ARRAY_BUFFER), if another buffer is bound to GL_ARRAY_BUFFER before the first has been unmapped, is the mapped pointer still valid?

My Current Thoughts: I think it should be valid as I don’t see anything about map or unmap that seems to indicate it must remain bound for the duration of the map operation. Though it would have to be bound again to unmap.

Question 2)
If a buffer has been bound (to lets say… GL_ARRAY_BUFFER), and mapped (using GL_ARRAY_BUFFER), if that buffer is later (while still mapped) bound to another target (example: GL_COPY_WRITE_BUFFER) can it unmapped using GL_COPY_WRITE_BUFFER or must the buffer be mapped / unmapped from the same target for some reason?

My Current Thoughts: Again I suspect this should be valid as I understand the map / unmap to just use the (GL_ARRAY_BUFFER or GL_COPY_WRITE_BUFFER in this example) to look up the actual buffer which is to be mapped / unmapped.

I would appreciate any confirmation or clarification anyone can provide! Thanks in advance!


Question 1:
The spec gives the answer to this:

Buffers need not be bound for the duration of their mapping

Question 2:
The target parameter is part of the GLX protocol for MapBuffer. I’d be careful, and not rely on it to work with all hardware/drivers, even if it does work with one.

Thanks for the quick reply and the link to the spec which does answer my question 1 clearly.

I read the rest in detail and I think it may somewhat indirectly answer my question 2 as well. It indicates that buffer object binding points are client state, however the buffer objects themselves, and the buffer maps are server state. As the buffer object and buffer maps are server state, and thus can be shared, I can not see how the client state of the binding points at the time of the map would need to be known in order to unmap at a later time.

While not definitive, I am currently assuming that it should be possible to unmap from a different binding point than it was mapped in. I do however agree that this would be a bit odd and I would not trust the drivers necessarily all agree with this.

Thanks again!