mirror of
https://github.com/shadowfacts/lwjgl2-arm64.git
synced 2026-04-06 15:04:41 +00:00
Linux: moved handle allocations to native
This commit is contained in:
parent
47814d58f4
commit
9a764b3d33
5 changed files with 61 additions and 15 deletions
|
|
@ -43,20 +43,16 @@ import org.lwjgl.BufferUtils;
|
|||
* @version $Revision$
|
||||
*/
|
||||
final class LinuxContextImplementation implements ContextImplementation {
|
||||
private final static int HANDLE_SIZE = 64;
|
||||
|
||||
private static PeerInfo getCurrentPeerInfo() {
|
||||
return Context.getCurrentContext().getPeerInfo();
|
||||
}
|
||||
|
||||
public ByteBuffer create(PeerInfo peer_info, ByteBuffer shared_context_handle) throws LWJGLException {
|
||||
ByteBuffer handle = BufferUtils.createByteBuffer(HANDLE_SIZE);
|
||||
LinuxDisplay.lockAWT();
|
||||
try {
|
||||
ByteBuffer peer_handle = peer_info.lockAndGetHandle();
|
||||
try {
|
||||
nCreate(peer_handle, handle, shared_context_handle);
|
||||
return handle;
|
||||
return nCreate(peer_handle, shared_context_handle);
|
||||
} finally {
|
||||
peer_info.unlock();
|
||||
}
|
||||
|
|
@ -65,7 +61,7 @@ final class LinuxContextImplementation implements ContextImplementation {
|
|||
}
|
||||
}
|
||||
|
||||
private static native void nCreate(ByteBuffer peer_handle, ByteBuffer context_handle, ByteBuffer shared_context_handle) throws LWJGLException;
|
||||
private static native ByteBuffer nCreate(ByteBuffer peer_handle, ByteBuffer shared_context_handle) throws LWJGLException;
|
||||
|
||||
public void swapBuffers() throws LWJGLException {
|
||||
PeerInfo current_peer_info = getCurrentPeerInfo();
|
||||
|
|
|
|||
|
|
@ -44,9 +44,8 @@ import org.lwjgl.Sys;
|
|||
* @version $Revision$
|
||||
*/
|
||||
abstract class LinuxPeerInfo extends PeerInfo {
|
||||
private static final int PEER_HANDLE_SIZE = 64;
|
||||
|
||||
public LinuxPeerInfo() {
|
||||
super(BufferUtils.createByteBuffer(PEER_HANDLE_SIZE));
|
||||
super(createHandle());
|
||||
}
|
||||
private static native ByteBuffer createHandle();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue