Hello Guest

[FIXED] LWJGL3 - glMapBuffer

  • 2 Replies
  • 2487 Views
*

Offline abcdef

  • ****
  • 320
[FIXED] LWJGL3 - glMapBuffer
« on: November 27, 2014, 09:25:43 »
Hi

I noticed GL15.glMapBuffer is slightly different in LWJGL3

Code: [Select]
public static java.nio.ByteBuffer glMapBuffer(int target,
                              int access,
                              int length,
                              java.nio.ByteBuffer old_buffer)

In LWJGL2 I am using a long as the length, long is also used in the SubData version in LWJGL3

Code: [Select]
public static void glGetBufferSubData(int target,
                      long offset,
                      long size,
                      java.nio.ByteBuffer data)

*

Offline spasi

  • *****
  • 2132
    • WebHotelier
Re: LWJGL3 - glMapBuffer
« Reply #1 on: November 27, 2014, 11:33:17 »
This is an interesting find, thanks. BUFFER_SIZE is indeed an int64 and I'll make sure any usages are fixed.

For this particular case though, the length parameter is a virtual one added by LWJGL, the original native function does not have it. It sets the capacity of the returned ByteBuffer and the problem is that NIO buffers are limited to 32bit addressing. So, making it a long won't be beneficial now, but it may be in the future. Afaik there are lots of people doing off-heap memory management that complain about this issue (mostly related to server-side stuff, like NoSQL solutions, high-frequency traders etc).

*

Offline spasi

  • *****
  • 2132
    • WebHotelier
Re: LWJGL3 - glMapBuffer
« Reply #2 on: December 07, 2014, 19:36:19 »
This has been fixed in nightly build #28.