Commit Graph

10 Commits

Author SHA1 Message Date
Mathias Agopian
88edbc7df8 Fix a java global reference leak
We were acquiring a reference twice by accident.

Fix #4957
2021-12-13 15:16:48 -08:00
Romain Guy
c0e8686297 Use __ANDROID__ instead of ANDROID 2021-11-30 11:14:35 -08:00
Mathias Agopian
1c1cb11cf5 Use the new CallbackHandler in the java bindings
Java callbacks are now directly dispatched to their handler, instead
of first going through filament's opportunistic dispatch, reducing
callback latency.
2021-10-04 10:56:43 -07:00
Ben Doherty
2df02d81d3 Add setFrameCompletedCallback JNI binding (#3275) 2020-11-12 12:24:41 -08:00
Philip Rideout
dc74ee2ddc Refactor CallbackUtils. 2020-08-05 17:27:12 -07:00
Philip Rideout
2727cddd7a TextureHelper: add overload with a release callback.
Fixes #2909.
2020-08-05 17:27:12 -07:00
Pixelflinger
786dbdc6e4 fix JNI objects allocation and memory corruption
- we were allocating objects with a destructor in the command stream
  which is always invalid because there is no guarantee that when 
  the callback is called, the underlaying memory is still valid
  (and it wasn't).

- AutoBuffer move-ctor wasn't moving some of its state, which would
  lead to destroying the same ref several times.
2020-05-06 18:08:13 -07:00
Romain Guy
9b1a0e2f58 Remove of static JNI fields (#2400)
Static JNI lookups were causing issues with multiple libraries.
We now do the lookups when we need them as they are effectively
just hashmap lookups and we do them only in places where the
work we need to perform will be much larger than a simple hash
map lookup anyway.

This chane also manually registers filament-utils JNI bindings
to get rid of unnecessary symboles. We should do the same for
other Filament libraries (the symbols are pretty long and
we now have many of them).
2020-04-16 09:00:54 -07:00
Philip Rideout
d85f8164c0 Stream API: add support for acquire / release semantics.
Previously, Streams had two modes (native and texid), this adds a third
mode called "acquired", which allows for copy-free synchronized external
textures in OpenGL and paves the way for Vulkan.

The native mode is now deprecated but texid mode needs to stay around
until all clients can be upgraded.

In an early prototype, this functionality was added directly into
Texture but required quite a bit of additional state tracking, so the
Stream API seemed like a better fit.

This API is probably not necessary for Metal due to Metal's shared
ownership semantics.

This has been tested with a new Android sample that will be added in a
subsequent PR.
2019-11-15 08:40:41 -08:00
Philip Rideout
94b4f92bc5 Android: move JNI C++ utils into a common folder.
No need for a proper library, this is just a common location to simplify
JNI bindings in other projects like filamat and gltfio.

There is no need to move the one Java source file (`NioUtils.java`)
since downstream libraries will have a dependency on Filament, and
FindClass should work fine.
2019-06-17 08:47:27 -07:00