Commit Graph

26 Commits

Author SHA1 Message Date
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
Mathias Agopian
5cec001058 matdbg: direct SPIRV edit now supported 2023-02-03 13:57:44 -08:00
Mathias Agopian
2fb42f5144 matdbg: refresh spirv properly
we now refresh the spirv code properly after it's rebuilt from the
glsl tab.
2023-02-02 11:10:21 -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
Philip Rideout
a26b05bbbb matdbg: add support for editing Vulkan GLSL 2021-07-21 10:49:13 -07:00
Philip Rideout
12b9ee46b9 matdbg: add UI for language selection. 2021-07-21 10:49:13 -07:00
Philip Rideout
ce1eb83a0e matdbg: update Monaco editor. 2021-07-21 10:49:13 -07:00
Philip Rideout
27529730ca matdbg: fix bug in selectMaterial(). 2021-07-21 10:49:13 -07:00
Philip Rideout
32b3f16573 matdbg: fix active variant list, update README. 2021-07-14 16:37:53 -07:00
Philip Rideout
947d178f2b matdbg: stable ordering for anonymous materials.
For example, this makes it so that the primary material in Sponza
is *always* "untitled 0", which makes it easier to figure out which
material to modify.
2020-09-24 10:23:58 -07:00
Philip Rideout
29cd7bb6b4 matdbg: use Shift+Ctrl for navigation.
This avoids interference with both the default VSCode bindings and
Mission Control.
2020-09-24 09:54:19 -07:00
Philip Rideout
eb5d346e60 matdbg: repair keyboard navigation.
Recall that Ctrl + Up / Down navigates between materials while
Left / Right navigates between variants.

- Make this behavior more explicit in the documentation.
- Shortcuts now use the same ordering as the displayed list.
- Shortcuts now use Cmd on macOS instead of Ctrl to avoid conflict with
  Mission Control defaults.
2020-09-24 09:54:19 -07:00
Philip Rideout
89485ae0ae matdbg: fix edits for large shaders.
If the websocket message exceeds a certain size, we might receive it
in chunks and civetweb does not auto-consolidate for us.

Fixed this by adding a length prefix to the edit command.
2020-09-24 09:53:59 -07:00
Philip Rideout
92e1e91261 matdbg: warn user when editing unused variant. 2020-09-24 09:53:59 -07:00
Philip Rideout
4a604c2513 matdbg: do not hide anonymous materials
This change also makes it so that matdbg shows a numeric suffix to help
with duplicated names, and fixes a bug with names that start with
non-alpha characters.
2020-09-23 16:03:03 -07:00
Philip Rideout
d3f6ce6990 Minor fixes for "matinfo --web-server" 2020-07-08 13:15:28 -07:00
Philip Rideout
d7cd247dfc matdbg: auto-select variant when clicking a material.
The UI was in a weird state after the user selected a new material but
before they had chosen a particular variant. The highlighted
material did not match the content of the source editor.
2020-06-30 16:56:19 -07:00
Philip Rideout
9a58bf2460 matdbg: support scenes that have many materials.
We now download shader source only after the user selects a variant.
Previously we tried to download all shaders at once. This caused Chrome
to throw ERR_INSUFFICIENT_RESOURCES.

Fixes #2759
2020-06-30 16:56:19 -07:00
Philip Rideout
fee6a2f075 Miscellaneous matdbg improvements
matdbg
    - Materials are now sorted by name and the sha id is hidden.
    - PostProcess materials now separated from Surface materials.
    - PostProcess details now hide the non-existing properties.
    - Larger default pane size for the material list.
    - Use nicer font.

matinfo
    - Print out the Material Domain.

filament
    - get*Slow methods in FMaterial are now private.
2020-06-10 20:00:24 -07:00
Philip Rideout
15b663ba0b matdbg client: show inactive variants in gray.
This makes it easier to find the variants that are actually being used.
2019-09-09 11:04:02 -07:00
Philip Rideout
9eae72f99d matdbg: allow editing for GLSL shaders.
This performs surgical modification of the IFF chunks rather than
invoking filamat from within matdbg. Low-level direct manipulation
(bypassing optimization passes etc) allows us to diagnose issues with
the shading pipeline.

This CL also adds keystroke bindings to the Monaco editor. You can
press Cmd+S to rebuild the current materials, or use Ctrl+Arrow to
navigate between shader variants and materials.

In a subsequent CL I will add a README that describes how this works in
detail, it will include a list of limitations and a feature wishlist.
2019-09-05 13:03:49 -07:00
Philip Rideout
8da553db58 matdbg: fix active shader highlight. 2019-08-23 16:43:16 -07:00
Philip Rideout
83e9857b30 matdbg: remove bogus hrefs from anchors. 2019-08-23 16:43:16 -07:00
Philip Rideout
8d7c00b0d9 matdbg: add DebugServer class.
matdbg is now linked into the Filament Engine in debug config (allowing
live inspection of GLSL / SPIRV) and into the matinfo tool (to support
the --web-server option).

In both cases, the library spins up a small web server that listens to
http://localhost:8080. You can run any Filament app and attach to it.

The web client caches all material information. This allows the user to
close an atttached Filament app, and the web app will continue to
function properly (useful for crash diagnosis). Moreover the user can
launch a second Filament app and the web client will add its materials
to the existing list (useful when comparing two Filament apps).

For now this only supports inspection, not editing. Some of the material
info such as required attributes is not yet displayed but this will be
easy to flesh out in a subsequent PR.
2019-08-22 16:12:20 -07:00