Commit Graph

1366 Commits

Author SHA1 Message Date
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
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
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
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
daemyung jang
d8ea26e305 Update MAX_MORPH_TARGETS to 256 2022-03-18 15:42:02 -07:00
Mathias Agopian
edf78afa8e fix warnings from updating macos toolchain 2022-03-17 15:45:09 -07:00
Ben Doherty
1c5715824f Avoid linking clashes with BlueGL and OpenGL (#5323)
Some clients need to link against both Filament and OpenGL. This can lead to symbol clashes under certain circumstances. As a fix, prefix all of our `bluegl` symbols with `bluegl_`. Previously we made this naming change for Windows, but now we'll do it on all platforms for simplicity.
2022-03-17 11:41:38 -07:00
Philip Rideout
6da46b3b62 Repair A2C for opaque views, add field to FrameUniforms. 2022-03-17 10:01:27 -07:00
daemyung jang
da99fe63be Make public gltfio's math 2022-03-15 09:11:12 -07:00
daemyung jang
d9067af3a3 Retrieve skins from FilamentAsset 2022-03-15 09:10:52 -07:00
LaiJF
f10bedf186 Fix typo. (#5319) 2022-03-14 19:30:57 -07:00
Mathias Agopian
19b0ad2605 fix a race in jobsystem (2nd attempt)
We were decrementing activeJobCount after removing the job from the
queue, which could cause other threads in the pool to preempt us before
the decrement, causing them to spin forever trying to get a non-existant
job, until the decrement actually happened.

Now we always decrement first and fix-up the count if we couldn't get
a job from the queues. The race is inverted, and doesn't cause threads
to spin a long time.


fixes b/201100123
2022-03-14 16:40:02 -07:00
Mathias Agopian
e9718fa346 cleanup attributes/varyings generation
We now have a single varyings.glsl containing our varyings for both
the vertex and fragment shader. This file is included with the right
definition of VARYING as `in` or `out`.

inputs.vs is now renamed attributes.vs
2022-03-10 16:20:18 -08:00
Philip Rideout
81fc2c1d23 Always apply bone matrices, even for non-animated models.
This changes the WebGL and desktop glTF viewers so that they always
call `updateBoneMatrices`, even when there are 0 animations. Note
that our Android sample was already doing this correctly.

When combined with #5301, this fixes #5299, although users would need to
use the `recomputeBoundingBoxes` feature in gltfio (`-r` in the desktop
viewer) for this model to be scaled to fill the viewport, since its
embedded bounds are quite large.
2022-03-10 13:41:35 -08:00
Philip Rideout
dc60f57a9a gltfio: simplify API, make animator always available.
In the past there was an API gotcha because users had to "get" the
animator before releasing the glTF source data. This could have been
surprising because it was a getter method, not a factory method.

This was due to overeager optimization on my part, I wanted to avoid
animator overhead for non-animated models, when in fact it has very
little overhead.

Moreover, the animator is conceivably useful even when there are no
pre-supplied animations (e.g. for applying skins), so let's just create
it unconditionally.

Motivated by #5299.
2022-03-10 11:36:46 -08:00
daemyung jang
166f859c72 Retrieve morph target count from the primitive (#5297)
Morph weights can be zero even if the primitive has morph targets.
2022-03-10 10:56:50 -08:00
daemyung jang
1969186fe1 Compute the rotation between two vectors (#5288)
Co-authored-by: Mathias Agopian <pixelflinger@gmail.com>
2022-03-10 10:42:44 -08:00
Philip Rideout
e1e7854d97 BlueVK: remove flaky operator<< for flags, update GitHub paths.
Two changes:

1) Khronos has moved from "master" to "main".

2) BlueVK was attempting to generate reasonable "operator<<" support for
bit flags but this was buggy due to type aliases. Since we weren't using
it anyway, I simply removed this functionality from BlueVK.
2022-03-08 16:58:21 -08:00
Philip Rideout
9d5220e28e Regenerate BlueVK for Vulkan 1.3. 2022-03-08 16:57:56 -08:00
Philip Rideout
8c46e6de9b matdbg: repair invalid JSON and display of active variants.
The JSON response to /api/active became malformed after #4465 because
raw hex strings need to be enclosed by quotes.

This commit changes the variant format in the /api/materials response
to be consistent with one used for /api/active. By using integers
instead of strings, we're avoiding the need to parse integers at run
time.

The JSON error did not appear in the Chrome console because it was being
silenced as a hack to appease "matinfo --web-server". I fix this by
removing the hack and simply emitting a valid response when there's
no live backend.

Also fixed the display of materials, which were always being marked
as active even when they had no active variants.
2022-03-02 15:01:25 -08:00
Ben Doherty
e2177e8b36 Apply some clang-tidy fixes (#5281) 2022-03-02 11:49:45 -08:00
Mathias Agopian
81c1d3ed1a more code size reduction
The main change here is from ResourceList which ended-up generating
a lot of code due to inlining. This class is only used for tracking
user resources and is not in the performance path.

This saves another ~5K or so of code.
2022-03-01 10:03:31 -08:00
Mathias Agopian
50fa816a6e fight more unnecessary inlining 2022-03-01 10:03:31 -08:00
Philip Rideout
94c59d9d97 libutils: fix inconsistent hash in StaticString
This caused a unit test failure because a StaticString constructed
from "make" had a different hash than one constructed from a literal,
even though the two strings were lexigraphically equivalent.
2022-02-28 15:42:06 -08:00
Mathias Agopian
9e5da2d75f more size optimizations 2022-02-25 13:19:31 -08:00
Mathias Agopian
e12f079ac1 don't prevent unrolling of libmath == operator
We were not unrolling the == loop because the generated code with
unrolling was very branchy; but that's not a good call either because
the loop has the same number of unpredicted branches.
Theoretically the compiler should be able to emit a branchless == but
it doesn't. At least we give it a chance.
2022-02-25 13:19:31 -08:00
Philip Rideout
3c0f18753f GLTFIO_LITE does not need volume texture. 2022-02-25 09:28:17 -08:00
Mathias Agopian
a0e4d3df32 fix android build 2022-02-24 22:43:53 -08:00
Philip Rideout
97952e0ddc gltfio ubershader: provide dummy texture for volume thickness.
Fixes logcat spam seen with IridescentDishWithOlives.
2022-02-24 15:02:30 -08:00
Ben Doherty
49b8e5e5d2 Adding missing algorithm include (#5237) 2022-02-22 18:06:53 -08:00
Philip Rideout
249f0a80d8 gltfio: be graceful when model has > 4 weights per vert.
We now handle "too many bone weights" in the same way that we handle
"too many UV sets".  i.e. emit an error message and do not panic.

This change allows us to render the model in #5234 quite reasonably.

Fixes #5234.
2022-02-22 17:34:02 -08:00
Mathias Agopian
697a8370cb There was still a case where skinning wasn’t correctly default initialized
Fixes: #5185
2022-02-18 13:49:12 -08:00
Philip Rideout
67aa6f1913 Update old comments about max color attachment count. 2022-02-17 12:55:31 -08:00
Mathias Agopian
5f7c6c2fbf update material version
This this needed by recent SSR changes.
2022-02-16 11:20:28 -08:00
daemyung jang
001a3e3dc8 Set the morph target buffer by builder (#5179) 2022-02-16 09:20:38 -08:00
Philip Rideout
e99f13b14d Fix some RangeMap behavior and improve its unit test.
The existing unit test had an incorrect expectation in what happens
after splicing an existing range. Fixing the unit test revealed an
actual bug in the RangeMap implementation. It should never modify the
lower bound of an existing interval, because that invalidates the
iterator. It should also never retain a pointer or reference to a range
when the range is potentially removed by subsequent codelines.
2022-02-15 15:46:34 -08:00
Mathias Agopian
5bd5c50c8d Remove unit test that is not very useful. 2022-02-14 12:03:07 -08:00
Mathias Agopian
3f6188edff Enable rough reflections
This works by first generating a reflection buffer which gets blurred,
then the color pass samples from this buffer according to the roughness
of the surface being rendered.

A lot of the changes here involve utilizing "reserved" variants for
the new "SSR" pass and all the fallout from that.
2022-02-13 22:53:47 -08:00
Mathias Agopian
cc0486b3cc Rework material Variant filters
Variants are no longer just a bit mask, but rather a combination of
some bits, depending on the variant. Because of that the variant filer
must be updated.

Basically we now make a distinction between the "variants" as a public
material API and the actual `Variant` data type.

This change does the impedance match between the two.
2022-02-13 22:53:47 -08:00
Mathias Agopian
8314bafc0e reformat Variant.h
indentation was wrong
2022-02-13 22:53:47 -08:00
daemyung jang
9844803b26 Add function overloading for setMorphTargetBufferAt (#5169) 2022-02-10 15:55:41 -08:00
Mathias Agopian
0b3e557b65 New Invokable function wrapper 2022-02-08 20:23:57 -08:00
daemyung jang
0d2faa4573 Revert adding APIs 2022-02-08 10:31:17 -08:00