Compare commits

...

11 Commits

Author SHA1 Message Date
Fernando Raviola
555a1396ca Data verification before server upload (#6518)
Data verification before server upload
2023-05-18 15:29:50 +10:00
Fernando Raviola
57ce236fe4 Improve Session API, send formatted string to server (#6498)
Add fgdbg::Session.h, Pass.h, Resource.h dtos/models
2023-05-18 15:29:50 +10:00
raviola
527428a629 Add fgdbg::Session.h, Pass.h, Resource.h dtos/models 2023-05-18 15:29:50 +10:00
Fernando Raviola
a5913e2c36 Add fgdbg::Session.h, Pass.h, Resource.h dtos/models (#6270)
* Add fgdbg::Session.h, Pass.h, Resource.h dtos/models

* Add session name

* Update Engine to use new API
2023-05-18 15:29:50 +10:00
Fernando Raviola
48a31f484a fgdbg client project structure + simple server connection (#6210)
* fgdbg client project structure + simple server connection

* pr feedback
2023-05-18 15:29:50 +10:00
Fernando Raviola
21cf0f40c4 Add DebugServer for fgdbg with support for Websockets (#6169)
* Add dummy DebugServer for fgdbg with support for Websockets

* PR feedback
2023-05-18 15:29:50 +10:00
raviola
16a351bf15 rename debug.server to debug.matdbg 2023-05-18 15:29:27 +10:00
raviola
c76b6d7bed Use smart pointer 2023-05-18 15:27:57 +10:00
raviola
827f82fa84 PR suggestions 2023-05-18 15:27:57 +10:00
Fernando Raviola
9d7317a4a9 Concat namespaces
Co-authored-by: Mathias Agopian <mathias@google.com>
2023-05-18 15:27:57 +10:00
Fernando Raviola
786008c2ed Add FrameGraph debugger lib: package structure + CmakeLists.txt 2023-05-18 15:27:57 +10:00
176 changed files with 1081 additions and 8 deletions

BIN
.build.sh.un~ Normal file

Binary file not shown.

View File

@@ -479,6 +479,13 @@ else()
option(FILAMENT_ENABLE_MATDBG "Enable the material debugger" OFF)
endif()
# By default, link in fgdbg for Desktop + Debug
if (CMAKE_BUILD_TYPE STREQUAL "Debug" AND IS_HOST_PLATFORM)
option(FILAMENT_ENABLE_FGDBG "Enable the framegraph debugger" ON)
else()
option(FILAMENT_ENABLE_FGDBG "Enable the framegraph debugger" OFF)
endif()
# Only optimize materials in Release mode (so error message lines match the source code)
if (CMAKE_BUILD_TYPE MATCHES Release)
option(FILAMENT_DISABLE_MATOPT "Disable material optimizations" OFF)
@@ -711,6 +718,10 @@ if (FILAMENT_BUILD_FILAMAT OR IS_HOST_PLATFORM)
if (FILAMENT_ENABLE_MATDBG OR IS_HOST_PLATFORM)
add_subdirectory(${LIBRARIES}/matdbg)
endif()
if (FILAMENT_ENABLE_FGDBG OR IS_HOST_PLATFORM)
add_subdirectory(${LIBRARIES}/fgdbg)
endif()
endif()
if (FILAMENT_SUPPORTS_VULKAN)

View File

@@ -312,6 +312,7 @@ and tools.
- `bluegl`: OpenGL bindings for macOS, Linux and Windows
- `bluevk`: Vulkan bindings for macOS, Linux, Windows and Android
- `camutils`: Camera manipulation utilities
- `fgdbg`: Frame Graph inspector and debugger (debug builds only)
- `filabridge`: Library shared by the Filament engine and host tools
- `filaflat`: Serialization/deserialization library used for materials
- `filagui`: Helper library for [Dear ImGui](https://github.com/ocornut/imgui)

View File

@@ -172,6 +172,8 @@ MATOPT_GRADLE_OPTION=""
ASAN_UBSAN_OPTION=""
FGDBG_OPTION="-DFILAMENT_ENABLE_FGDBG=OFF"
IOS_BUILD_SIMULATOR=false
BUILD_UNIVERSAL_LIBRARIES=false
@@ -233,6 +235,7 @@ function build_desktop_target {
${MATDBG_OPTION} \
${MATOPT_OPTION} \
${ASAN_UBSAN_OPTION} \
${FGDBG_OPTION} \
${deployment_target} \
${architectures} \
../..
@@ -360,6 +363,7 @@ function build_android_target {
-DCMAKE_TOOLCHAIN_FILE="../../build/toolchain-${arch}-linux-android.cmake" \
${MATDBG_OPTION} \
${MATOPT_OPTION} \
${FGDBG_OPTION} \
${VULKAN_ANDROID_OPTION} \
../..
fi
@@ -594,6 +598,7 @@ function build_ios_target {
-DCMAKE_TOOLCHAIN_FILE=../../third_party/clang/iOS.cmake \
${MATDBG_OPTION} \
${MATOPT_OPTION} \
${FGDBG_OPTION} \
../..
fi
@@ -778,6 +783,7 @@ while getopts ":hacCfgijmp:q:uvslwtedk:b" opt; do
PRINT_MATDBG_HELP=true
MATDBG_OPTION="-DFILAMENT_ENABLE_MATDBG=ON, -DFILAMENT_BUILD_FILAMAT=ON"
MATDBG_GRADLE_OPTION="-Pcom.google.android.filament.matdbg"
FGDBG_OPTION="-DFILAMENT_ENABLE_FGDBG=ON"
;;
f)
ISSUE_CMAKE_ALWAYS=true

View File

@@ -511,6 +511,13 @@ target_link_libraries(${TARGET} PUBLIC filaflat)
target_link_libraries(${TARGET} PUBLIC filabridge)
target_link_libraries(${TARGET} PUBLIC ibl-lite)
if (FILAMENT_ENABLE_FGDBG)
target_link_libraries(${TARGET} PUBLIC fgdbg)
add_definitions(-DFILAMENT_ENABLE_FGDBG=1)
else()
add_definitions(-DFILAMENT_ENABLE_FGDBG=0)
endif()
if (FILAMENT_ENABLE_MATDBG)
target_link_libraries(${TARGET} PUBLIC matdbg)
add_definitions(-DFILAMENT_ENABLE_MATDBG=1)

Binary file not shown.

View File

@@ -230,6 +230,13 @@ uint32_t FEngine::getJobSystemThreadPoolSize() noexcept {
void FEngine::init() {
SYSTRACE_CALL();
#if FILAMENT_ENABLE_FGDBG
if (!debug.fgdbg) {
auto server = std::make_shared<fgdbg::DebugServer>();
debug.fgdbg = std::make_unique<fgdbg::Session>("sample", server);
}
#endif
// this must be first.
assert_invariant( intptr_t(&mDriverApiStorage) % alignof(DriverApi) == 0 );
::new(&mDriverApiStorage) DriverApi(*mDriver, mCommandBufferQueue.getCircularBuffer());
@@ -590,16 +597,16 @@ int FEngine::loop() {
#endif
if (portString != nullptr) {
const int port = atoi(portString);
debug.server = new matdbg::DebugServer(mBackend, port);
debug.matdbg = std::make_unique<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.
if (!debug.server->isReady()) {
delete debug.server;
debug.server = nullptr;
if (!debug.matdbg->isReady()) {
delete debug.matdbg.get();
debug.matdbg = nullptr;
} else {
debug.server->setEditCallback(FMaterial::onEditCallback);
debug.server->setQueryCallback(FMaterial::onQueryCallback);
debug.matdbg->setEditCallback(FMaterial::onEditCallback);
debug.matdbg->setQueryCallback(FMaterial::onQueryCallback);
}
}
#endif
@@ -624,6 +631,22 @@ int FEngine::loop() {
uint32_t const id = std::thread::hardware_concurrency() - 1;
while (true) {
#if FILAMENT_ENABLE_FGDBG
// TODO (@feresr): Only for testing purposes, remove
if (debug.fgdbg) {
debug.fgdbg->clear();
debug.fgdbg->addPass({ "Pass 1", 1, { 1, 3 }, { 1 }});
debug.fgdbg->addPass({ "Pass 2", 2, { 4 }, { 1, 2 }});
debug.fgdbg->addPass({ "Pass 3", 3, { 2 }, { 4 }});
debug.fgdbg->addPass({ "Pass 4", 4, {}, { 4 }});
debug.fgdbg->addPass({ "Pass 5", 5, {1, 3}, { 1 }});
debug.fgdbg->addResource({ "resource 1", 1, 100 });
debug.fgdbg->addResource({ "resource 2", 2, 100 });
debug.fgdbg->addResource({ "resource 3", 3, 100 });
debug.fgdbg->addResource({ "resource 4", 4, 100 });
debug.fgdbg->update();
}
#endif
// looks like thread affinity needs to be reset regularly (on Android)
JobSystem::setThreadAffinityById(id);
if (!execute()) {

View File

@@ -58,6 +58,14 @@
#include <filament/Texture.h>
#include <filament/VertexBuffer.h>
#if FILAMENT_ENABLE_FGDBG
#include <fgdbg/Session.h>
#else
namespace filament::fgdbg {
class DebugServer;
} // namespace filament::fgdbg
#endif
#if FILAMENT_ENABLE_MATDBG
#include <matdbg/DebugServer.h>
#else
@@ -519,7 +527,8 @@ public:
bool doFrameCapture = false;
bool disable_buffer_padding = false;
} renderer;
matdbg::DebugServer* server = nullptr;
std::unique_ptr<matdbg::DebugServer> matdbg = nullptr;
std::unique_ptr<fgdbg::Session> fgdbg = nullptr;
} debug;
};

View File

@@ -214,7 +214,7 @@ FMaterial::FMaterial(FEngine& engine, const Material::Builder& builder)
#if FILAMENT_ENABLE_MATDBG
// Register the material with matdbg.
matdbg::DebugServer* server = downcast(engine).debug.server;
matdbg::DebugServer* server = downcast(engine).debug.matdbg.get();
if (UTILS_UNLIKELY(server)) {
auto details = builder.mImpl;
mDebuggerId = server->addMaterial(mName, details->mPayload, details->mSize, this);

22
libs/fgdbg/CMakeLists.txt Normal file
View File

@@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.19)
project(fgdbg)
set(TARGET fgdbg)
set(PUBLIC_HDR_DIR include)
# ==================================================================================================
# Sources and headers
# ==================================================================================================
set(PUBLIC_HDRS include/fgdbg/DebugServer.h include/fgdbg/Session.h)
set(SRCS src/DebugServer.cpp src/Session.cpp)
# ==================================================================================================
# Include and target definitions
# ==================================================================================================
add_library(${TARGET} STATIC ${PUBLIC_HDRS} ${SRCS})
target_link_libraries(${TARGET} PUBLIC civetweb utils)
target_include_directories(${TARGET} PUBLIC ${PUBLIC_HDR_DIR})
include_directories(${PUBLIC_HDR_DIR})

1
libs/fgdbg/README.md Normal file
View File

@@ -0,0 +1 @@
# FrameGraph Debugger (WIP)

9
libs/fgdbg/client/.gitignore vendored Normal file
View File

@@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
/.idea/caches
/.idea/gradle.xml
.DS_Store
/build

View File

@@ -0,0 +1,2 @@
#Thu Oct 20 11:28:41 AEDT 2022
gradle.version=7.3.3

Binary file not shown.

View File

@@ -0,0 +1,48 @@
import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.8.0"
id("org.jetbrains.compose") version "1.3.0"
kotlin("plugin.serialization") version "1.4.20"
}
group = "com.google.filament"
version = "1.0"
val ktorVersion: String by project
repositories {
google()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
maven {
url = uri("https://maven.pkg.jetbrains.space/public/p/ktor/eap")
name = "ktor-eap"
}
}
dependencies {
implementation(compose.desktop.currentOs)
dependencies {
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-cio:$ktorVersion")
implementation("io.ktor:ktor-client-websockets:$ktorVersion")
implementation("com.charleskorn.kaml:kaml:0.51.0")
}
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "11"
}
compose.desktop {
application {
mainClass = "MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "fgdbg"
packageVersion = "1.0.0"
}
}
}

Binary file not shown.

View File

@@ -0,0 +1 @@
Р и и и и и и и и и и н в в в б

Some files were not shown because too many files have changed in this diff Show More