[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
This commit is contained in:
Doris Wu
2025-02-15 10:27:42 +08:00
committed by GitHub
parent 05906a5da0
commit 9ca0594d7c
7 changed files with 303 additions and 24 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 The Android Open Source Project
* Copyright (C) 2024 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,15 +25,33 @@ FrameGraphInfo::~FrameGraphInfo() = default;
FrameGraphInfo::FrameGraphInfo(FrameGraphInfo&& rhs) noexcept = default;
bool FrameGraphInfo::operator==(const FrameGraphInfo& rhs) const {
return viewName == rhs.viewName
&& passes == rhs.passes
&& resources == rhs.resources;
}
FrameGraphInfo::Pass::Pass(utils::CString name, std::vector<ResourceId> reads,
std::vector<ResourceId> writes): name(std::move(name)),
reads(std::move(reads)),
writes(std::move(writes)) {}
bool FrameGraphInfo::Pass::operator==(const Pass& rhs) const {
return name == rhs.name && reads == rhs.reads && writes == rhs.writes;
}
FrameGraphInfo::Resource::Resource(ResourceId id, utils::CString name,
std::vector<Property> properties): id(id),
name(std::move(name)), properties(std::move(properties)) {}
bool FrameGraphInfo::Resource::operator==(const Resource& rhs) const {
return id == rhs.id && name == rhs.name && properties == rhs.properties;
}
bool FrameGraphInfo::Resource::Property::operator==(const Property &rhs) const {
return name == rhs.name && value == rhs.value;
}
void FrameGraphInfo::setResources(
std::unordered_map<ResourceId, Resource> resources) {
this->resources = std::move(resources);
@@ -43,4 +61,17 @@ void FrameGraphInfo::setPasses(std::vector<Pass> sortedPasses) {
passes = std::move(sortedPasses);
}
const char* FrameGraphInfo::getViewName() const {
return viewName.c_str_safe();
}
const std::vector<FrameGraphInfo::Pass>& FrameGraphInfo::getPasses() const {
return passes;
}
const std::unordered_map<ResourceId, FrameGraphInfo::Resource>&
FrameGraphInfo::getResources() const {
return resources;
}
} // namespace filament::fgviewer