anchor.diff:                      GL.BufferStorage(
                           BufferTarget.CopyWriteBuffer, 
                           2n <<< 30, 0n, 
  -                        BufferStorageFlags.SparseStorageBit
  +                        BufferStorageFlags.SparseStorageBit ||| BufferStorageFlags.DynamicStorageBit
                       )
                       GL.BindBuffer(BufferTarget.CopyWriteBuffer, 0)
   
  
positive.code:             GL.Check "[ResizeableBuffer] could not unbind buffer"
  
          override x.MapWrite(offset : nativeint, size : nativeint, writer : nativeint -> 'a) =
              let temp = GL.GenBuffer()
              GL.BindBuffer(BufferTarget.CopyReadBuffer, temp)
              GL.Check "[ResizeableBuffer] could not bind buffer"
  
              GL.BufferStorage(BufferTarget.CopyReadBuffer, size, 0n, BufferStorageFlags.MapWriteBit)
              GL.Check "[ResizeableBuffer] could not allocate temp buffer"
  
              let ptr = GL.MapBufferRange(BufferTarget.CopyReadBuffer, 0n, size, BufferAccessMask.MapWriteBit ||| BufferAccessMask.MapInvalidateBufferBit)
              let res = writer ptr
              GL.UnmapBuffer(BufferTarget.CopyReadBuffer) |> ignore
  
              GL.BindBuffer(BufferTarget.CopyWriteBuffer, x.Handle)
              GL.Check "[ResizeableBuffer] could not bind buffer"
  
              GL.CopyBufferSubData(BufferTarget.CopyReadBuffer, BufferTarget.CopyWriteBuffer, 0n, offset, size)
              GL.Check "[ResizeableBuffer] could not copy buffer"
  
              GL.BindBuffer(BufferTarget.CopyWriteBuffer, 0)
              GL.Check "[ResizeableBuffer] could not unbind buffer"
                      
              GL.BindBuffer(BufferTarget.CopyReadBuffer, 0)
              GL.Check "[ResizeableBuffer] could not unbind buffer"
  
              GL.DeleteBuffer(temp)
              GL.Check "[ResizeableBuffer] could not delete temp buffer"
  
              res
  
          override x.MapRead(offset : nativeint, size : nativeint, reader : nativeint -> 'a) =
              let temp = GL.GenBuffer()
              GL.BindBuffer(BufferTarget.CopyWriteBuffer, temp)
              GL.Check "[ResizeableBuffer] could not bind buffer"
  
              GL.BufferStorage(BufferTarget.CopyWriteBuffer, size, 0n, BufferStorageFlags.MapReadBit)
              GL.Check "[ResizeableBuffer] could not allocate temp buffer"
  
              GL.BindBuffer(BufferTarget.CopyReadBuffer, x.Handle)
              GL.Check "[ResizeableBuffer] could not bind buffer"
  
              GL.CopyBufferSubData(BufferTarget.CopyReadBuffer, BufferTarget.CopyWriteBuffer, offset, 0n, size)
              GL.Check "[ResizeableBuffer] could not copy buffer"
  
              GL.BindBuffer(BufferTarget.CopyReadBuffer, 0)
              GL.Check "[ResizeableBuffer] could not unbind buffer"
  
              let ptr = GL.MapBufferRange(BufferTarget.CopyWriteBuffer, 0n, size, BufferAccessMask.MapReadBit)
              let res = reader ptr
              GL.UnmapBuffer(BufferTarget.CopyWriteBuffer) |> ignore
  
              GL.BindBuffer(BufferTarget.CopyWriteBuffer, 0)
              GL.Check "[ResizeableBuffer] could not unbind temp buffer"
  
              GL.DeleteBuffer(temp)
              GL.Check "[ResizeableBuffer] could not delete temp buffer"
  
              res
  
  
  
negative.code:             let oldCapacity = x.SizeInBytes
              if oldCapacity <> newCapacity then
                  using ctx.ResourceLock (fun _ ->
                      x.Realloc(oldCapacity, newCapacity)
                  )
                  x.SizeInBytes <- newCapacity
  
          member x.UseReadUnsafe(offset : nativeint, size : nativeint, reader : nativeint -> 'x) =
              using ctx.ResourceLock (fun _ ->
                  x.MapRead(offset, size, reader)
              )
  
          member x.UseWriteUnsafe(offset : nativeint, size : nativeint, writer : nativeint -> 'x) =
              using ctx.ResourceLock (fun _ ->
                  x.MapWrite(offset, size, writer)
              )
  
  
  