Commit Graph

6306 Commits

Author SHA1 Message Date
Mathias Agopian
ec31a516f7 don't rely on FMaterialInstance having a default ctor (#7781)
* don't rely on FMaterialInstance having a default ctor

FMaterialInstance needed a default ctor because it is a field of
FMaterial but cannot be initialized before FMaterial itself is
initialized. So we had a defautl ctor and we'd finish the initialization
later. Conceptually the default material instance should have been 
new'ed and a pointer to it stored instead. 

That's basically what we do now, but to avoid the extra allocation,
we in-place new and delete the default material instance into an
aligned_storage inside FMaterial.

* Update filament/src/details/Material.h

Co-authored-by: Ben Doherty <bendoherty@google.com>

---------

Co-authored-by: Ben Doherty <bendoherty@google.com>
2024-04-19 21:38:30 +00:00
Mathias Agopian
7a3b762b53 cleanup details/Material.h
Should Fix #7774
2024-04-19 12:08:03 -07:00
Eliza Velasquez
67268cb76d filagui: Use material constants in uiBlit 2024-04-18 13:46:46 -07:00
Eliza Velasquez
0b34dc6608 filagui: Add support for external textures
We have an instance of a client trying to render a GL_TEXTURE_EXTERNAL_OES
texture with filagui, which currently fails.
2024-04-18 13:46:46 -07:00
Ben Doherty
afe292986e Introduce new matedit tool (#7759) 2024-04-18 12:18:29 -04:00
Mathias Agopian
83acf0f9de fix hello triangle build 2024-04-18 00:38:26 -07:00
Mathias Agopian
69d9c8b72c fix a GL backend crash when shutting down
the gl backend did some of its cleanup in the its destructor,
including calling into OpenGL, however, the destructor is called from
the main thread, not the GL thread, so these calls would be no-ops at
best, and crashes in the worst case.
2024-04-16 15:08:45 -07:00
Mathias Agopian
3bffd90357 don't crash if we don't have a Camera set on View (#7766)
* don't crash if we don't have a Camera set on View

- also add a method to query if a camera was set

* Update android/filament-android/src/main/java/com/google/android/filament/View.java

Co-authored-by: Powei Feng <powei@google.com>

---------

Co-authored-by: Powei Feng <powei@google.com>
2024-04-16 21:09:21 +00:00
Mathias Agopian
b21dfd5ea2 add a couple way of validating MaterialInstances (#7754)
* add a couple way of validating MaterialInstances

BUGS=[333907416]

* Update filament/include/filament/Engine.h

Co-authored-by: Powei Feng <powei@google.com>

* Update filament/include/filament/Engine.h

Co-authored-by: Powei Feng <powei@google.com>

---------

Co-authored-by: Powei Feng <powei@google.com>
2024-04-16 12:12:20 -07:00
Mathias Agopian
8af2d7512d cleanup and small improvements to JobSystem
- add missing includes
- wake-up one or several threads based on the number of jobs available
2024-04-16 12:11:15 -07:00
Mathias Agopian
785592293c don't use thread affinity for the thread-pool
using thread affinity naively on big.little architectures is very flaky,
for now it's better to simplify and not use it at all, let the kernel
figure things out.

BUGS=[333582569]
2024-04-16 12:11:15 -07:00
Maximilien Dagois
613b1fc246 Fixed a comment 2024-04-16 12:10:49 -07:00
Powei Feng
c8098a4c15 gltfio: add Asset/Resource extended implementations (#7678)
* gltfio: add Asset/Resource extended implementations

 - Add gltfio/src/extended to implement an alternate loader for
   primitives. This is largely based on the implementation in
   AssetLoader/ResourceLoader
 - Able to correctly produce flat shading from gltf that only have
   vertex positions and indices.
 - This is not hooked into current code and should have no
   practical effect on gltfio.
2024-04-16 17:46:48 +00:00
Powei Feng
d8eee061e8 vk: Fix clang-18 compiler warning (#7764)
Fixes #7762
2024-04-16 17:14:57 +00:00
Powei Feng
0ebe888344 Fix broken dynamic resolution (#7763)
Previous PR #7758 accidentally removed the setting of 'resolution'
for shaders other than 'blitLow'.  This PR undoes that.
2024-04-16 09:52:43 -07:00
Powei Feng
c20496a461 Remove unused parameter in blitLow (#7758) 2024-04-15 16:19:54 -07:00
tomnomgoogleuk
8955a61df3 Set VkApplicationInfo.pEngineName to Filament (#7756)
Setting the pEngineName helps with the collection of metrics and is generally good practice.
2024-04-15 19:42:36 +00:00
Powei Feng
9e0e3262c3 Release Filament 1.51.4 2024-04-15 11:05:12 -07:00
Mathias Agopian
d3d5281488 cleanup the Material constructor
We move some large blocks of code out of line.
2024-04-15 10:27:07 -07:00
Mathias Agopian
075f3d0869 fix another ibl-prefilter bug introduced recently
The top and bottom faces were swapped in the reflection map.

FIXES=[333421281]
2024-04-15 10:25:52 -07:00
Mathias Agopian
3ca9b9cd0f don't use thread affinity for the backend thread
Originally we did this because we wanted to run on a big core on 
android. However setting the thread affinity in this way is fragile,
we are not guaranteed to be on a big core, and we don't even know
if some thread is pinned to that core already; which was the case
with some GL drivers. This can also cause scheduling problems with
other threads.

We just remove this logic entirely for now, and we'll figure out 
something better later to run on a big core.

Fixes #7748
BUGS=[333949404]
2024-04-12 15:55:56 -07:00
Mathias Agopian
eb33ce35ef make the Systrace class public
BUGS=[331834298]
2024-04-12 14:44:48 -07:00
Ben Doherty
cddd22da28 Introduce a new precompiled Metal material chunk type (#7749)
This change introduces a new chunk type to material files for precompiled Metal libraries. Previously, SPIR-V was the only binary type, so there's also a couple of refactor commits present here. Nothing is changed in Filament or matc yet.

BUGS=[333547148]
2024-04-12 00:42:10 -04:00
Powei Feng
05ce5ead8d vk: Use new descriptor set caching (#7735)
- Use new descriptor set and layout caching
 - Remove descriptor set related code in VulkanPipelineCache
 -  fix leaks for descriptor sets/layouts

FIXES=248594812,325157400
2024-04-09 23:29:27 +00:00
Sungun Park
4bed88289f Release Filament 1.51.3 2024-04-08 20:49:02 +00:00
Ben Doherty
7a6138597e Metal re-apply: throw an NSException when attempting to draw with invalid program (#7741) 2024-04-05 17:50:07 -07:00
Ben Doherty
28da328815 Export utils::panic function (#7740) 2024-04-05 17:49:56 -07:00
Mathias Agopian
de3c4b6d56 fix a possible leak when editing a material with matdbg
A MaterialParser could be leaked if several edits happened before they
were latched -- this was because the MaterialParser was stored as
a raw pointer instead of a unique_ptr<>, this was done as an attempt
to avoid to use a lock around accessing mPendingEdits.
2024-04-04 10:15:43 -07:00
Mathias Agopian
5d27240e0c clean-up lifetime of MaterialParser 2024-04-04 10:15:43 -07:00
Mathias Agopian
94fc37b8c2 fix missing headers 2024-04-04 10:15:43 -07:00
Powei Feng
532cb28ce9 vk: Introduce caches for descriptor sets/layouts (#7731)
Added
 - Cache for layouts
 - Pools for descriptor sets
 - Cache for descriptor set updates
 - Cache for pipeline layouts

Does not have effect on implementation.
2024-04-03 17:51:42 +00:00
Mathias Agopian
b30d12aca5 split GLTexture and GLBufferObject to their own file 2024-04-02 23:34:30 -07:00
Mathias Agopian
d891a6927f program is now 48 bytes instead of 56 2024-04-02 23:34:30 -07:00
Mathias Agopian
22b5715837 move mSamplerMap and ES2's mUniformBindings to OpenGLContext 2024-04-02 23:34:30 -07:00
Powei Feng
7eb08f11ea vk: add descriptor set/layout types to handles (#7728)
- Move VulkanDescriptorSet to VulkanHandles.h
 - Add VulkanDescriptorSetLayout to VulkanHandles.h
 - Add "input" descriptor set types to VulkanUtility.h. These are
   structs that will be defined in the backend API (shared across
   all backends) and eventually passed from the front-end to the
   vk backend.
 - Logic to parse descriptor set layout from the spirv-v shaders.
 - Move UsageFlags type to VulkanUtility.h
 - Just prep work. No effect to current implementations.
2024-04-02 20:59:24 +00:00
Mathias Agopian
588a05f77c Fix point/spot shadow rendering bug
We were calculating the shadow visibility of spot/point lights. The
visibility was calculated during the "execute" phase of the FrameGraph
but it was used/needed during the setup phase. The result was that
the visibility was always delayed by one frame (really it was stale 
data from the previous calculation).

We are now computing the shadow visibility earlier, during the
setup phase. This is also better because we can now skip culling
of these shadow maps entirely if we know they're not visible.

Fixes #7715
2024-04-01 17:09:34 -07:00
Benjamin Doherty
3ec2b47df7 Release Filament 1.51.2 2024-04-01 16:44:33 -07:00
Mathias Agopian
1c55ad49ee add support for custom blend functions
BUGS=[331610785]
2024-04-01 13:40:34 -07:00
Mathias Agopian
348e61fd76 remove unused code 2024-04-01 13:40:34 -07:00
Mathias Agopian
8ce6d54930 remove wrong noexcept in the backend
going forward we want to be able to throw exceptions from the backend
at the very least, we need to be consistant, currently we are
potentially throwing exceptions from `noexcept` places.

this changes makes it possible to throw exceptions from the backend,
during handle construction and conversion to pointers, which wasn't 
allowed before.

We still can't throw from dtors because it's generally a bad idea, 
better abort in that case.
2024-03-29 14:59:43 -07:00
Mathias Agopian
8db5e700d7 GL backend should only allocate renderbuffers when possible
There was several cases where the the gl backend would wrongly  use a 
renderbuffer instead of a texture.


BUGS=[329491941]
2024-03-29 14:59:29 -07:00
Mathias Agopian
0ec3596440 the user can now set a panic handler callback
BUGS=[331457244]
2024-03-29 12:25:06 -07:00
Ben Doherty
ee4c03d0f1 Fix WebGL build with newer Emscripten (#7721) 2024-03-28 14:15:32 -07:00
Powei Feng
f12e7f9fbf Release Filament 1.51.1 2024-03-28 11:47:52 -07:00
Nimrod Gileadi
a068143953 Add semicolons to code snippet in AssetLoader.h (#7717) 2024-03-27 17:24:10 +00:00
Powei Feng
90d90094dc Bump material version to 51 in MaterialEnums.h 2024-03-26 14:37:13 -07:00
Sungun Park
54df4524eb Improve multiview shader replacement (#7706)
Replace the num_views for OpenGL multiviwe only when
- The engine is initialized with multiview stereo
- The variant for the material contains STE flag
- The program is for surface
- It's vertex shader (this is already in)
2024-03-26 21:36:22 +00:00
Powei Feng
d70f2e1b81 vk: delete instead of ref-count EmptyTexture (#7711) 2024-03-26 13:35:50 -07:00
Powei Feng
2f359b73a4 Add missing include to Platform.h (#7709) 2024-03-26 19:51:57 +00:00
Sungun Park
abb0cbc98e Add FILAMENT_ENABLE_MULTIVIEW option (#7707)
This allows the engine to include multiview shader code for default
materials.
2024-03-25 21:43:04 +00:00