Disclaimer: I haven't used bgfx for anything serious, the below information is based on the public API and documentation. I have verified non-obvious cases by looking into bgfx's source, but please do let me know if you think I've misunderstood something.
BGFXTransform is required as an argument to:
You allocate a BGFXTransform, but you do not fill it with anything. The call to bgfx_alloc_transform will initialize the struct with a data pointer that's internal to bgfx. You then access the pointer with .data(), returning a FloatBuffer (wrapping 4 x 4 x .num() floats) which is obviously mutable.
BGFXInstanceDataBuffer is required as an argument to:
BGFXInstanceDataBuffer instances are created with bgfx_alloc_instance_data_buffer. No member should be modified, except the contents of the .data() buffer. A BGFXInstanceDataBuffer instance is deallocated after a call to bgfx_set_instance_data_buffer.
BGFXTextureInfo is required as an argument to:
In both functions, the _info parameter is an output parameter.
BGFXMemory is required as an argument to:
BGFXMemory is already mutable. Note that there's a setter for data only, the size member is populated automatically based on the buffer size. If that is inconvenient somehow, you can use the "unsafe" static setters (ndata & nsize).
BGFXCallbackInterface is required as an argument to:
BGFXCallbackInterface is already mutable. See the vtbl(BGFXCallbackVtbl value) method.