Commit Graph

4737 Commits

Author SHA1 Message Date
Ben Doherty
ffe4b7390d Correctly prepare color grading as subpass programs (#5384) 2022-03-30 16:25:27 -07:00
Mathias Agopian
604d3e34a4 avoid an extra copy during the screen-space reflection pass
unlike for refraction, the reflection buffer is distinct from "the"
color buffer, this allows an optimization (compared to ssr) when we
generate the mipmap chain -- we can allocate the mipmaped texture
and render the SSR pass directly into its level 0. This achieved
use the framegraph's forward resource feature.
2022-03-30 15:32:52 -07:00
Mathias Agopian
e116dd4aec Improve framegraph forward resource API
This add a couple methods to allow the creation and forwarding in a
single call.
2022-03-30 15:32:52 -07:00
Mathias Agopian
d53614fb0a fix a framegraph crash when forwarding a subresource
the crash would happen when forwarding a subresource of a subresource,
because in this case the parent's handle would be reset to the null
handle.
2022-03-30 15:32:30 -07:00
Mathias Agopian
c91e5df117 Add comment about how we calculate the viewport when upscaling 2022-03-30 08:58:50 -07:00
Philip Rideout
96574816b3 Fix 12x overallocation of memory in MorphTargetBuffer.
I noticed this while helping someone at Google understand our new API.
2022-03-30 08:24:40 -07:00
Mathias Agopian
b43a609ebc rename framegraph fg2/ folder to fg/ 2022-03-29 14:38:36 -07:00
Benjamin Doherty
2c490ec799 Release Filament 1.20.5 2022-03-28 18:44:56 -07:00
Mathias Agopian
fbb08d338a repair the flare pass on WebGL 2022-03-28 17:01:07 -07:00
Mathias Agopian
8e1718458a remove all references to the "Blackboard" from PostPorcessManager
This makes the code simpler to follow.
2022-03-28 16:23:52 -07:00
Philip Rideout
6bcd709320 gltfio: add support for KHR_materials_emissive_strength 2022-03-28 12:57:08 -07:00
Mathias Agopian
1a6e3ec88e batch all program linking at begin renderpass time
With this change, shaders are compiled at program creation, programs
are linked at the start of the next render pass and queries are
deferred until first use.

This should improve overall performance on some drivers.
2022-03-26 13:36:35 -07:00
Mathias Agopian
f5f50eca06 programs must now be created outside of renderpasses
from now on, the backends can assume that programs are created outside
of begin/endRenderpass.
2022-03-26 13:35:48 -07:00
Mathias Agopian
886fb7fb94 fix build 2022-03-26 13:35:18 -07:00
Philip Rideout
a82b3bedb2 gltfio: material variants can now be applied to FilamentInstance. 2022-03-25 16:47:59 -07:00
Mathias Agopian
d879bbc80a Simplify OpenGLProgram sampler bindings
This reduces the size of OpenGLProgram from 64 to 32 bytes and
improves the code that sets new samplers.

The main simplification is that we're not trying to "pack" the 
texture units used in the program. For e.g. we could be using
units 0,3,4, where before it would be 0,1,2.
This allows us to do less tracking.

Another optimization is that we're discarding entirely a SamplerGroup 
if the program doesn't use any of its samplers. This helps remove
a test in updateSampler which in turn remove somem tracking data.
2022-03-25 15:35:53 -07:00
Mathias Agopian
bf437b7933 defer gl program link + query to first use (draw)
in an upcoming PR we'll move linking back a bit earlier to allow
more batching.
2022-03-25 13:47:31 -07:00
Mathias Agopian
49dff3c439 log shader source code in debug build on error 2022-03-25 09:40:11 -07:00
Mathias Agopian
0d6c017cfb cleanup OpenGLProgram
This is the first step before we defer a lot of the glGet* calls.
2022-03-25 09:40:11 -07:00
Philip Rideout
ba042db3f4 gltfio Java: add getMorphTargetNames for consistency with other methods.
Tested by hacking ModelViewer.
2022-03-24 19:23:14 -07:00
Philip Rideout
faeba6ad95 gltfio: add support for KHR_materials_variants
Tested the Java API by hacking ModelViewer.
Tested the JavaScript API by adding to filament-viewer-test.
2022-03-24 19:23:14 -07:00
Philip Rideout
163e28ca7a Update public web demos (fixes helmet demo) 2022-03-24 16:10:14 -07:00
Philip Rideout
3dbc168d76 Use newer package for LitElement. 2022-03-24 16:04:43 -07:00
Ben Doherty
fe49946852 Metal: support blitting from 2D texture arrays (#5357) 2022-03-24 11:38:51 -07:00
Mathias Agopian
6310ea46e3 fix dummy ssr history texture target type 2022-03-23 20:47:20 -07:00
LaiJF
ef8e3e5224 Fix typo. (#5355)
* Fix typo.

* Update filament/src/RenderPass.cpp

Co-authored-by: Romain Guy <romain.guy@gmail.com>

Co-authored-by: Mathias Agopian <pixelflinger@gmail.com>
Co-authored-by: Romain Guy <romain.guy@gmail.com>
2022-03-23 11:29:07 -07:00
Mathias Agopian
26cc722f74 remove SPVRemaper lib, fold it into glslang directly
This avoids a duplication of doc.cpp, the largest compilation unit
(about 650KiB).
2022-03-23 11:27:30 -07:00
Philip Rideout
043fdf7a51 Remove lite flavor from android-utils.
We noticed that the lite flavor isn't actually smaller, plus we need to
rework our Android library hierarchy anyway, so for now let's remove
this.
2022-03-23 11:18:25 -07:00
Mathias Agopian
c01105b49a Fix shadow frustum computation wrt projection matrix
Instead of recomputing the Frustum from its 8 vertices, we compute it
from the projection matrix directly. This ensures this works with any
projection matrix.  Building a Frustum object from 8 vertices required
these vertices to be given in a certain order which wasn't correct if
the projection was flipped for instance.

Removed the API to construct a Frustum from vertices.

fixes b/225975881
2022-03-23 09:41:14 -07:00
Philip Rideout
f56f5a300c Temporary workaround for WebGL builds on macOS.
Better fix is to replace etc2comp and astcenc with basis.
2022-03-22 22:21:57 -07:00
Mathias Agopian
8b79f3683e skip work when morphtarget weight is zero
fixes #5344
2022-03-22 22:21:41 -07:00
Benjamin Doherty
319bd123ce Fix, use zero texture array when SSR is of 2022-03-22 22:21:14 -07:00
Benjamin Doherty
e23243a65b Fix build breakage on Windows 2022-03-22 20:43:50 -07:00
Mathias Agopian
c4261a8c10 hide ostream implementation details into ostream.cpp
Fixes #5343
2022-03-22 16:14:13 -07:00
Mathias Agopian
009b58537e move BuilderBase to libutils and rename to PrivateImplementation 2022-03-22 16:14:13 -07:00
Mathias Agopian
e51709a4e8 Size optimizations in UniformInterfaceBlock 2022-03-22 15:28:40 -07:00
Mathias Agopian
78813ed9b7 get rid of ShaderStageFlags.h
move its content to DriverEnums.h, we do this because it is used
in libfilabridge, which has an unspoken rule that it only includes
DriverEnums.h.

filabridge also only has a header dependency, so it can't call any
method, not even operator<<.

Also cleanups and simplifications.
2022-03-22 15:28:40 -07:00
Mathias Agopian
2e649a9f16 size optimizations and cleanups of SamplerInterfaceBlock 2022-03-22 15:28:40 -07:00
Mathias Agopian
d36783cd1d cleanup a bit metal codegen for samplers
the main change here is that we actually go through all "binding points"
instead of hardcoding the ones we currently use.
2022-03-22 15:28:40 -07:00
Philip Rideout
101a59138c Update the zbloat tool
The tool now works with Python 3 and handles binaries that have multiple
embedded material archives.
2022-03-21 16:13:49 -07:00
Benjamin Doherty
3809259f47 Release Filament 1.20.4 2022-03-21 14:45:00 -07:00
Mathias Agopian
e103b28b41 The backend CANNOT depend on filabridge
This would mean that the backend is not independent of our material
system. Thankfully we didn't have too many dependencies that leaked
there.
2022-03-21 13:55:15 -07:00
Mathias Agopian
8e7d0c0df9 Fix a bug in Invocable that prevented function signatures that returned references from working 2022-03-21 13:55:15 -07:00
Mathias Agopian
d8845e5fcc greatly simplify SamplerBinderMap
The main simplification is that we don't need an actual map to retrieve
the global offset of a sampler, it can be easily calculated as:
  global_offset = offset_of_the_block + local_offset
2022-03-21 10:54:00 -07:00
Mathias Agopian
b2ed544ee8 More cleanups in PostProcessManager 2022-03-21 10:46:55 -07:00
Mathias Agopian
a40ee77326 minor cleanups 2022-03-21 10:46:55 -07:00
Mathias Agopian
85135e60c7 Switch SSR texture to 2D array
At this point there is no benefit from doing this, but we'll need this
in a later PR.
2022-03-21 10:46:55 -07:00
Mathias Agopian
bee9f160fa gaussian passes now handle 2d arrays better
Instead of passing the level and layer explicitly to gaussianBlurPass,
we rely on the information already contained in the handle. i.e. we
honor the "subresource" part of the handle (if it has one).
In other words, it's now possible to pass a subresource (e.g. a layer)
to generateGaussianMipmap or gaussianBlurPass and things should work as
expected.
2022-03-21 10:46:55 -07:00
Mathias Agopian
64c67258b0 fix FrameGraph dependency issue
The problem here would happen when forwarding a subresource (i.e. 
replacing an existing resource by a subresource) and the existing
resource had been written to. In this situation, the subresource's 
parent needs to depend on the subresource (i.e. as if it was written to
by it). This would normally happen during write() but in this situation,
the write had already happened.
2022-03-21 10:46:39 -07:00
Mathias Agopian
49e0f484e9 fix a framegraph dependency issue
the dependency graph would be incorrectly severed in the situation where
a subresource was written to and later its parent was read from.
In this situation, the parent node is in fact a new version of the 
original parent node, so we need a "read" dependency of the orginal to
the copy (otherwise the orginal node is not a dependent of anyone
and gets culled).
2022-03-21 10:46:39 -07:00