feat: add particle static CPU fast path
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user