feat: add particle static CPU fast path
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled

This commit is contained in:
tei
2026-09-23 08:22:24 +09:00
parent 98e1d2d977
commit 4e3d27e1f3
18 changed files with 1247 additions and 38 deletions

View File

@@ -24,6 +24,7 @@ Renderer::~Renderer() {
}
void Renderer::markContextLost() {
impl->clearPreparedRenderTree();
impl->orchestrator.markContextLost();
}
@@ -39,12 +40,21 @@ void Renderer::render(const std::shared_ptr<UpdateParameters>& updateParameters)
const bool styleChanged = impl->styleLoaded && !updateParameters->styleLoaded;
impl->styleLoaded = updateParameters->styleLoaded;
if (!impl->dynamicTextureAtlas || styleChanged) {
if (styleChanged) impl->clearPreparedRenderTree();
auto& context = impl->backend.getContext();
impl->dynamicTextureAtlas = std::make_unique<gfx::DynamicTextureAtlas>(context);
}
if (impl->tryRenderParticleFastFrame(updateParameters)) return;
// A full createRenderTree may replace RenderLayer/RenderSource instances.
// Drop the old prepared tree first so its reference-based render items can
// never outlive the orchestrator objects they describe.
impl->clearPreparedRenderTree();
if (auto renderTree = impl->orchestrator.createRenderTree(updateParameters, impl->dynamicTextureAtlas)) {
renderTree->prepare();
impl->render(*renderTree, updateParameters);
impl->render(*renderTree, updateParameters, false);
impl->commitPreparedRenderTree(std::move(renderTree), updateParameters);
} else {
impl->clearPreparedRenderTree();
}
}
@@ -162,11 +172,13 @@ bool Renderer::getTileCacheEnabled() const {
void Renderer::reduceMemoryUse() {
gfx::BackendScope guard{impl->backend};
impl->clearPreparedRenderTree();
impl->reduceMemoryUse();
impl->orchestrator.reduceMemoryUse();
}
void Renderer::clearData() {
impl->clearPreparedRenderTree();
impl->orchestrator.clearData();
}