Commit Graph

2572 Commits

Author SHA1 Message Date
Romain Guy
db18b2e07b Add the ability to build speific ABIs for Android (#2367)
For instance to build only 64 bit variants:
./build.sh -q x86_64,arm64-v8a release

This change also cleans up build.sh and Gradle files.
2020-04-08 15:06:47 -07:00
Pixelflinger
a9814f8a88 Improve dynamic resolution tracking
This new code is better able to reach the desired target as it 
continuously evaluates the best scale factor based on the current
known state.
2020-04-08 11:27:34 -07:00
Pixelflinger
2adfb259c6 fix shader overflows leading to black pixels
we clamp the output of post_process materials to 0,FLT16_MAX
2020-04-08 11:27:18 -07:00
Pixelflinger
240d8cd79b improve latency a bit
we now flush the backend (e.g. GL) after the color pass, this a 
good time because a lot of GPU work has been queued by that point, this
allows the GPU to start while we queue the post-processing commands.
This reduces latency by about 2.5ms on pixel4.
2020-04-08 11:27:03 -07:00
Romain Guy
85c563b628 Fix BusterDrone
Some parts where marked as transparent but they truly are opaque.
This was causing issues with SSAO.
2020-04-08 11:18:56 -07:00
Philip Rideout
68a78a77a8 gltfio-lite: remove tex matrices, spec-gloss, etc.
gltfio-lite now has its own template file rather than re-using the
ubershader one, which allows us to optimize the materials by removing
support for various glTF extensions like texture matrices,
specular-glossiness, and clear coat.
2020-04-07 20:36:05 -07:00
Philip Rideout
ad27d10503 Do not clobber VK_ICD_FILENAMES.
Fixes #2343
2020-04-07 16:28:01 -07:00
Philip Rideout
1366e3dcd1 gltfio: simplify skinning processing.
Moved all the skinning processing into one place.
2020-04-07 16:23:46 -07:00
Romain Guy
52086fe4d5 Remove debug code 2020-04-07 15:55:52 -07:00
Logan Lawrence
d99f9cffb2 GEOSP-97 Added javascript binding 2020-04-07 13:09:48 -07:00
Logan Lawrence
33cbc6bba3 GEOSP-97 Added comments 2020-04-07 13:09:48 -07:00
Logan Lawrence
7794cd4c65 GEOSP-97 Removed some unnecessary changes 2020-04-07 13:09:48 -07:00
Logan Lawrence
574058e81e Added and updated javascript bindings 2020-04-07 13:09:48 -07:00
Pixelflinger
3ad4f2eceb fix a some problems with timer queries in the OpenGL backend
in OpenGL we need to check the status of queries on the gl thread,
so we did this in when beginFrame was called -- however, this is
too late, because beginFrame is asynchronous, so we were always
behind by 1 frame.

we fix this by running the callbacks more often.
2020-04-07 12:16:09 -07:00
Alexey Pelykh
56d9e1f727 Fix Gltfio.init(): call Filament.init() as well 2020-04-07 10:01:51 -07:00
Romain Guy
7c8849065c Update release notes 2020-04-07 09:38:23 -07:00
Romain Guy
bf0dc32ee3 Change specularAmbientOcclusion from boolean to enum (#2352)
The user can now choose amongst 3 specular AO methods:
- None, specAO is off
- Simple, specAO is inferred from roughness and diffuse AO
- Bent normals, specAO is computed accurately from cone intersections

The last method is more expensive but produces the best results.

This change also fixes a few issues:
- Rename materialRefraction() and materialRefractionType() for
  consistency
- Fixes user time in shaders
2020-04-07 09:19:48 -07:00
Pixelflinger
887f8e8a1c better GPU timings on Android
On drivers that don't implement timer queries properly, we use
fences instead, however we can't use a fence to determine the start
time of the GPU work (only the end time). To workaround this we
use the last call to glFlush() as a proxy.
At least on Pixel it works very well.

We also remove all mid-frame calls to flush(), we did this to kick
cpu work early, but it's not as efficient as overlapping the work
with the previous frame, it increases latency a bit though.
2020-04-07 00:30:59 -07:00
Pixelflinger
b1f95646d9 Add "sync" objects to the driver
A sync object for us is like a fence that cannot be waited on. It can
only be queried.
This is useful for filament to know if (not when) some previous
commands have finished executing.

In OpenGL this is different from "fences" which only exist in EGL and
can be waited on from any thread.
"sync" objects correspond to GLsync object in OpenGL and are widely
supported, as opposed to EGL fences.

So we use the term "fence" to refer to synchronization object that are
external to OpenGL and the term "sync" for the native gl synchronization
objects. This distinction may or may not exist in other APIs.


rewrite the FrameSkipper to use this, which enables it on MacOS.
2020-04-06 21:09:28 -07:00
piggie
a282da78cd Adds texture support to filagui
Stores font texture as RGBA instead of R. This is because the ui material will not be compatible for RGBA textures, as it is expecting an R texture. I was unable get a texture with ALPHA format to function as I wanted.

This also removes material instance caching by scissor rect. Instead it just assigns the scissor rect to each new primitive, as well as an optional texture.
2020-04-06 19:21:20 -07:00
Pixelflinger
746e273336 rework how dynamic resolution scaling is specified
- now the DynamicResolutionOptions don't specify the target frame rate,
  they only specify how to scale this given view

- there is a new FrameRateOptions setting on Renderer, which is used
  to specify the desired target frame rate for the whole Renderer

- the frame rate is now specified as a "frame interval" in units of
  the display frame period.

- the display frame period is (indirectly) set via DisplayInfo.

In other words, the use must set (and update) DisplayInfo properly
(the default are reasonable, but assume 60 Hz). They must also set the
desired interval (default is 1, which is probably what you want).
Finally they must enable dynamic scaling per View, the defaults are
also reasonable.

Currently Renderer doesn't attempt (yet) to actually target the
requested frame rate, so it's up to the caller to push frames at the
desired speed. however, dynamic resolution, like before, will attempt
to shrink work to fit the target.
2020-04-06 16:55:24 -07:00
Pixelflinger
b2dd6683be Add a way to query and set Display information
Renderer can now be given a DisplayInfo that contains some
important information about the current display. This will be used
for frame-pacing and dynamic-resolution.

This is most relevant on Android, where we can accurately query these
parameters. Added support for that in our samples.


This also sets the minSDK to 19 (including gltf viewer's), since this is
the version we support. We were cheating before by under-reporting our
minSdk.
2020-04-06 16:55:24 -07:00
Pixelflinger
526898e7d6 add vsync timestamp to Renderer::beginFrame() API 2020-04-06 16:55:24 -07:00
Pixelflinger
00f1c3dae9 [GL backend] ensure that Handle<> are synchronously constructed
Until now, only the memory of Hw handes was allocated synchronously,
handles were constructed later asynchronously. This was error prone
with the few (but growing) synchronous calls we have.

Now we have an init<> call that allocates and constructs handles synchronously,
the asynchronous construction if needed, is still performed with construct<>,
which is now implemented as "destroy+construct", this is okay because
most of our handles have trivial dtors.

This fixes a race with TimerQuery and Fence. Fences are still not fully 
working though, but at least won't access uninitialized memory.
Currently backend fences MUST be used trough FFence.
2020-04-06 16:44:35 -07:00
Ben Doherty
bb88487b79 Fix test_material_parser build issue creating resource directory (#2350) 2020-04-06 15:33:25 -07:00
Romain Guy
92b7ee97f5 Kill specular AO at low roughness (#2348)
On metals (made only of specular light), specular AO can
create large black spots. This change simply kills specular
AO to avoid this artifact. In practice we should take into
account multiple bounces but this is rasterization...
2020-04-06 15:30:32 -07:00
Romain Guy
72056ee9e3 Fix support for 565 textures (#2347)
* Fix support for 565 textures

This requires exposing a new USHORT_565 pixel data type.

* Update JS bindings
2020-04-06 12:01:41 -07:00
Romain Guy
6330b1625c Udpate to AGP 3.6.2 2020-04-06 09:28:54 -07:00
Benjamin Doherty
27f4504dfc Implement timer queries for Metal backend 2020-04-03 18:10:39 -07:00
Pixelflinger
fb0e89d969 fix a race-condition in JobSystem
mThreadMap needs to be protected as it's accessed from multiple threads.
2020-04-03 17:25:17 -07:00
Ben Doherty
2ad932f345 Convert from half to full angles for gltfio spot lights (#2340) 2020-04-03 17:06:03 -07:00
Philip Rideout
d8ac60009c FilamentApp: use angle bracket syntax for includes. 2020-04-03 16:28:38 -07:00
Philip Rideout
37e2f46e10 Move FilamentApp into libs/filamentapp.
This will make it easier to migrate gltf_viewer into tools.

This is not a rewrite of FilamentApp, just a baby step.
2020-04-03 16:28:38 -07:00
Romain Guy
17dd44fd91 Fix documentation bug: the definition of SPOT and FOCUSED_SPOT was inverted. 2020-04-03 15:53:33 -07:00
Philip Rideout
26297feba7 WebGL: fix typo in default SSAO options. 2020-04-03 12:37:40 -07:00
Philip Rideout
05bc60f953 Bump version number to 1.5.2 v1.5.2 2020-04-02 17:15:04 -07:00
Ben Doherty
df2caf4f62 Expose setCulling to public RenderableManager API (#2331) 2020-04-02 17:07:19 -07:00
Philip Rideout
2dbe0b64be gltfio misc fixups 2020-04-02 14:54:19 -07:00
Philip Rideout
c79f5a1a29 JobSystem: replace TLS with tid mapping. 2020-04-02 14:53:20 -07:00
Philip Rideout
e072e30841 Expose Engine's JobSystem. 2020-04-02 14:53:20 -07:00
Pixelflinger
aa770d54ae fix a potential use-after-free
It's possible for a timer query to be destroyed before the result is
known, in this case, we don't want to write through that pointer!
2020-04-02 12:02:21 -07:00
Romain Guy
559642d54c Move IBL settings in their own category 2020-04-02 10:49:07 -07:00
Philip Rideout
583157d4ef Remove vk_ prefix from desktop samples. 2020-04-02 09:06:50 -07:00
Philip Rideout
44422b3d69 Remove gltf_baker and related libraries. 2020-04-02 09:06:29 -07:00
Philip Rideout
f084e50829 Remove old bloom samples to avoid confusion.
These should not be confused with our core bloom feature. For testing
the RenderTarget API, it would be better to create a small focused demo.
2020-04-02 09:05:36 -07:00
Pixelflinger
e8a7d9f0c2 add support for timer queries in the backends
This adds a simple query API to the backend.
There are 2 methods to create/destroy queries, which are
essentially futures.  And 3 methods to mesure elapsed time:
beginTimerQuery/endTimerQuery and getTimerQueryValue.
The begin/end pair is not nestable.

On the GL backend side, there are 2 implementations of this, one uses
arb_timer_query or disjoint_timer_query, the other uses fences.
We need both implementations because on some GPUs, including
qualcomm's elapsed-time timer query is useless, as it measures
cpu time. 

Metal/Vulkan implementations will be part of subsequent PRs. Vulkan
will be able to implement this with vkWriteTimestamp which is
reported to be accurate.

An immediate benefit is that we can now get frame times on MacOS, which
should allow it to use dynamic-resolution.
2020-04-01 22:18:50 -07:00
Pixelflinger
a389de3deb enable dynamic-resolution in android gltf viewer 2020-04-01 22:18:50 -07:00
Romain Guy
06eca637b0 Remove a mul from specular AO computations 2020-03-31 22:55:05 -07:00
Romain Guy
201bd2c845 Fix release action v1.5.1 2020-03-31 18:09:29 -07:00
Romain Guy
e6500a8b3b Update web docs 2020-03-31 18:07:40 -07:00