CLMem mem = clCreateBuffer(clContext, CL_MEM_READ_ONLY | CL_MEM_ALLOC_HOST_PTR, nodes * Matrix4f.SIZEOF, errorCode);
ByteBuffer data = MappedObjectUnsafe.newBuffer(mem.getInfoLong(CL_MEM_HOST_PTR), (int)mem.getInfoSize(CL_MEM_SIZE));
Matrix4f matrices = Matrix4f.map(data);
Matrix4f.setIdentity(matrices, nodes);
Mapped access to CPU addressable PCIe memory? Check.
More requests:
-
A getter for the mapped buffer in MappedObject will be useful. Itās one less reference to keep around when user code needs to pass the buffer to GL/CL.
-
A .map(address, capacity) could be added, that would do the equivalent of lines 2-3 in the code above. MappedObjectUnsafe could be made package-private as well.