fix: finalize GPU particle time interpolation
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled

This commit is contained in:
OpenAI Codex
2026-09-02 22:07:01 +08:00
parent d4c17fc8b0
commit 5dd4dbf496
11 changed files with 86 additions and 16 deletions

View File

@@ -732,10 +732,10 @@ void RenderRasterParticleLayer::update(gfx::ShaderRegistry& shaders,
Log::Error(Event::Render, "ParticleGPU: rejected incompatible time-window fields");
return;
}
const bool reuseOldT0 = !particle::fieldIdentityChanged(oldT0, nextT0);
const bool reuseOldT1 = !particle::fieldIdentityChanged(oldT1, nextT0);
const bool reuseNewT0 = !particle::fieldIdentityChanged(oldT0, nextT1);
const bool reuseNewT1 = !particle::fieldIdentityChanged(oldT1, nextT1);
const bool reuseOldT0 = particle::sameFieldGpuContent(oldT0, nextT0);
const bool reuseOldT1 = particle::sameFieldGpuContent(oldT1, nextT0);
const bool reuseNewT0 = particle::sameFieldGpuContent(oldT0, nextT1);
const bool reuseNewT1 = particle::sameFieldGpuContent(oldT1, nextT1);
const bool windowOverlap = reuseOldT0 || reuseOldT1 || reuseNewT0 || reuseNewT1;
const auto upload = [&](const particle::ParticleFieldSnapshot& field,
std::shared_ptr<PremultipliedImage>& image,
@@ -754,13 +754,13 @@ void RenderRasterParticleLayer::update(gfx::ShaderRegistry& shaders,
particle::ParticleFieldSnapshot& assigned,
std::shared_ptr<PremultipliedImage>& image,
gfx::Texture2DPtr& texture) {
if (!particle::fieldIdentityChanged(oldT0, wanted)) {
if (particle::sameFieldGpuContent(oldT0, wanted)) {
assigned = oldT0;
image = resources->fieldImage;
texture = resources->fieldTexture;
return true;
}
if (!particle::fieldIdentityChanged(oldT1, wanted)) {
if (particle::sameFieldGpuContent(oldT1, wanted)) {
assigned = oldT1;
image = resources->nextFieldImage;
texture = resources->nextFieldTexture;