| 391 | } |
| 392 | |
| 393 | wf::region_t wf::render_pass_t::run_partial() |
| 394 | { |
| 395 | auto accumulated_damage = params.damage; |
| 396 | if (params.flags & RPASS_EMIT_SIGNALS) |
| 397 | { |
| 398 | // Emit render_pass_begin |
| 399 | render_pass_begin_signal ev{*this, accumulated_damage}; |
| 400 | wf::get_core().emit(&ev); |
| 401 | } |
| 402 | |
| 403 | wf::region_t swap_damage = accumulated_damage; |
| 404 | |
| 405 | // Gather instructions |
| 406 | std::vector<wf::scene::render_instruction_t> instructions; |
| 407 | if (params.instances) |
| 408 | { |
| 409 | for (auto& inst : *params.instances) |
| 410 | { |
| 411 | inst->schedule_instructions(instructions, |
| 412 | params.target, accumulated_damage); |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | this->pass = wlr_renderer_begin_buffer_pass( |
| 417 | params.renderer ?: wf::get_core().renderer, |
| 418 | params.target.get_buffer(), |
| 419 | params.pass_opts); |
| 420 | |
| 421 | if (!pass) |
| 422 | { |
| 423 | LOGE("Error: failed to start wlr render pass!"); |
| 424 | return accumulated_damage; |
| 425 | } |
| 426 | |
| 427 | // Clear visible background areas |
| 428 | if (params.flags & RPASS_CLEAR_BACKGROUND) |
| 429 | { |
| 430 | clear(accumulated_damage, params.background_color); |
| 431 | } |
| 432 | |
| 433 | // Render instances |
| 434 | for (auto& instr : wf::reverse(instructions)) |
| 435 | { |
| 436 | instr.pass = this; |
| 437 | instr.instance->render(instr); |
| 438 | if (params.reference_output) |
| 439 | { |
| 440 | instr.instance->presentation_feedback(params.reference_output); |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | if (params.flags & RPASS_EMIT_SIGNALS) |
| 445 | { |
| 446 | render_pass_end_signal end_ev{*this}; |
| 447 | wf::get_core().emit(&end_ev); |
| 448 | } |
| 449 | |
| 450 | return swap_damage; |
no test coverage detected