Commit Graph

3086 Commits

Author SHA1 Message Date
Ben Doherty
d14e29d4d3 Audit material variants (#2948) 2020-08-13 10:58:27 -07:00
Pixelflinger
afaac3f18c Allow color-gradding-as-subpass with TAA
while support for this is added, this is disabled because
it is actually ~0.5ms slower on qualcomm devices.
2020-08-12 22:25:10 -07:00
Philip Rideout
68c647abdb Metal: use explicit shader fixup for clip space Z.
This is more similar to the Vulkan shader pipeline and less magical.

There are 3 places in our shader code where we perform fixups like this:

- main.vs
- depth_main.vs
- post_process_getters.vs

That last one needs no change since it does not involve Z.
2020-08-12 21:12:42 -07:00
Pixelflinger
7852a9b8cb Add public APIs for texture 3D and texture 2D arrays
Also cleanup all setImage() error reporting. All error checks are
changed from silent to NON_FATAL_ASSERT, which means they'll throw
if exceptions are enabled or do a no-op and log a message otherwise.

Also added more precondition checks.
2020-08-12 17:32:46 -07:00
Philip Rideout
acdb8addfd Vulkan: enforce constraints for scissor / renderArea / blit. 2020-08-12 16:55:18 -07:00
Ben Doherty
faa785f3f6 Switch to C++17 (#2940) 2020-08-12 15:21:39 -07:00
Philip Rideout
a0a8d62587 Vulkan: fix rotation on Android. 2020-08-12 13:25:08 -07:00
Pixelflinger
681f8fae2e fix incorrect assert in GL backend
Fixes #1966
2020-08-12 12:54:18 -07:00
Philip Rideout
4d48cac0aa Vulkan: fix regression with window resizing. 2020-08-12 10:31:37 -07:00
Richard Chang
4d51042170 Add back proguard file for Android (#2933)
* Add back proguard file for Android and update README.md

The proguard-rules.pro file provided by Jeff McGlynn (9fe60a636)
works perfectly for Android projects with minifyEnabled.
Add the config file back to the repository and update README.md
to help other Android users setup release build.

* Refine android proguard file and remove proguard section in README.md
2020-08-12 10:08:53 -07:00
Philip Rideout
2dec7f7996 Fix Windows build. 2020-08-11 18:29:52 -07:00
Philip Rideout
0b653273dc Vulkan: fix zealous frame skipping on Android.
The stride passed to Vulkan for query pools is the stride between
queries, not the stride between individual values. I realized this after
seeing the SwiftShader implementation of queries.

I also used log statements to confirm that this fixes bogus frame
skipping on my Pixel 4.
2020-08-11 16:52:07 -07:00
Philip Rideout
b45d45048c Vulkan: fix Android after pause / resume.
This fixes the visual hang that would occur after going to the task
switcher and back.

After recreating the swap chain, all of its associated fences and sync
objects become invalid. Since we were not tracking this, FrameSkipper
was going into an infinite wait after the swap chain was created.
2020-08-11 16:51:45 -07:00
Philip Rideout
fb8c51c5e1 Fix resizing issues with MoltenVK.
This removes the old getClientExtent stuff that I added a while back,
and replaces it with the strategy espoused by the MoltenVK author found
here:

https://github.com/KhronosGroup/MoltenVK/issues/428

I tested this PR on macOS with Vulkan and Metal. I tested both on high
and low DPI displays. I also tried dragging the window between the two
displays.

Android still has issues with rotation, I will deal with that next.

cleanup
2020-08-11 16:51:23 -07:00
Pixelflinger
6a47924482 make use of textureLodOffet where appropriate
this really makes the code easier to read and has a chance to be
more efficient
2020-08-11 10:39:56 -07:00
Philip Rideout
8fdcd8fa62 Vulkan: allow blit to default render target.
This fixes a null pointer exception that we saw after disabling several
View -process effects.
2020-08-11 09:24:29 -07:00
Philip Rideout
6b6f80562f Vulkan: add null checks for Molten. 2020-08-11 09:24:29 -07:00
Pixelflinger
08e411aeac API CHANGE: make ssao options work like all other options
setAmbientOcclusion (and associates) is now deprecated (but still works),
in favor of the new .enabled field in AmbientOcclusionOptions.
2020-08-10 17:23:03 -07:00
Pixelflinger
b3c57a4ee1 add TAA controls in material_sandbox 2020-08-10 13:30:05 -07:00
Pixelflinger
0947f80974 TAA: tweak quality parameters for mobile
on mobile we only use the variance box instead of
min/max+variance, this saves a few hundred us.
2020-08-10 11:14:34 -07:00
Pixelflinger
8155bf04a8 Implement variance clamping
variance clamping further shrinks the min/max AABB
2020-08-10 11:14:34 -07:00
Pixelflinger
815483c5e0 execute structure pass before TAA
This fixes a lot of flickering when SSAO and TAA are enabled.
SSAO TAA shouldn't be done based on a jittered depth buffer, but
rather on jittered samples.
2020-08-10 11:14:34 -07:00
Pixelflinger
05bfa632ff Add TAA java bindings 2020-08-10 11:14:34 -07:00
ruitaocc
931daf3a69 fix typo 2020-08-10 08:58:24 -07:00
Pixelflinger
4821a95f16 Implement basic tamporal antialiasing (TAA)
while this started as a sample to demonstrate how to use the new
frame history feature, this is now solid enough to become a feature.

this version of TAA doesn't use motion vectors, so it is prone to
various artifacts (e.g. ghosting). It also has the typical issues
TAA has (e.g. transparents).

with that said, performace is good and quality is overall superior
to FXAA or MSAAx4.
2020-08-07 20:51:46 -07:00
Romain Guy
4c0a5b5f1d CMake cleanup 2020-08-07 14:21:27 -07:00
@roxlu ☾
4ba95428c2 New options that allow you to specify the buffer sizes. (#2925)
* New options that allow you to specify the buffer sizes.

* Removed debug info

* Style/location fixes
2020-08-07 14:17:44 -07:00
Philip Rideout
732a6c08de Add Texture getters to IndirectLight and Skybox.
Fixes #2851.
2020-08-07 11:49:24 -07:00
Romain Guy
0584cea125 Update website 2020-08-07 11:02:38 -07:00
Romain Guy
058c9cd28b Update docs 2020-08-07 10:55:11 -07:00
Romain Guy
2ce3b88a13 Fix ccache scripts 2020-08-07 09:03:51 -07:00
Philip Rideout
c7c1c01a0e JavaScript: fix typo in clearAssetCache. 2020-08-06 16:47:29 -07:00
Philip Rideout
827e73b682 JavaScript: add clearAssetCache helper. 2020-08-06 16:41:35 -07:00
Philip Rideout
7ada8372f2 gltf_viewer: fix ColorGrading leak. 2020-08-06 15:12:53 -07:00
Philip Rideout
749a4d01af gltfio: fix some small memory leaks.
This fixes two oversights in the FilamentAsset destructor:

- Destroy the faux root Entity.
- If it exists, remove the name component from each Entity.
2020-08-06 15:12:53 -07:00
Philip Rideout
f4004cf047 JavaScript bindings: fix a frequent 4-byte memory leak.
In retrospect, I should've exposed ints to JS instead of entities.
Making this fix is already a TODO, but it will be a tedious change. For
now, this PR fixes two issues that were causing tiny but frequent memory
leaks, according to the emscripten memory leak widget.

(1) Do not include Entity in the list of classes that should only be
passed around by pointer.

(2) Clients should always call delete() on returned Entities.
2020-08-06 14:45:28 -07:00
Philip Rideout
dc74ee2ddc Refactor CallbackUtils. 2020-08-05 17:27:12 -07:00
Philip Rideout
2727cddd7a TextureHelper: add overload with a release callback.
Fixes #2909.
2020-08-05 17:27:12 -07:00
Pixelflinger
4f239c3e3c fix a moveResource which was broken recently
a recent fix actually badly broke moveResource, we were using the
index of the newly created resource instead of the pass index.
2020-08-05 13:10:16 -07:00
Philip Rideout
4bf0d0c0a8 Web: Remove broken webpack example.
This example has fallen out of date, I tried to resurrect it but it
turned out to be non-trivial, given the special nature of emscripten's
generated JavaScript wrappers.

It might be better to provide an example that uses rollup, since that's
the bundler that model-viewer uses, or a simple TypeScript example.

For now, I think our simple HTML + raw JS samples are sufficient.
2020-08-05 11:19:08 -07:00
Pixelflinger
d70f1c0ab2 Infrastructure for frame history data
We can now save an arbitrary (but decided at compile time) number of
entries containing information about previous frames and it for while
drawing the current frame. Typically this is used for such effects as
TAA, screen-space reflection, building probes over time, etc...

Currently the frame history consists of one frame per View. FView 
provides a new (internal) getFrameHistory() method used to access
previous frames entries as well as to save the current's frame
information.

The FrameGraphPassResources (which is available in the execute closure
of a FrameGraph pass) has a new detach() method which can be used to
remove that resource from the FrameGraph lifetime management, at which
point it becomes the responsibility of the caller. Typically this
resource will be stored in the frame history.
2020-08-04 15:01:09 -07:00
Pixelflinger
991861a512 make fg resources creation/destruction more generic
creation/destruction now takes a ResourceAllocatorInterface instead of
a FrameGraph.
2020-08-04 15:01:09 -07:00
Pixelflinger
d0367a359b move ResourceAllocator out of the fg namespace 2020-08-04 15:01:09 -07:00
Mathias Agopian
d2be23045f fix a FG crasher when we have more than 32 passes (#2911)
The FrameGraph cannot store pointers internally because all objects
are stored in vectors. Unfortunately we were storing the writer of
resources as a pointer. 

This is fixed by storing an index instead.
2020-08-04 15:00:38 -07:00
Ben Doherty
4cb903a09e Fix variant-limiting bug in matdbg (#2903) 2020-08-03 11:16:33 -07:00
Philip Rideout
3ca0a8cd8d Transmission should use FADE. (#2908)
Fixed #2907.
2020-08-03 10:51:26 -07:00
Philip Rideout
2c18d7f576 Revert "Transmission should use FADE."
This reverts commit 379f92417f.
2020-08-03 10:45:46 -07:00
Philip Rideout
379f92417f Transmission should use FADE.
Fixed #2907
2020-08-03 10:44:15 -07:00
Ben Doherty
13574f793c Run MergeReturnPass only on mobile (#2901) 2020-07-31 18:40:47 -07:00
Ben Doherty
f69ba63046 Don't crash for invalid Metal programs when using matdbg (#2902) 2020-07-31 18:39:57 -07:00