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

@@ -929,6 +929,27 @@ bool RenderOrchestrator::retainedUnderlayHasUnsupportedLayer(int32_t boundary) c
return false;
}
ParticleFastPathDynamicState RenderOrchestrator::particleFastPathDynamicState(TimePoint timePoint) const {
ParticleFastPathDynamicState result;
result.blockingTransition = renderLight.hasTransition();
for (const auto& entry : renderLayers) {
const auto& layer = *entry.second;
result.blockingTransition = result.blockingTransition || layer.hasTransition();
if (layer.isLayerRenderable() && layer.isParticleAnimationActive()) result.particleNeedsRepaint = true;
if (layer.needsRepaint()) {
if (!layer.isParticleAnimationLayer()) {
result.nonParticleNeedsRepaint = true;
}
}
}
result.placementTransition = placementController.hasTransitions(timePoint);
for (const auto& entry : renderSources) {
result.fadingTiles = result.fadingTiles || entry.second->hasFadingTiles();
}
result.pendingChanges = !pendingChanges.empty();
return result;
}
bool RenderOrchestrator::isLoaded() const {
MLN_TRACE_FUNC();
@@ -1090,6 +1111,33 @@ void RenderOrchestrator::updateLayers(gfx::ShaderRegistry& shaders,
addChanges(changes);
}
void RenderOrchestrator::updateParticleLayers(gfx::ShaderRegistry& shaders,
gfx::Context& context,
const TransformState& state,
const std::shared_ptr<UpdateParameters>& updateParameters,
const RenderTree& renderTree) {
MLN_TRACE_FUNC();
const auto& items = renderTree.getLayerRenderItemMap();
std::vector<std::unique_ptr<ChangeRequest>> changes;
changes.reserve(8);
for (const auto& item : items) {
auto& renderLayer = item.layer.get();
if (!renderLayer.isParticleAnimationLayer()) continue;
#if MLN_RENDER_BACKEND_OPENGL
if (androidGoldfishMitigationEnabled) {
renderLayer.removeAllDrawables();
}
#endif
try {
renderLayer.update(shaders, context, state, updateParameters, renderTree, changes);
} catch (...) {
observer->onRenderError(std::current_exception());
}
}
addChanges(changes);
}
void RenderOrchestrator::processChanges() {
auto localChanges = std::move(pendingChanges);
for (auto& change : localChanges) {