diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-11 11:51:41 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-11 11:51:41 +0100 |
| commit | 0b756c0d0c9e968b2182ea720a8a24afd5c4bc0a (patch) | |
| tree | f364f6ae31b0bf2cc0890046059be4545dc97be9 /src/gpu | |
| parent | c809790015b4ddc354c6b1993a633eddd042930f (diff) | |
fix: Call resize() before init() to set dimensions first
Simpler solution than lazy initialization: effects need correct
dimensions during init() to register auxiliary textures.
Changed initialization order in MainSequence:
- resize() sets width_/height_ FIRST
- init() can then use correct dimensions
Reverted lazy initialization complexity. One-line fix.
Tests: All 36 tests passing, demo runs without error
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/gpu')
| -rw-r--r-- | src/gpu/effect.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gpu/effect.cc b/src/gpu/effect.cc index 42e623a..58e011c 100644 --- a/src/gpu/effect.cc +++ b/src/gpu/effect.cc @@ -177,8 +177,8 @@ void MainSequence::init(const GpuContext& ctx, int width, int height) { passthrough_effect_->resize(width, height); for (ActiveSequence& entry : sequences_) { - entry.seq->init(this); - entry.seq->resize(width, height); + entry.seq->resize(width, height); // Set dimensions FIRST + entry.seq->init(this); // Then init with correct dimensions } } @@ -187,8 +187,8 @@ void MainSequence::add_sequence(std::shared_ptr<Sequence> seq, float start_time, sequences_.push_back({seq, start_time, priority}); // If MainSequence is already initialized, init the new sequence immediately if (gpu_ctx.device) { - seq->init(this); - seq->resize(width_, height_); + seq->resize(width_, height_); // Set dimensions FIRST + seq->init(this); // Then init with correct dimensions } std::sort(sequences_.begin(), sequences_.end(), [](const ActiveSequence& a, const ActiveSequence& b) { |
