From ed2fc0e3915cfa225fa4d63cb26c4ea57efe78dd Mon Sep 17 00:00:00 2001 From: Philip Rideout Date: Mon, 9 Sep 2019 10:59:55 -0700 Subject: [PATCH] matdbg: opt-in via environment variable. --- RELEASE_NOTES.md | 5 +++-- filament/src/Engine.cpp | 7 ++++--- libs/matdbg/README.md | 8 +++++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index aebb9a07ef..ef0346a17d 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -10,8 +10,9 @@ A new header is inserted each time a *tag* is created. - gltfio: Fixed several limitations with ubershader mode. - gltfio: Fixed a transforms issue with non-uniform scale. - webgl: Fixed an issue with JPEG textures. -- Windows: fix link error in debug builds. -- The web-based material inspector now allows editing GLSL and MSL code. +- Windows: Fix link error in debug builds. +- matdbg: Web server must now be enabled with an environment variable. +- matdbg: Added support for editing GLSL and MSL code. ## v1.3.2 diff --git a/filament/src/Engine.cpp b/filament/src/Engine.cpp index 8653ee06d8..85fc6e37e4 100644 --- a/filament/src/Engine.cpp +++ b/filament/src/Engine.cpp @@ -401,9 +401,10 @@ int FEngine::loop() { } #if FILAMENT_ENABLE_MATDBG - // Disable the web server for regression tests that occur in hermetic environments. - if (mBackend != backend::Backend::NOOP) { - debug.server = new matdbg::DebugServer(mBackend, 8080); + const char* portString = getenv("FILAMENT_MATDBG_PORT"); + if (portString != nullptr) { + const int port = atoi(portString); + debug.server = new matdbg::DebugServer(mBackend, port); // Sometimes the server can fail to spin up (e.g. if the above port is already in use). // When this occurs, carry onward, developers can look at civetweb.txt for details. diff --git a/libs/matdbg/README.md b/libs/matdbg/README.md index 29ee50bdc2..203f8d6d09 100644 --- a/libs/matdbg/README.md +++ b/libs/matdbg/README.md @@ -12,7 +12,11 @@ ## User Instructions -Simply launch any app that links against a debug build of a Filament, and point your web browser to +First set an environment variable as follows. In Windows, use `set` instead of `export`. + + export FILAMENT_MATDBG_PORT=8080 + +Next, launch any app that links against a debug build of a Filament and point your web browser to http://localhost:8080. After selecting a material and shader variant, you can view the GLSL, MSL, and SPIR-V code that was @@ -167,8 +171,6 @@ they appear in the package, where each API (GL / VK / Metal) has its own list. ## Wish List -- Allow disabling the server at run time when using a build that has FILAMENT_ENABLE_MATDBG. - - Maybe this can be an environment variable (extern char \*\*environ) that also controls the port number. - Allow SPIR-V edits. - Allow viewing GLSL transpiled from SPIR-V. - Also stop piggybacking on `type=glsl` for Metal Shading Language.