Commit Graph

107 Commits

Author SHA1 Message Date
Ben Doherty
37cb842993 Fix possible null string crash inside TextWriter (#9428) 2025-11-12 12:07:16 -08:00
Mathias Agopian
8af1cb3489 fix build warning (#9263) 2025-09-25 16:37:24 -07:00
Mathias Agopian
db96b262a2 fix another matdbg build breakage (#9255) 2025-09-24 23:13:10 -07:00
Sungun Park
0ef7507464 mat: Store matc parameters in material packages (#9070)
This commit enhances the material compilation process by embedding the
`matc` command-line parameters directly into the compiled material file.
This feature is valuable for debugging, as it allows developers to
inspect the exact compilation settings used for a given material.

A key consideration is the potential for personally identifiable
information (PII) in the command-line arguments (e.g., file paths). To
address this, a `toPIISafeString` method has been implemented to filter
out PII-sensitive options before they are stored in the material.

With this change, the matc command below
    /path/to/matc -a opengl --api vulkan -p desktop -g -o /path/to/my.filamat /path/to/my.mat

is stored to the package as below. (veryfied by running `matinfo my.filamat`)
    Compilation Parameters:         -a opengl --api vulkan -p desktop -g
2025-08-17 19:25:37 +00:00
Ben Doherty
c25ac68a3a Better set default shader stages for samplers (#8992) 2025-07-29 10:01:36 -07:00
Powei Feng
e4aeca28ec matdbg: update monaco dep (#8997)
- Update the monaco editor to the latest available version
   (0.52.2)
- Disable formatting for webgpu since it's already formatted
2025-07-26 00:07:47 +00:00
Powei Feng
329ca04248 Change unfilterable to filterable (#8932) 2025-07-16 23:46:20 +00:00
Ben Doherty
1f8cacdd70 matinfo: Report if a material has custom depth (#8904) 2025-06-26 17:30:01 -04:00
Ben Doherty
573a51c430 Fix segfault in matinfo (#8896) 2025-06-25 12:25:19 -07:00
Juan Caldas
e205611128 BUGS=397448737
Add WebGPU Support to matdbg
2025-04-30 17:43:28 +00:00
Juan David Caldas
9c69cb8484 Enable WebGPU option for matc and add WGSL options for shader generation 2025-03-11 17:40:21 -04:00
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
HanYunChenLuo
30bb4ad6eb fix SourceFormatter.h missing header file (#8498)
missing <string>
2025-03-06 09:22:29 -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
Eliza Velasquez
40851f4b51 matdbg: add support for essl1 shader debugging
Fixes #8261
2025-01-31 11:44:51 -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
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
Powei Feng
aa09d86b5a matdbg: Fix material collision (#8322)
Fix 3 bugs wrt matdbg:

1. The numbering scheme for materials with same name was buggy
2. The shared depth variants of the default material should also
   show up as active material variants.
3. When two instantiation of FMaterial point to the exact same
   bits, we still need to treat them as two materials. (Otherwise
   we wouldn't be able to modify one of them in matdbg).
2024-12-19 20:14:08 +00:00
Doris Wu
6a547639d1 Specify the source of server log (#8313) 2024-12-14 10:28:59 +08:00
Powei Feng
2cade209b5 Add Descriptor Sets to Filament (#8165)
We add the concept of the descriptor set as a way to describe
shader resources into Filament. This is a comprehensive change
across Filament.

Info on descriptor sets is available here:
https://docs.vulkan.org/spec/latest/chapters/descriptorsets.html

Co-authored-by: Benjamin Doherty <bendoherty@google.com>
Co-authored-by: Mathias Agopian <mathias@google.com>
Co-authored-by: Sungun Park <sungunpark@google.com>
2024-09-27 23:20:20 -07:00
Minjae Kim
ddf1d422bc add explicit headers for supporting libstdc++ 2024-05-22 10:40:26 -07:00
Ben Doherty
afe292986e Introduce new matedit tool (#7759) 2024-04-18 12:18:29 -04: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
Mathias Agopian
1c55ad49ee add support for custom blend functions
BUGS=[331610785]
2024-04-01 13:40:34 -07:00
Mathias Agopian
c8aae3cdaa fix android build 2023-12-13 16:32:22 -08:00
Powei Feng
b0a584c915 Small compilation fixes (#7363)
- gltfio: Enable -Wall -Werror for gltfio_core
 - gltfio: Fix various errors that were missed warnings
 - matdbg: switch from std::atomic_uint64_t to
   std::atomic<uint64_t> for older clang
2023-11-14 13:26:48 -08:00
Powei Feng
9ccb8fce31 matdbg: UI refresh (#7301) 2023-10-26 14:14:01 -07:00
Powei Feng
deb3eb0b11 matdbg: fix deadlock and add experimental UI (#7275)
- Ensure that waiting on lock times out so that we don't lock
   up a thread when the client is gone.
 - Add an experimental folder to matdbg/web/ for the new
   UI work.
2023-10-24 13:48:29 -07:00
Powei Feng
92846305f5 matdbg: change from websocket to GET (#7263)
- Use a hanging-GET approach to reduce dependency on websockets.
 - Also add mutex to protect access to MaterialRecords, which is
   written to/read from from multiple threads.
2023-10-13 14:43:34 -07:00
Powei Feng
078a17469a matdbg: refactor EDIT command (#7255)
The websocket code for parsing the EDIT command is pretty verbose.
Proposing that we move to a HTTP POST request instead.

Also moved the API handler code out of DebugServer.h for clarity.
2023-10-12 10:40:57 -07:00
Eliza Velasquez
0887e388db matinfo: further refactor out redundant code 2023-10-11 16:17:48 -07:00
Eliza Velasquez
e4a57cedf9 matinfo: add support for viewing ESSL1 code 2023-10-11 16:17:48 -07:00
Mathias Agopian
3dcdb202d1 new API to return a Material's supported variants
FIXES=[297456590]
2023-09-19 15:48:39 -07:00
Ben Doherty
6bb29f6e01 Implement preliminary support for instanced stereo (#6967) 2023-08-15 17:08:11 -07:00
Mathias Agopian
e9bd9ab3a6 Fix matdbg for 32 bits architectures 2023-08-09 19:19:05 -07:00
Ben Doherty
6cab8d2cd4 Expose specialization constants to materials as constant parameters (#6652) 2023-04-11 11:09:53 -07:00
Mathias Agopian
e19011d0e0 use the enum instead of ints everywhere for ShaderModel and ShaderStage 2023-04-07 09:33:26 -07:00
Mathias Agopian
c264d26edd filter out VSM variant for unlit materials DEPTH shaders
The VSM variant is never needed for unlit materials, it was filtered
out correctly for color shaders but not for the depth shaders.
This removes 4 variants from all unlit materials.

Also improve matinfo variants output.
2023-04-04 16:52:04 -07:00
Mathias Agopian
a484fe1de3 rename ChunkcContainer::addChild/addSimpleChild to push/emplace (#6704)
'child' didn't make any sense in this API, push/emplace mimics
std::vector, which is closer to what the api actually does.
2023-04-03 14:06:42 -07:00
Mathias Agopian
473aff9093 Fix a bug in matdbg where it could reorder the shaders in the package (#6656)
This happened because the code iterated over the keys of a hashmap,
which obviously were not guaranteed to be in the same order as those
entries where added to the hashmap.

We fix this by adding a "visitor" to the materialchunk, so we can
iterate through it in order and retried the info we need.
2023-03-21 10:00:33 -07:00
Mathias Agopian
5cec001058 matdbg: direct SPIRV edit now supported 2023-02-03 13:57:44 -08:00
Mathias Agopian
02c22a668c matdbg: make sure we use the same spirv parameters everywhere 2023-02-02 11:10:02 -08:00
Mathias Agopian
f71e90fae0 deduplicate spirv disassembly code 2023-02-01 21:12:53 -08:00
Mathias Agopian
2e0c238cc6 We now require Vulkan 1.1 for the vulkan backend 2023-02-01 21:10:26 -08:00
Mathias Agopian
0b4d32bf98 matdbg: use GLSL 4.5 on desktop when debugging spirv
GLSL 4.5 is closer to spriv than 4.1 and since this is just to 
"interpret" the spirv, 4.5 is fine.

Set the default precision for GLES though.
2023-02-01 10:03:20 -08:00
Ben Doherty
d3956adca8 matdbg: take desktop/mobile into account for SPIR-V to GLSL translation (#6488) 2023-01-26 11:30:51 -08:00
Mathias Agopian
fabba73b1e Initial support for compute
* minimal backend support for compute
- added api to dispatch a compute shader
- added api to create and bind a ssbo
- added api to read back a buffer
Only implemented in the gl backend

* Add a backend compute test suite
* basic support for compute shaders in matc
this is still very much work-in-progress.
We're not supporting images nor ssbo for now.

* rename UniformInterfaceBlock to BufferInterfaceBlock
* augment BufferInterfaceBlock to support ssbo features
- add support for std430
- add support for ssbo
- add support for variable-size array
- add support for memory qualifiers

* reformat MaterialBuilder
* material format: move subpasses outside of parameters
subpasses now are their own json property instead of being a
"parameter".

* refactor parameter() methods to match Buffer/SamplerInterfaceBlock
We're just shuffling the arguments.

* add support for buffers in .mat files
* filamat now generates buffer blocks (ssbo)
* take feature level into consideration when optimizing shaders
* don't store the 'uniform binding' chunk for level 2 materials
this includes some refactoring/cleanups of MaterialParser

* matinfo: fixes for compute
- separate subpasses from parameters
- don't attempt to print material properties
2022-09-27 15:52:40 -07:00
Mathias Agopian
b0fb52c5f4 matinfo: fix feature level print output 2022-09-16 16:22:25 -07:00