Commit Graph

3394 Commits

Author SHA1 Message Date
Philip Rideout
fa879b4bd0 gltf_viewer: call asyncCancelLoad in drop handler
Relates to #3383
2021-01-08 09:40:39 -08:00
Ben Doherty
005e4ba2ec Fix Filament RenderingTest (#3407) 2021-01-07 12:10:53 -08:00
Romain Guy
d2299c4502 List supported glTF 2.0 features 2021-01-06 14:20:46 -08:00
Philip Rideout
5c666c254e gltfio: Improve robustness when decoding textures.
Bad texture files would cause the background decoder thread to never
finish and would generate textures with 0x0 dimensions, which eventually
triggers GL_INVALID_VALUE.

To recap, gltfio texture loading has two phases: the first phase is
synchronous and uses stbi_info to gather texture info. The second phase
is asynchronous and uses stbi_load to do the actual decoding.

During the first phase, we now check the return code from stbi_info
rather than assuming that it worked.  :)

Fixes #3344
2021-01-05 12:00:29 -08:00
ritwik
a09c17bd4f Make install gltfio_resources and gltfio_resources_lite for desktop builds also 2021-01-05 10:35:13 -08:00
Ben Doherty
57df4481e9 Update Material query API to work with subpasses (#3203)
* Update Material query API to work with subpasses

* Add JNI binding
2020-12-23 13:27:04 -08:00
Ben Doherty
47af85aed1 Remove libSPIRV-Tools-shared from spirv-tools (#3390) 2020-12-23 13:26:14 -08:00
Ben Doherty
44fc295913 Unbind texture from all sampler groups upon destroy (#3386) 2020-12-22 11:34:05 -08:00
Philip Rideout
6878b0be36 build.sh: Add TypeScript bindings to the tgz file.
This makes the tgz consistent with the npm package. Fixes #3268.

Note that we already stopped packaging the old HTML docs. Going forward,
we would like to use the TS declarations as documentation because they
must be kept up to date anyway, and they already contain type
information. This was discussed in #3250.
2020-12-21 17:27:46 -08:00
Romain Guy
6c222bf4e3 Update README 2020-12-15 14:48:38 -08:00
Romain Guy
eb70fd5dee Sample the proper channel for sheenRoughness 2020-12-12 18:05:02 -08:00
Romain Guy
986a3869cc Fix struct initialization 2020-12-12 17:40:48 -08:00
Romain Guy
9ad3d88d74 Fix build breakage.
We were declaring one too many material properties which would
lead to out of bounds writes/reads.
2020-12-12 12:04:24 -08:00
Romain Guy
a3bfdb89fa Update release notes 2020-12-12 11:09:28 -08:00
Romain Guy
2895530e09 Add support for sheenColor and sheenRoughness (#3358)
* Add support for sheenColor and sheenRoughness

This work is necessary to support the glTF extension KHR_materials_sheen.
This change effectively adds the specular lobe from the cloth material
model to the base material model. The cloth model remains useful for
its extra subsurface color feature but also because it's cheaper.

* Add support for KHR_materials_sheen to gltfio

* Update documentation

* Document default shading values
2020-12-12 11:07:40 -08:00
Romain Guy
f8069aa99f Update to cgltf 1.9 (#3361) 2020-12-11 16:42:36 -08:00
Philip Rideout
b70eea9556 filamat: minify struct fields.
This shrinks the arm64 so file by 24 KiB.
2020-12-10 11:20:14 -08:00
Philip Rideout
44a8da6a8e Remove VSM variant from Skybox material. 2020-12-10 11:20:01 -08:00
Philip Rideout
3bd066f993 math: reduce template bloat for matrices
This does not change our API, it merely reduces the number of
non-inlined function instantiations appearing in non-optimized binaries.
2020-12-10 11:19:46 -08:00
Philip Rideout
1b10afa9e6 Code review fixups for libibl_lite. 2020-12-10 11:19:36 -08:00
Philip Rideout
024910ba8e libibl: use C callback for progress 2020-12-10 11:19:36 -08:00
Philip Rideout
f2e3a132db Add libibl_lite. 2020-12-10 11:19:36 -08:00
Philip Rideout
87abd1f8bc Fix RenderableManager docs for "index"
I also double-checked the backends, they indeed treat it as an index
count.

Fixes #3351
2020-12-10 10:11:46 -08:00
Philip Rideout
57662c52f2 matdbg / matinfo: fix post-process variant string
Also some minor HTML stuff:

- Hide "Required attributes" header when there are none.
- Remove legend for variants (takes too much space).
2020-12-09 14:44:27 -08:00
Philip Rideout
a50cd1f8c8 zbloat now includes chunk sizes 2020-12-06 21:54:37 -08:00
Philip Rideout
fe907398d4 resgen / zbloat fixups 2020-12-06 15:25:08 -08:00
Philip Rideout
8b6ddfe97a Add zbloat tool.
This tool makes it easy to analyze the composition of Android
applications that use Filament.

- Filament materials are shown in the treemap if `resgen --json` was
  used in the build.
- The input path can be a so file, folder, or zip archive (apk or aar).
- If the path is a zip or folder, helps you find the file to analyze.
- The generated web report is a self-contained HTML file.
- Reports the gzipped size of all Filament materials.

For example, from a mac, you can generate a self-contained HTML file by
typing this from the Filament repo root:

    ./tools/zbloat/zbloat.py ./android/filament-android
    open index.html

This tool uses Python, `nm`, and `objdump`.

The `nm` tool works slightly differently between macOS and Linux, so a
`Dockerfile` is provided that installs dependencies inside a Linux
container. This is also convenient if you do not have both versions of
Python on your system.

The easy way to use docker is to invoke the helper bash script. Simply
type `zbloat.sh [args...]` instead of `zbloat.py [args...]`. The first
time you run it, it will be slow but subsequent times will be fast.

Many thanks to Evan Martin for his interactive treemap widget.
2020-12-06 14:36:25 -08:00
Philip Rideout
3226b20ece resgen: add --json option.
This option embeds a small JSON string inside the resgen blob that lists
all materials and their respective sizes. This is useful when analyzing
the footprint of the binary executable.
2020-12-06 14:36:13 -08:00
MasTraER
61d473887f Fix clearing Rendertarget multiple times
This fixes a bug Renderer clearing a render target multiple times when the first time and back again.

Usually the default RenderTarget is unintentionally cleared/discarded in the current behavior.
1) Renderer renders a view without custom RenderTarget having full-screen viewport,
2) Renderer renders a view with custom RenderTarget
3) And Renderer renders an another view without custom RenderTarget having different viewport from 1)
You may see junk or empty pixels in outside of the viewport of the view 3), depending on ClearOptions and the backend.

This fix make Renderer put cleared RenderTargets into a set and check them to be cleared only for the first time, instead of comparing the previous RenderTarget to the current RenderTarget.
2020-12-06 14:35:26 -08:00
cjsliuj
b3d7819e78 Fix computeTangents 2020-12-05 15:24:34 -08:00
Philip Rideout
de6220594d WebGL: RGB16F is not color renderable.
This was problematic with Chrome's ANGLE backend; more information at:
https://bugs.chromium.org/p/chromium/issues/detail?id=941671#c10

Fixes #3308
2020-12-02 14:31:19 -08:00
Philip Rideout
d9dfe69a81 Android: do not export internal symbols.
We now export only two groups of symbols: (1) JNI and (2) dynamic linker
symbols used by the companion libraries.

This commit has the following impact:

- Shrinks the arm64 so from 1024 KiB to 954 KiB.
- Shrinks the arm64 aar from 560 KiB to 538 KiB.

Note that the patterns in the map file are tested against mangled names
and therefore should not be used to match the double-colon operator.
2020-12-02 13:11:38 -08:00
Ben Doherty
22d4e63787 Fix Windows iterator issue in Zip2Iterator and StructureOfArrays (#3322) 2020-12-01 14:05:15 -08:00
Philip Rideout
f033799a43 Fix incorrect JNI binding for destroyColorGrading. 2020-12-01 09:02:51 -08:00
Ben Doherty
30e150c016 Fix Metal assertion when loading into texture arrays (#3314) 2020-11-24 10:46:16 -08:00
Ben Doherty
f5f27749a4 Update native window documentation (#3315) 2020-11-23 14:03:10 -08:00
Philip Rideout
b5f95213db Partial fix for MSVC build. 2020-11-20 14:18:08 -08:00
Philip Rideout
d42865373d Vulkan: change vkWaitForFences usage for SwiftShader.
When passing only 1 fence to vkWaitForFences, the `waitAll` argument
should not have any effect, but SwiftShader seems to skip the wait
when this argument is set to VK_FALSE.

More specifically, the failure to wait in `acquireWorkCommandBuffer`
causes the subsequent destruction of an in-use fence, which causes
a TSAN failure with Google's internal tests.

I am consulting with the SwiftShader team on a real fix, meanwhile
we can commit this easy workaround.

We have 5 usages of vkWaitForFences, one of which uses multiple fences
and should have used VK_TRUE anyway.
2020-11-20 09:36:06 -08:00
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