Commit Graph

2797 Commits

Author SHA1 Message Date
Romain Guy
28f031e95f Update RELEASE_NOTES.md 2020-05-27 10:52:04 -07:00
Jaime Blasco
5104318fff Initialize DisplayHelper when using textureView in ModelViewer (#2598) 2020-05-27 10:10:13 -07:00
Pixelflinger
68f0ab6312 Implement ACES tone mapping
this leverages the new LUT based tone mapping
2020-05-26 23:46:37 -07:00
Pixelflinger
62a591bc73 Add a new tone mapping option using a LUT
This is now the default, and the tone mapper used
is now the same on desktop and mobile.
In the future this will allow us to implement many features such as
color grading at no cpu cost.
2020-05-26 23:46:37 -07:00
Benjamin Doherty
0f6a06a2e1 Add 3D texture support to Metal 2020-05-26 23:46:17 -07:00
Pixelflinger
b620a5e358 Add support for 3D textures in the vulkan backend 2020-05-26 23:45:35 -07:00
Pixelflinger
0d652d61f8 fix typo causing textureGather to always be used 2020-05-26 17:59:01 -07:00
Ben Doherty
1b033c7de3 Implement MRT for Metal (#2590) 2020-05-26 17:38:37 -07:00
Pixelflinger
eb5eb6c827 fix EGL config selection 2020-05-26 17:22:30 -07:00
Philip Rideout
0e437d244f Vulkan: fix dummy type for disabled attribs.
OpenGL allows vertex shaders to consume attributes that are never
assigned values from a vertex buffer. When this occurs, GL provides a
default zeroed-out value, or a value from the most recent call to
`glVertexAttrib*v`.

Vulkan does not allow this, so our Vulkan backend provides dummy data by
re-using the position buffer, which we know exists. This was an existing
hack, but it did not always assign a compatible type, which resulted in
validation spew with gltf_viewer + BusterDrone.

This fixes one of the two bugs reported in #2573.
2020-05-26 13:20:06 -07:00
Philip Rideout
9024b4afd7 gltfio: fix vertex attribute type mismatch.
Vulkan complains if a pipeline declares an integer vec2 attribute but
the shader consumes it as "vec2" rather than "ivec2". gltfio was doing
this when supplying dummy texture coordinates.

This fixes one of the two bugs reported in #2573.
2020-05-26 13:19:52 -07:00
Pixelflinger
62ff7b7d0a Improve AO buffer upsampling
Since AO is computed at 1/4 resolution, it is necessary to upsample
the AO buffer. Until now this was done with a bilinear tap, which is
less than ideal as it can creates jaggies at edges.

High quality upsampling can now be enabled and uses a bilateral filter.
The cost is about 2.0 ms at 250MHz on Pixel 4. ES3.1 is required.
2020-05-26 12:59:47 -07:00
Pixelflinger
d1ed4f837c improve SSAO quality
SSAO starts at 1/4 resolution, and because we used derivatives
to calculate a cheap pre-blur, the output was mostly 1/4 resolution
of that, leading to 1/4 of the destination pixels being mostly identical.
This, in turn caused sampling issues when reading the SSAO buffer during
the color pass.

We fix this by getting rid of the pre-blur, and increasing slightly the
size of the gaussian blur from 9 samples to 13, which increases the
SSAO pass time by 20%, or 0.3ms at 430 MHz on Pixel 4.

With this change and bilinear filtering in the color pass, we get rid
of all the sampling artifacts.
2020-05-26 12:59:47 -07:00
Pixelflinger
d62f664957 ssao: restrict the scaling to 0.5 and 1.0
until now we allowed any resolution for SSAO, but it didn't make
much sense, especially that the depth pass is now used for other things.
To keep things more manageable, we only allow 0.5 and 1.0 scale
factor settings (respectively quarter and full resolution).
2020-05-26 12:59:47 -07:00
Philip Rideout
6311b538e1 Add "if" when compiling subpass material.
This avoids error spew on some platforms such as Chrome + WebGL 2.0
2020-05-26 11:03:55 -07:00
Philip Rideout
58bb1f61e6 Add JS bindings for DoF.
Adding this for completeness, although the feature triggers a known
issue with Chrome's WebGL implementation that emits an error when
source and destination textures of a draw call are the same.
2020-05-26 10:06:40 -07:00
Mathias Agopian
8415d18401 Fix refracted objects drawing order (#2577)
Refracted objects could be drawn on top of opaque objects that were
closer to the camera.

Du to a typo, we were not reusing the existing depth buffer during the
refraction pass.

Fixes #2576
2020-05-23 17:08:53 -07:00
neshume
6df1265bef Fix compilation issues under ubuntu 20 and latest clang (#2562)
Co-authored-by: neshume <alex.andel@gmail.com>
2020-05-23 17:08:19 -07:00
Philip Rideout
dc51dc197c Gradle: update old property name.
I forgot to update this in 0b1fa7f.
2020-05-22 23:28:30 -07:00
Philip Rideout
1292610289 Vulkan: fix synchronization issues with timestamps.
This contains the following two fixes, but the second fix is more
important because it prevents an actual validation error on Android.

1. The query pool bitset was written in the main thread but read
   in the driver thread, this is now protected with a mutex.

2. Querying a timestamp before it has been written into the command
   buffer was still causing validation errors, despite the fact
   that we are now properly using the AVAILABILTY flag. This is a
   CPU-side synchronization problem and can therefore be fixed using
   std::atomic<bool>.
2020-05-22 15:40:37 -07:00
Romain Guy
e9d1e3a82e Stop using deprecated APIs for incremental builds (#2574) 2020-05-21 22:15:55 -07:00
Philip Rideout
c749f7e798 Emit a one-time warning for VK_SUBOPTIMAL_KHR.
This was sometimes causing a cascade of log messages and swap chain
re-creations on Android.

To support resizing, we still re-create the swap chain when encountering
VK_ERROR_OUT_OF_DATE_KHR.

Suboptimal means: "A swapchain no longer matches the surface properties
exactly, but can still be used to present to the surface successfully."
2020-05-21 15:04:08 -07:00
Romain Guy
f5068457f2 Update README.md 2020-05-21 14:44:34 -07:00
Pixelflinger
3a3cd1c0ec Better fix iOS lack of GL_EXT_multisampled_render_to_texture 2020-05-21 11:49:54 -07:00
Philip Rideout
7dfe26def8 Vulkan: update instructions for enabling validation. 2020-05-21 11:29:27 -07:00
Philip Rideout
3b3dc0af81 Vulkan: refactor the ENABLE_VALIDATION flag.
It is convenient to control the debug_info extension and the validation
layers from one central place. This makes it easier to force-enable
validation in Release builds to validate optimized shaders.
2020-05-21 10:46:53 -07:00
Philip Rideout
0e38cc770d filamat: generate spirv 1.0 rather than spirv 1.3
Since we are still on Vulkan 1.0, we cannot use SPIR-V 1.3.
If we try to do so, this error is generated:

    Invalid SPIR-V binary version 1.3 for target environment SPIR-V 1.0

In non-optimized builds, we were already generating spirv 1.0, but
when we enabled the shader optimizer, we generated spirv 1.3.

This bug has actually been around forever, but we did not notice because
we were only invoking the optimizer in release builds, which does not
enable validation.

We cannot upgrade Vulkan 1.1 because the latest LunarG SDK for macOS
does not support it.
2020-05-21 08:41:53 -07:00
Ben Doherty
c0eb058728 Shadow cascades: adjust near / far planes to tightly bound scene (#2537) 2020-05-20 16:31:13 -07:00
Pixelflinger
8b515ee4c2 Make MSAA fast(er) again on Mobile
Due to a typo that became relevant when we switched the gles headers to
3.0 from 3.1, MSAA started to take the emulated path.
2020-05-20 11:53:27 -07:00
Philip Rideout
65e286e7de Vulkan: fix version selection. 2020-05-19 17:58:21 -07:00
Philip Rideout
cdd099951a sample-page-curl: add rigidity parameter. 2020-05-19 16:48:55 -07:00
Philip Rideout
432ed50cb3 sample-page-curl: use inverseTonemap() etc. 2020-05-19 16:48:55 -07:00
Philip Rideout
d4a396d52f matinfo / matdbg: fix SPIRV version, add validation.
The value we pass to spvContextCreate() is not SPV_ENV_UNIVERSAL_1_3,
which is what we use in GLSLPostProcessor.

Also add a call to spvValidateBinary(), which would have caught this
oversight.
2020-05-19 16:48:36 -07:00
Ben Doherty
97c9ad7599 Metal: implement lod clamping to fix IBL bug (#2556) 2020-05-19 15:40:07 -07:00
Philip Rideout
15e2447cb5 Vulkan: fix usage of timestamp queries. 2020-05-19 14:17:03 -07:00
Philip Rideout
21ed172c55 Vulkan: add support for sync objects.
This allows FrameSkipper to work on desktop.

Similar to the GL backend, we can only query the fence from tick().
The Vulkan spec stipulates that a fence object cannot be accessed by
more than one thread simultaneously. My initial implementation violated
this, which was caught by the validation layer.
2020-05-19 14:16:07 -07:00
Pixelflinger
c619f089e7 add support for 3D textures
Only gl backend in this PR.
2020-05-19 14:09:16 -07:00
Pixelflinger
29db39b6a7 Use a subpass for tone mapping when possible
This allows to never store/load to main memory the HDR color buffer,
saving precious bandwidth. This mode relies on the
ext_framebuffer_fetch extension being present and can't be enabled
with certain features (currently msaa, Bloom, DoF).

This will eventually be supported on Metal and Vulkan as well.
2020-05-19 12:25:41 -07:00
Pixelflinger
b50f7dd7de Add isFrameBufferFetchSupported() to the backend API 2020-05-19 12:25:41 -07:00
Pixelflinger
6df20f3083 Add a private property to materials to control framebuffer_fetch
this is intended to be temporary until we properly add support
for vulkan's subpasses. this PR just helps us activate
ext_framebuffer_fetch on select materials.
2020-05-19 12:25:41 -07:00
Philip Rideout
5f34b8974f Fix buffer size bug in sample-page-curl. 2020-05-18 14:34:46 -07:00
Ben Doherty
bf13f76dea Fix, Metal validation error with SSR and post-processing turned off (#2550) 2020-05-18 13:17:37 -07:00
Philip Rideout
92048e6b65 filagui: Fix "1 leaked FScene" warning.
Fixes #2542.
2020-05-18 11:51:23 -07:00
Ben Doherty
c37c04762d Fix Metal memory leak inside MetalTimerQuery (#2548) 2020-05-18 11:48:16 -07:00
Pixelflinger
53a8fd94ba get rid of our details namespace
in practice it wasn't really useful, and it'll save some binary
space. everything is still isolated in the filament namespace.
2020-05-18 10:51:46 -07:00
Philip Rideout
b4d16ab3b5 Tweak WebGL build settings. 2020-05-18 10:02:21 -07:00
Philip Rideout
0b1fa7fc80 Enable Vulkan for Android by default.
The presence of a special Gradle property is now used to exclude Vulkan
support from the build. By making Vulkan "always on" for local
development, we can avoid stale CMake cache issues that arise from
toggling the Gradle property. It also lets you avoid adding the flag
to Android Studio preferences.

This is motivated by testing and does not indicate production readiness.
Clients still need to pass VULKAN into the Engine constructor to select
the Vulkan backend.

To keep APK size down and keep CI fast, we are continuing to exclude
Vulkan from official Android builds.

After syncing this change, you might need to use `./build.sh -c` to
clobber various build caches.
2020-05-18 09:34:55 -07:00
Romain Guy
010ce1c069 Update README.md 2020-05-16 14:33:07 -07:00
Romain Guy
f6c3663789 Update RELEASE_NOTES.md 2020-05-16 14:32:17 -07:00
Philip Rideout
d49d0f1762 Add JavaScript bindings for setVisibleLayers. 2020-05-15 12:53:02 -07:00