Commit Graph

2012 Commits

Author SHA1 Message Date
Powei Feng
e825f43935 matdbg: indicate shader model (#8504)
Shader model (desktop or mobile) wasn't really accounted for
in the UI. This means that we will get shaders that look like
duplicates (same variant). In this work, we pass the current
shader model from engine into the frontend and filter out
variants of a different shader model.

Moreover, for matinfo, we use a specific dbg shader model (matinfo)
to indicate it is in that mode. We add UI in matinfo to show the
shadermodel.

So UI updates as well.
2025-03-07 23:54:22 +00:00
Powei Feng
5091b3112d matdbg: fix variant issue for surface materials (#8503)
- The set of active variants were not set correctly for surface
   materials since the frag/vert pairs could have different
   variant.
 - Fix the default selection logic in the UI
 - Random clean-ups

FIXES=328699979
2025-03-07 17:46:04 +00:00
bridgewaterrobbie
d0a00803c1 Restore workaround for CONFIG_MAX_INSTANCES and CONFIG_FROXEL_BUFFER_HEIGHT not being a spec constant, because WGSL does not support that being an array length (#8479) 2025-03-07 00:28:36 +00:00
bridgewaterrobbie
74b09c708a Enable TINT_BUILD_SPV_READER on host platform webgpu builds 2025-03-06 17:12:03 -05:00
bridgewaterrobbie
80e0dbaa8a When preprocess fails, return false from process 2025-03-06 17:12:03 -05:00
bridgewaterrobbie
31e966f63f Add initial Tint support for shader transpile
Early version that will allow errors to be ignored currently, outputting what we can into filamat results.
2025-03-06 17:12:03 -05:00
Ajmal Kunnummal
02223dcaab Add a way to specify an additional uniform name along with a sampler param for the associated transform matrix (#8490)
BUGS=[399959254]
2025-03-06 18:42:24 +00:00
HanYunChenLuo
30bb4ad6eb fix SourceFormatter.h missing header file (#8498)
missing <string>
2025-03-06 09:22:29 -08:00
Doris Wu
d9e30460dc Enable fgviewer for android remote debugging (#8483)
* Enable fgviewer for the users

* Fix incorrect position

* Update

* Support remote debug server

* Enable fgviewer on android

* Link and include fgviewer_resources

* Adjust js to show untitled view
2025-03-06 05:36:41 +00:00
Doris Wu
075743ef59 Aggregate the subresource usage when collapsed (#8492) 2025-03-06 02:08:55 +00:00
Syed Idris Shah
86e71f37ae Add WebGPU stub backend code.
Introduce Enums to support WebGPU.
Start to use header files from dawn.
2025-03-04 22:09:19 -05:00
Doris Wu
44883fe5fc Add README.md (#8485) 2025-03-05 00:55:06 +00:00
Doris Wu
d0910b3fb6 Add resource details display to fgviewer web view (#8469)
* Add resource detail

* Add to_string for texture format

* Fix the type of currentResourceId

* Update

* Refactoring

* More refactoring

* Rename some properties

* Rename a function

* Address the comment

* Update the comment and remove if statement

* Fix indent
2025-03-01 02:54:54 +00:00
Amin Ya
ad2fdb4663 fix: const cast pair.first access for mg_websocket_write (#8264)
Co-authored-by: Powei Feng <powei@google.com>
2025-02-27 22:28:04 +00:00
bridgewaterrobbie
17091df8dc Update abseil version to match Dawn requirements 2025-02-27 14:22:41 -05:00
Powei Feng
db30a9a50c viewer: add option to export TIFF in automation (#8472)
PPM does not store alpha channel, but TIFF does.  We add a method
to export RGBA to a TIFF file without compression.

We add the corresponding options to gltf_viewer and
AutomationEngine.

The default export format for both gltf_viewer and AutomationEngine
is now TIFF.
2025-02-27 18:54:37 +00:00
Powei Feng
db29b87647 gltfio: allow for multiple color attributes (#8462)
We are not correctly handling gltf models with multiple color
attributes. Filament doesn't allow for more than one color
attribute.  So we just set the additional attributes as
VertexAttribute::CUSOM(N).

Fixes #8396
2025-02-27 06:50:21 +00:00
Powei Feng
dc7eee0896 filamat: fix ubsan failure (#8461)
Enabling UBSan shows the following error:

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior filamat/src/eiff/Flattener.h:102:17 in
filamat/src/eiff/Flattener.h:102:17: runtime error: applying non-zero offset 8 to null pointer

We reference a placeholder byte on the heap when in DryRunner mode
to workaround this issue.
2025-02-27 03:55:30 +00:00
Powei Feng
defba23030 build: remove ios build dependency on filamat (#8465)
We are in the process of updating glslang, which requires

set(IOS_MIN_TARGET "13.0")

This is a problem since we are targeting iOS 11 in general.
glslang is a filamat depedency, and we're building filamat for
iOS for the iOS version of the backend test.

So one solution is to set set(IOS_MIN_TARGET "13.0") for the
backend test. And we might revisit this solution later.

But for now, we simply disable backend tests (and filamat tests)
for iOS.
2025-02-26 21:42:51 +00:00
Powei Feng
3fae07f23c gltfio: undo clearing when resource is loaded (#8458)
Fixes #8367
2025-02-20 01:03:03 +00:00
Doris Wu
1b59e24e99 fgviewer improvement (#8450)
* Introduce FrameGraphInfo class

* Move the assignment into pimpl

* Make ctors explicit

* Add ctors to fg info structs

* Revert the macro change to align with existing

* Address the comments

* Remove pimpl and move func def to .cc

* Fix

* Convert the FrameGraph to FrameGraphInfo

* Initialize and update debug server on engine side

* Fix compile error

* Address the comments

* Update

* Use camelCase

* Use camelCase

* Update

* Add JsonWriter to convert fginfo to json

* Add getStatus api and implement it

* Add increment

* Implement GET apis

* Fix compile error

* Update

* Use c_str_safe

* Add operator== for FrameGraphInfo

* Call updateFrameGraph in appropriate locations

* Address the comments

* Add webview for fgviewer

* Remove head and tail bracket

* Fix the table element

* Force web to re-render when fg info gets updated

* Skip culled resources

* Mark subresources as gray

* Add parent info for subresources

* Collapse subresources into their parent resource

* Make the leftmost column fixed

* Remove unused stuff in html

* Fix the comment

* Refactor the code

* Cull unused resources

* Update

* Fix the naming

* Format the file

* Merge multiple resource node in to single resource

* Improve the logic and naming

* Refine the code
2025-02-18 14:46:30 +08:00
Doris Wu
d92372c98f [Depends on #8379] Add webview for fgviewer (#8428)
* Introduce FrameGraphInfo class

* Move the assignment into pimpl

* Make ctors explicit

* Add ctors to fg info structs

* Revert the macro change to align with existing

* Address the comments

* Remove pimpl and move func def to .cc

* Fix

* Convert the FrameGraph to FrameGraphInfo

* Initialize and update debug server on engine side

* Fix compile error

* Address the comments

* Update

* Use camelCase

* Use camelCase

* Update

* Add JsonWriter to convert fginfo to json

* Add getStatus api and implement it

* Add increment

* Implement GET apis

* Fix compile error

* Update

* Use c_str_safe

* Add operator== for FrameGraphInfo

* Call updateFrameGraph in appropriate locations

* Address the comments

* Add webview for fgviewer

* Remove head and tail bracket

* Fix the table element

* Force web to re-render when fg info gets updated

* Skip culled resources

* Mark subresources as gray

* Add parent info for subresources

* Collapse subresources into their parent resource

* Make the leftmost column fixed

* Remove unused stuff in html

* Fix the comment

* Refactor the code

* Cull unused resources

* Update

* Fix the naming

* Format the file

* Fix naming

* Address the comments

* Address the comment
2025-02-15 06:41:43 +00:00
Doris Wu
9ca0594d7c [Depends on #8344] Implement ApiHandler functions and add JsonWriter (#8379)
* Introduce FrameGraphInfo class

* Move the assignment into pimpl

* Make ctors explicit

* Add ctors to fg info structs

* Revert the macro change to align with existing

* Address the comments

* Remove pimpl and move func def to .cc

* Fix

* Convert the FrameGraph to FrameGraphInfo

* Initialize and update debug server on engine side

* Fix compile error

* Address the comments

* Update

* Use camelCase

* Use camelCase

* Update

* Add JsonWriter to convert fginfo to json

* Add getStatus api and implement it

* Add increment

* Implement GET apis

* Fix compile error

* Update

* Use c_str_safe

* Add operator== for FrameGraphInfo

* Call updateFrameGraph in appropriate locations

* Address the comments
2025-02-15 02:27:42 +00:00
Powei Feng
b68e9fef03 froxel: make froxel buffer size consistent (#8437)
The definition of the froxel buffer sizes were spread across
multiple places and for different use cases (including
allocating the buffer, setting to a descriptor set, and adjusting
the relevant spec constant). In this commit, we try to unify
the size definitions into Froxelizer::getFroxelBufferByteCount().

We also remove the vulkan-only special case for froxel buffer
UBO. This case was introduced because spec constant couldn't be
used to size arrays for some drivers in the past, but we introduced a
workaround that replaced spec constants with constants.
2025-02-13 15:32:05 -08:00
Powei Feng
1a5f1cc6ab matdbg: fix three bugs (#8430)
1. changes weren't refreshed for windows/linux-mesa vulkan. This
   is due to a reordering of the shaders when the shader source
   is replaced. We fix this by ensuring the ordering before
   writing out the edit.
   Fixes #7286

2. A condition was flipped in the SourceFormatter causing the
   format feature to not work on linux

3. The material update status wasn't really propagated to the
   front-end due to not updating the status counter.
2025-02-11 07:50:45 +00:00
Benjamin Doherty
cb8b1bfefa Bump MATERIAL_VERSION to 57 2025-02-10 15:23:37 -08:00
GavinKG
c16cab239d Use CAMetalLayer to create MVK surfaces to avoid potential deadlocks. 2025-02-07 12:39:24 -08:00
Sungun Park
4fe852e88a Ensure correct resource cleanup sequence to avoid crashes upon app closing (#8408)
The commit 1747ae8f5a enfoces a correct
order for releasing resource. Fix the order to avoid crashes.

Make some samples to use the DEPTH32F format for better compatibility.
Some manufacturers don't fully support DEPTH24 on Vulkan. E.g., AMD
Radeon PRO W6400
2025-02-03 21:23:53 +00:00
Rafael Dominguez
62cd8f1d35 Update multiview shader code generator for Vulkan
When targeting Vulkan with multiview, the shader
code generator was using the OpenGL extension
and built-in variables, which are not supported on
Vulkan.

Changed it to use GL_EXT_multiview instead of
GL_OVR_multiview2 when the target API is Vulkan.
2025-01-31 16:50:02 -08:00
Doris Wu
793f2b4eb7 [Depends on #8332] Integrate fgviewer to the engine side (#8344)
* Introduce FrameGraphInfo class

* Move the assignment into pimpl

* Make ctors explicit

* Add ctors to fg info structs

* Revert the macro change to align with existing

* Address the comments

* Remove pimpl and move func def to .cc

* Fix

* Convert the FrameGraph to FrameGraphInfo

* Initialize and update debug server on engine side

* Fix compile error

* Address the comments

* Update

* Use camelCase

* Use camelCase

* Update
2025-01-31 23:39:47 +00:00
Eliza Velasquez
40851f4b51 matdbg: add support for essl1 shader debugging
Fixes #8261
2025-01-31 11:44:51 -08:00
Sungun Park
87bdf96449 Refactor: Rename shader snippets w/ new naming convention (see README.md) (#8402)
This commit renames all shader snippet files to conform to the newly
introduced naming convention outlined in README.md.

The new naming convention uses a `prefix_name.suffix` format to clearly
indicate the purpose and target shader stage of each snippet. This
improves the overall organization and readability of the shader code,
making it easier to understand how each snippet contributes to the
shader generation process.

No functional changes were made to the shader code itself or source
code. This is purely a refactoring for clarity and maintainability.
2025-01-31 00:02:53 +00:00
Evan Mezeske
4465e6c7f6 Remove noexcept from UserPanicHandler::call() so that panic handlers can throw. Without this change, throwing inside the user panic handler calls terminate(). Note that the docs for setPanicHandler() explicitly say that it's okay for the handler to throw, which is not true prior to this change. 2025-01-29 14:44:09 -08:00
John Bampton
5fd84db447 docs: update ImageDecoder.h; fix spelling 2025-01-27 21:18:55 -08:00
Powei Feng
1dae41c607 matdbg: fix two bugs with formatting (#8388)
- return original source when on an unsupported platform
- check clang-format is available and return original source.
2025-01-27 11:51:48 -08:00
Powei Feng
6dc79a319e filamat: fix spirv remap intialization (#8384)
FIXES=390398814
2025-01-24 09:52:03 -08:00
Powei Feng
3b7cbd6bdb viewer: fix broken test 2025-01-21 16:53:36 -08:00
Mathias Agopian
ea21b740b2 use the move modern syntax for std::enable_if and friends
e.g. std::enable_if<cond>::type is replaced by std::enable_if_t<cond>

remove some unneeded typename keywords
2025-01-21 16:16:09 -08:00
Mathias Agopian
3f1e32c404 fix some trivial TODOs (#8371) 2025-01-21 09:49:02 -08:00
Doris Wu
85e2cc0844 Create data transmitting class for fgviewer (#8332)
* Introduce FrameGraphInfo class

* Move the assignment into pimpl

* Make ctors explicit

* Add ctors to fg info structs

* Revert the macro change to align with existing

* Address the comments

* Remove pimpl and move func def to .cc

* Fix

* Address the comment
2025-01-18 02:47:22 +00:00
Mathias Agopian
bef849b0e3 large code cleanup (#8364)
* Remove redundant qualifiers in filament public headers

* remove redundant qualifiers in filament implementation

* remove redundant qualifiers in libutils public headers

* remove redundant qualifier for libutils implementation

* remove redundant qualifiers for libmath

* use is_same_v<> instead of is_same<>

* bring back Builder::name()

we keep Builder::name() on all object, and forward to the MixIn class
that does the implementation, so that we have correct documentation, and
better IDE completion.

* add missing const parameters in filament's implementation

* various source cleanup

- missing includes
- missing const
- C cast style
- superfluous inline keyword
2025-01-17 17:50:16 -08:00
Mathias Agopian
1747ae8f5a validate MaterialInstance references when destroyed (#8366)
* validate MaterialInstance references when destroyed

With this change we now enforce two things:
- All MaterialInstance of a Material must be destroyed when
  destroying said Material. This has always been a documented 
  requirement of the public API, but wasn't enforced (only
  a warning was printed).
  This new assertion is unconditional.

- A MaterialInstance, when destroyed is no longer in use by any
  Renderable.

So before destroying a MaterialInstance, the user of API needs to 
ensure that either all Renderable using that MaterialInstance in one
of their Render Primitives are  destroyed, or, that these Renderable
using that MaterialInstance are reset to another one or to null.

There is a new RenderableManager::clearMaterialInstanceAt() that can
be used to clear a MaterialInstance on a Render Primitive.
  
Additionally, a Render Primitive with a null MaterialInstance is now
silently skipped during rendering, instead of a null-dereference.

Finally, that second assert is protected by a new feature flag: 
"features.engine.debug.assert_material_instance_in_use". This flag is
enabled on DEBUG builds and disabled on RELEASE builds by default.
The flag can be changed at any time using `Engine::setFeatureFlag()`.

BUGS=[333907416]

* Update filament/src/components/RenderableManager.cpp

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

---------

Co-authored-by: Powei Feng <powei@google.com>
2025-01-17 14:15:15 -08:00
Mathias Agopian
288e81fb31 Fix DEBUG_COMMAND_STREAM mode
Fixes #7966
2025-01-16 10:51:56 -08:00
Mathias Agopian
37fd83af66 Add support for an Atlas allocator for shadow maps
This feature is controled by a feature flag and is turned off at this point.
This CL shouldn't change the existing behavior of shadowmap allocation as
long as the atlas feature is not enanled.

When enabled, shadowmap allocations are not limited to layers of the
shadowmap texture, instead, an atlas is used meaning a layer can
be shared by multiple shadowmaps. At the very least this can save
a lot of memory as smaller shadowmaps can be packed together.

Currently this feature breaks some VSM features:
- mipmapping
- blurring
2025-01-13 15:10:14 -08:00
Mathias Agopian
2b0077eea2 AtlasAllocator fixes
- when inserting an entry at a root other than zero, we need to update
  the children count of the root's parent.

- the QuadTree array nodes need to be able to encode enough indices for
  the largest "layer" in the tree. With 7 layers the largest one has
  4096 entries, so we need 12 bits, not 8.
2025-01-13 15:10:14 -08:00
Ben Doherty
863b1346e1 Rename IOS define to FILAMENT_IOS (#8340) 2025-01-08 13:11:39 -08:00
Powei Feng
f0b9a30bc1 matdbg: add option to hide inactive materials and variants (#8339)
The option will persist beyond user sessions through localStorage.
2025-01-07 19:42:17 +00:00
Powei Feng
a003d3721d matdbg: enable source formatting (#8338)
We use clang-format to format the shader files. Since we assume
clang is necessary for compilation, installing clang-format should
not be too much of an overhead in terms of adding dependency.

Currently, we only support posix systems (macOS, linux).
2025-01-07 18:11:12 +00:00
Powei Feng
7d0b652663 matdbg: fix two memory bugs (#8337)
- murmur3 expects word size not byte size
 - should use uint8_t in addressing blob source.

both would crash when asan is enabled.
2025-01-06 18:33:25 +00:00
seker
8c1e028b46 Fix : null pointer crash (#8326) 2024-12-30 11:42:18 -08:00