From ca5b3ac2867f47abb53acba46d940215dd875875 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 18 Jun 2021 14:47:34 -0700 Subject: [PATCH] Minor updates to pass return values. --- engine/src/flutter/impeller/compositor/render_pass.h | 4 ++-- engine/src/flutter/impeller/compositor/renderer.mm | 9 +++++++-- engine/src/flutter/impeller/entity/entity_renderer.mm | 4 +++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/engine/src/flutter/impeller/compositor/render_pass.h b/engine/src/flutter/impeller/compositor/render_pass.h index 96d681de9d2..e3ad6cbfd6d 100644 --- a/engine/src/flutter/impeller/compositor/render_pass.h +++ b/engine/src/flutter/impeller/compositor/render_pass.h @@ -73,9 +73,9 @@ class RenderPass { HostBuffer& GetTransientsBuffer(); - bool RecordCommand(Command command); + [[nodiscard]] bool RecordCommand(Command command); - bool FinishEncoding(Allocator& transients_allocator) const; + [[nodiscard]] bool FinishEncoding(Allocator& transients_allocator) const; private: friend class CommandBuffer; diff --git a/engine/src/flutter/impeller/compositor/renderer.mm b/engine/src/flutter/impeller/compositor/renderer.mm index 551dab2380f..eb08cd0a2dc 100644 --- a/engine/src/flutter/impeller/compositor/renderer.mm +++ b/engine/src/flutter/impeller/compositor/renderer.mm @@ -53,13 +53,18 @@ bool Renderer::Render(const Surface& surface) { return false; } - render_pass->FinishEncoding(*GetContext()->GetTransientsAllocator()); + if (!render_pass->FinishEncoding(*GetContext()->GetTransientsAllocator())) { + return false; + } ::dispatch_semaphore_wait(frames_in_flight_sema_, DISPATCH_TIME_FOREVER); command_buffer->Commit( - [sema = frames_in_flight_sema_](CommandBuffer::CommitResult) { + [sema = frames_in_flight_sema_](CommandBuffer::CommitResult result) { ::dispatch_semaphore_signal(sema); + if (result != CommandBuffer::CommitResult::kCompleted) { + FML_LOG(ERROR) << "Could not commit command buffer."; + } }); return true; diff --git a/engine/src/flutter/impeller/entity/entity_renderer.mm b/engine/src/flutter/impeller/entity/entity_renderer.mm index e01aeb05a93..5f096d3810d 100644 --- a/engine/src/flutter/impeller/entity/entity_renderer.mm +++ b/engine/src/flutter/impeller/entity/entity_renderer.mm @@ -43,7 +43,9 @@ bool EntityRenderer::OnRender(RenderPass& pass) { cmd.vertex_bindings .buffers[shader::BoxVertexInfo::kUniformUniformBuffer.location] = pass.GetTransientsBuffer().Emplace(uniforms); - pass.RecordCommand(std::move(cmd)); + if (!pass.RecordCommand(std::move(cmd))) { + return false; + } return true; }