-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Hi
LwjglContext (in jme3-lwjgl3 module) specifies its own implementation of buffer allocator to be used by BufferAllocatorFactory by setting PROPERTY_BUFFER_ALLOCATOR_IMPLEMENTATION property in this static code block:
jmonkeyengine/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java
Lines 91 to 102 in 8af0c92
| static { | |
| final String implementation = BufferAllocatorFactory.PROPERTY_BUFFER_ALLOCATOR_IMPLEMENTATION; | |
| if (System.getProperty(implementation) == null) { | |
| if (Boolean.parseBoolean(System.getProperty(PROPERTY_CONCURRENT_BUFFER_ALLOCATOR, "true"))) { | |
| System.setProperty(implementation, ConcurrentLWJGLBufferAllocator.class.getName()); | |
| } else { | |
| System.setProperty(implementation, LWJGLBufferAllocator.class.getName()); | |
| } | |
| } | |
| } |
the issue is that sometimes this property gets ignored by BufferAllocatorFactory and a ReflectionAllocator is created instead. That is because BufferAllocatorFactory.create() method sometimes is called before the LwjglContext sets the new property. Inside the BufferUtils class:
| private static final BufferAllocator allocator = BufferAllocatorFactory.create(); |
Sometimes the order of these static executions is different, e.g the one in the BufferUtils runs before the LwjglContext, which will cause BufferAllocator allocator to get initialized with Reflectionallocator and bypass the LWJGL3 allocator.
Edit:
2 possible fixes are suggested for this issue:
and:
Edit2:
Forum topic:
https://hub.jmonkeyengine.org/t/buffer-allocator-implementation-set-by-lwjglcontext-gets-ignored-sometimes/45594
Metadata
Metadata
Assignees
Labels
Type
Projects
Status