Commit Graph

3356 Commits

Author SHA1 Message Date
Philip Rideout
f83eb114bc Filament should always bind an IBL texture.
This prevents a SwiftShader crash and/or a slew of "no texture bound"
warnings that would appear when the client provides an IBL without
providing reflections texture, which should be a valid thing to do.

Note that it is okay to declare a sampler in GLSL that never gets bound,
as long as it is never sampled from. Since we always sample from the
IBL specular texture, we should always bind something to it.
2020-11-19 10:22:45 -08:00
Philip Rideout
9c20294e4b gltfio: Fix animator crash for orphaned nodes.
Fixes #3285
2020-11-18 11:26:39 -08:00
Ben Doherty
40e7a86f5f Fix, matc crash when building mobile materials (#3296) 2020-11-16 14:41:15 -08:00
Ben Doherty
34707431f7 Fix spirv-tools CMake warning (#3289) 2020-11-16 14:30:06 -08:00
Benjamin Doherty
5e585496b2 Update RELEASE_NOTES for 1.9.9 2020-11-16 12:33:43 -08:00
Benjamin Doherty
1e501eb00b Release Filament 1.9.9 2020-11-16 12:32:38 -08:00
Ben Doherty
fdc28801a2 Silence spirv-opt warnings in release builds (#3288) 2020-11-13 13:55:19 -08:00
Ben Doherty
c008109335 Update Android building instructions on Windows 2020-11-13 11:04:24 -08:00
Philip Rideout
99c5fc7388 Improve the "unbound texture" warnings.
With Vulkan, this warning would sometimes be a false positive. It could
trigger for internal samplers like `ssao` and `structure`, even though
they were not declared in SPIR-V.

With OpenGL, this warning would never be a false positive because it has
the luxury of calling `glGetUniformLocation`.

This adds a private attribute to our samplers called `strict` that
indicates whether or not a sampler should always have a bound texture.
For now the only strict samplers are the custom ones declared in the
user's material.

At some point I think we should consider adding `spirv-reflect` to our
tree to help with problems like this.
2020-11-12 16:02:32 -08:00
Ben Doherty
90c156ebef Add fog variant filter to matc (#3286) 2020-11-12 12:47:42 -08:00
Ben Doherty
2df02d81d3 Add setFrameCompletedCallback JNI binding (#3275) 2020-11-12 12:24:41 -08:00
Ben Doherty
8019b11589 Update glslang and friends (#3277) 2020-11-12 12:23:51 -08:00
Philip Rideout
16454e0de6 Vulkan: improve robustness by providing 1x1 fallback. 2020-11-12 10:35:50 -08:00
Philip Rideout
3bf934f5d7 Fix clear behavior with RenderTarget API.
This fixes a bug seen with client applications that use ClearOptions
instead of Skybox, and one or more offscreen RenderTarget objects.
These apps would see junk pixels because Filament would only clear the
first render target in the frame.

The fix is to factor some the flag-setting logic in `beginFrame()` into
a private method, and call this method from `render()` each time
the user-level RenderTarget has been changed.

I wrote a simple C++ demo to reproduce the issue and to verify that
this fix works.
2020-11-11 09:25:07 -08:00
Ben Doherty
b4a6d0a83e Add callback API to SwapChain (#3270) 2020-11-10 14:52:04 -08:00
Ben Doherty
a09037cec0 Revert "macOS: fix headless rendering." (#3273) 2020-11-10 12:02:12 -08:00
Philip Rideout
50a61984ec NOOP backend should not care about GLSL vs SPIRV.
This fixes errors that would occur when using the NOOP backend with
materials that were built without OpenGL support.
2020-11-09 11:11:12 -08:00
Romain Guy
6486eba7e2 Fix typo in docs 2020-11-09 09:37:10 -08:00
Benjamin Doherty
c92d13c0c9 Update RELEASE_NOTES for 1.9.8 2020-11-09 09:28:15 -08:00
Benjamin Doherty
bd9aba35f6 Release Filament 1.9.8 2020-11-09 09:27:06 -08:00
Philip Rideout
7fbd00e59b Repair Windows build, maybe. 2020-11-09 08:35:43 -08:00
Philip Rideout
f814138f83 Regenerate BlueVK, use a C++ namespace.
This moves all Vulkan entry points into the bluevk namespace
to avoid conflicts with other Vulkan loaders.

This also updates the header files and loader code to version 1.2.159 of
the Vulkan spec, which is currently available at the following links.

https://khronos.org/registry/vulkan/specs/1.2/html/vkspec.html
87451c55aa
2020-11-09 08:35:43 -08:00
Philip Rideout
96d3f2f16b More fixes for signed integer overflow.
Fence.cpp:

My previous fix to the fix was insufficient because a signed integer
overflow could still occur as follows (this was observed in an internal
test at Google).

If the conditional on line 87 is true, then a clamped value is passed
into `wait`, which causes the conditional on line 133 to fail, which
causes `wait_for` to be called inappropriately, which is where an
overflow would occur.

MetalHandles.mm:

This is more theoretical, but to prevent potential integer overflow
within STL, I think we should call `wait()` rather than `wait_for()`
when an infinite timeout is desired.

This is our fourth fix to fences in since November 2; see also dcca236,
e9c9e45, and 8969416.  :)
2020-11-09 08:35:17 -08:00
Philip Rideout
89694168a6 Another fix for FENCE_WAIT_FOR_EVER.
FFence::wait() has some logic that tests if "timeout" is equal to
FENCE_WAIT_FOR_EVER, which is actually impossible because it would
be modified by the clamp in this situation.

In practice I think this oversight would not cause any problems. I
noticed it while reviewing the code.

To recap why the clamp exists: according to the ISO C++ spec, the
"nanoseconds" duration in chrono is at least a signed 64-bit type, but
our sentinel constant might not (and does not) fit within this range.
2020-11-05 17:24:44 -08:00
Romain Guy
63d5698a78 Update Gradle, AGP, and other dependencies (#3257)
* Update Gradle and AGP

* Update other dependencies
2020-11-05 10:47:12 -08:00
Romain Guy
24ca2bf181 Fix JNI binding 2020-11-04 13:01:16 -08:00
Ben Doherty
f37a3e9497 Support CVPixelBuffer SwapChains with Metal (#3251) 2020-11-04 11:05:45 -07:00
Ben Doherty
90ad9b457a Implement copyFrame for Metal (#3249) 2020-11-03 12:25:29 -07:00
Ben Doherty
30f5a97ea1 Consolidate surface-related functionality into MetalSwapChain (#3246) 2020-11-03 12:00:03 -07:00
Philip Rideout
964a1bd7f2 BlueVK: improved error messaging. 2020-11-03 10:23:06 -08:00
Philip Rideout
e9c9e45ac9 Fix FENCE_WAIT_FOR_EVER in Linux.
The number of infinite nanoseconds was negative because we asked
chrono for a signed integer, so "wait forever" really meant "do not
wait at all".
2020-11-02 16:02:27 -08:00
Philip Rideout
fb831dec0a Vulkan: adjust usage flags to allow DEPTH blits. 2020-11-02 11:00:57 -08:00
Benjamin Doherty
dc1c5529c0 Update RELEASE_NOTES for 1.9.7 2020-11-02 11:00:55 -07:00
Benjamin Doherty
8b8d563b0f Bump version to 1.9.7 2020-11-02 11:00:09 -07:00
Ben Doherty
dcca236f60 Fix bug with Fence timeouts (#3243) 2020-11-02 10:47:28 -07:00
Philip Rideout
70dba2398e gltfio: add createInstance() to AssetLoader.
Note that this API is on the loader rather than the asset. This is
because the loader knows how to create Filament entities by traversing
a cgltf node hierarchy.

Animation on dynamically added instances is not yet supported.

We did not add destroyInstance() because gltfio favors flat arrays for
long term storage of entity lists and instance lists, which would be
slow to shift. We also wish to discourage create/destroy churn since it
is more efficient to pre-allocate instances and selectively add them
into the scene.

Fixes #3137.
2020-11-02 09:47:14 -08:00
Philip Rideout
47521d70a1 gltfio: fix ASAN issue when consuming invalid animation.
Release builds do not call cgltf_validate() so it was possible to
read out-of-bounds animation data when encountering a badly formed glTF
file with mismatched counts between sampler inputs and outputs.
2020-10-31 15:17:15 -07:00
Philip Rideout
468992f4cd gltfio: do not segfault on invalid primitives. 2020-10-31 13:28:13 -07:00
Philip Rideout
0db7057983 Vulkan: disable unreliable blit diagnostics. 2020-10-31 12:37:42 -07:00
Philip Rideout
8a63834607 Vulkan: fix layout mismatch after blitting to swap chain. 2020-10-31 12:37:42 -07:00
Philip Rideout
4e4d4f9ee3 Vulkan: add blit support for depth and MRT. 2020-10-31 10:29:25 -07:00
Philip Rideout
6abef94d95 mathio: add ostream operator for quaternions. 2020-10-29 17:04:03 -07:00
Philip Rideout
4b1c557bb1 Vulkan: fix color attachment list in first subpass.
This fixes a slew of validation warnings and errors seen when multiple
subpasses are enabled, starting with:

    Attachment 1 not written by fragment shader; undefined values will
    be written to attachment

The Vulkan driver was using the same color attachment list for both
subpasses, so the first subpass had unused attachments.

Note that Vulkan makes a distinction between color attachments and input
attachments and requires separate lists to be supplied for each subpass,
but our Driver API consolidates everything into a single list. This
should perhaps be refactored at a later date.
2020-10-29 15:03:34 -07:00
Philip Rideout
94a1eb27b4 Do not declare unused fragColor in GLSL.
This fixes a Vulkan validation warning when building a pipeline that
does not have a color attachment.
2020-10-29 11:08:13 -07:00
Philip Rideout
a9754273b0 Vulkan: minor fix for diagnostic output. 2020-10-28 15:41:07 -07:00
Philip Rideout
2fe4f6cbe7 AutomationEngine: fix regression with screenshots. 2020-10-28 12:58:54 -07:00
Philip Rideout
1159435d47 gltfio: add safety checks to getAnimator. 2020-10-28 11:51:06 -07:00
Philip Rideout
a6f364e0f3 gltfio: fix segfault when consuming invalid file. 2020-10-28 11:50:54 -07:00
Philip Rideout
c6942a52e6 gltfio: refactor the instancing cache.
This prepares for #3137 by moving the mesh cache and material instance
cache out of the loader (where they were transient anyway) and into the
actual asset. This paves the way for a `createInstance()` API.
2020-10-27 10:30:18 -07:00
Philip Rideout
c65dc99771 Fix colorGradingAsSubpass when dithering is off.
This fixes the blank screen seen with Vulkan when all view options are
disabled.
2020-10-26 15:33:42 -07:00