The JNI layer already does this, but can only track objects it created,
sometimes developers might create filament objects on the native side
and wrap them into java objects and this might cause a failure to
detected when objects are double-destroyed.
However, this can often be caught by the native code -- so, when the
native side is asked to destroy an object that doesn't exist, we now
return an error (exception if enabled) and we throw an exception
on the java side.
Filament typically doesn't do this kind of tests, however these bugs
can be very hard to find, and the cost is small.
Replace with forward declarations if needed and includes in .cpp that
now need them.
The idea here is to have our headers have the least amount of impact as
possible on our clients (e.g. compilation time).
This is useful for unit tests. The content of the swapchain can be
read to main memory with Renderer::readPixels().
This PR doesn't implement this new feature in the following backends and
platforms (TODO):
VulkanDriver.cpp
MetalDriver.mm
PlatformWGL.cpp
PlatformWebGL.cpp
PlatformCocoaTouchGL.mm
We still do not compile the Vulkan backend for Android by default, this
simply makes it possible to use the samples on Vulkan with a one-line
change, which is useful for testing purposes.
This change also makes it so that the materials used for the samples
include SPIR-V. This makes them fatter but they are merely samples.
I still consider Vulkan on Android to be experimental, there are some
features that need to be implemented.