Commit Graph
2595 Commits
Author SHA1 Message Date
Pixelflinger cb5fcbc784 get rid of the static list of Engines
Originally it was used for validating the Engine* used, but this
makes no sense (no reason to validate this pointer more than any
other one).

The list also made sure that Engine instances were automatically 
destroyed when the filament library was unloaded, but again, there
is no reason to do this -- it's C++ after all!
2020-04-14 18:48:40 -07:00
Mathias Agopian ca7ef8cbae Fix point/spot lights when viewport is not in 0,0 (#2392)
the problem was that the actual viewport's origin can be different
from the viewport set by the user, for instance when the view is
rendered in an intermediate buffer.
2020-04-14 18:48:04 -07:00
Pixelflinger ed326e1e68 Implement texture swizzling 2020-04-14 18:46:21 -07:00
Romain Guy 8094955fc1 Add new tool cso-lut (#2394)
* Add new tool cso-lut

This tool is for internal usage only. It computes a 3D lookup table
for cone/sphere occlusion computations. These can be used to implement
specular occlusion, directional ambient occlusion, etc.

* Improve generated comment

* Fix Windows build
2020-04-14 18:22:56 -07:00
Pixelflinger d31f57eb22 ssao blur: don't forget to attach the depth buffer
the depth buffer in this case is only used for 
skipping the skybox
2020-04-13 15:54:44 -07:00
Pixelflinger ada5444997 fix issues with ignoring beginFrame() return value
ignoring beginFrame() return value is allowed, but doing so would
leave filament in an invalid state.

we now make sure that we don't execute any code after determining whether
the frame should be skipped, and execute the remainder of beginFrame() 
upon the first call to render(View*).

We also make sure the FrameSkipper can deal with its endFrame() being 
called when the current fence hasn't signaled.
2020-04-13 15:54:29 -07:00
Romain Guy 3c26c2cec1 Fix another typo 2020-04-13 15:47:43 -07:00
Romain Guy 7cdc0c032f Fix typos 2020-04-13 14:27:31 -07:00
Philip Rideout 854fcc7eac Desktop samples now use default backend.
There is nothing specific to Vulkan in these tests, I meant to remove
the backend override when I removed the `vk_` prefix last week.
2020-04-13 13:55:32 -07:00
Ben Doherty 0e82fdbddd Use the correct size for the ImGui glyph atlas (#2386) 2020-04-13 12:56:55 -07:00
Ben Doherty f26b761d72 Revamp MetalFence and implement Metal sync objects (#2380) 2020-04-13 10:22:42 -07:00
Philip Rideout 167493b85c Update Skybox / Clear API for web. 2020-04-10 17:06:47 -07:00
Pixelflinger 7fc60db151 update Release Notes 2020-04-10 17:05:40 -07:00
Mathias Agopian 1b36f82c1e API BREAKAGE: this change aims to fix multi-view support (#2376)
* API BREAKAGE: this change aims to fix multi-view support


What has changed:
- View doesn't have a notion of clear color anymore
- View doesn't have a notion of discard flags anymore
- The clear color and color-buffer discard/clear flags are moved to Renderer
- Skybox can now be set to a constant color
- View have a blend-mode

What does is all mean:
"Clearing" (i.e.) setting its background is now handled by Skybox, by
setting a constant color to the Skybox. This should take care of
drawing views side by side.

When a view needs to be drawn on top of another, it's BlendMode needs to
be set to TRANSLUCENT and of course and, generally, it wither won't have
a skybox, or will have one that sets some translucent pixels.

As an optimization, a View with BlendMode::OPAQUE will have its
background cleared with the color specified in Renderer.

If the SwapChain already has some content, it's now possible to set
the Renderer to not discard the content, together with TRANSLUCENT views,
it's possible to draw on top of that content.


It is NOT possible to share depth/stencil buffers between views.

Fixes: #2369, #2372, #2364

* Address reviewers comments.

Note: WebGL is still broken with this PR
2020-04-10 15:54:14 -07:00
Romain Guy 95c8dd0185 Update README.md 2020-04-10 11:26:06 -07:00
Ben Doherty 63801d2460 Implement headless swapchains on Windows (#2374) 2020-04-09 15:09:18 -07:00
Ben Doherty a60ee4914f Fix getRootAssetsPath on Windows (#2375) 2020-04-09 13:01:25 -07:00
Mathias Agopian d4f9ede84b improve DisplayHelper to handle frame rate changes (#2366) 2020-04-09 11:32:22 -07:00
Pixelflinger 6bb909bd0e newly created color buffers were not cleared properly
there were cleared with the view's clear color instead of 0
2020-04-09 11:30:31 -07:00
Romain Guy c5a5d15fe3 Fix Vulkan linking with specific versions of CMake 2020-04-09 08:50:44 -07:00
Romain Guy c69547f8ea Only build x86 and arm64-v8a in presubmit (#2370)
* Only build x86 and arm64-v8a in presubmit

* Pass the ABI arguments to the build script

* Pass comma delimited list to Gradle
2020-04-08 18:43:15 -07:00
Romain Guy 1ef3535ba7 Expose Java API to control discard flags (#2368)
* Expose Java API to control discard flags

This change also adds the new sample sample-multi-view that shows
how to use discard flags to render multiple views.

* Disable clears
2020-04-08 16:03:49 -07:00
Romain Guy 3945c232d7 Build all ABIs by default with Gradle 2020-04-08 15:36:49 -07:00
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