From 07229ea4d7c3de0082a3a52fb12c5226dda5454a Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 2 Nov 2021 15:45:04 -0700 Subject: [PATCH] Minor doc updates. --- .../src/flutter/impeller/renderer/command_buffer.h | 5 +++++ engine/src/flutter/impeller/renderer/render_pass.h | 11 +++++++++-- .../impeller/renderer/renderer_unittests.cc | 14 +++++++------- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/engine/src/flutter/impeller/renderer/command_buffer.h b/engine/src/flutter/impeller/renderer/command_buffer.h index 2d7f6be260..10b9a6b189 100644 --- a/engine/src/flutter/impeller/renderer/command_buffer.h +++ b/engine/src/flutter/impeller/renderer/command_buffer.h @@ -15,6 +15,11 @@ class Context; class RenderPass; class RenderPassDescriptor; +//------------------------------------------------------------------------------ +/// @brief A collection of encoded commands to be submitted to the GPU for +/// execution. A command buffer is obtained from a graphics +/// `Context`. +/// class CommandBuffer { public: enum class CommitResult { diff --git a/engine/src/flutter/impeller/renderer/render_pass.h b/engine/src/flutter/impeller/renderer/render_pass.h index c61f16cc2e..e64ff8e249 100644 --- a/engine/src/flutter/impeller/renderer/render_pass.h +++ b/engine/src/flutter/impeller/renderer/render_pass.h @@ -23,12 +23,19 @@ class RenderPass { virtual HostBuffer& GetTransientsBuffer() = 0; + //---------------------------------------------------------------------------- + /// @brief Record a command for subsequent commit to the underlying + /// command buffer. No work is encoded into the command buffer at + /// this time. + /// + /// @param[in] command The command + /// + /// @return If the command was valid for subsequent commitment. + /// [[nodiscard]] virtual bool RecordCommand(Command command) = 0; //---------------------------------------------------------------------------- /// @brief Commit the recorded commands to the underlying command buffer. - /// Any completion handlers must on the underlying command buffer - /// must have already been added by this point. /// /// @param transients_allocator The transients allocator. /// diff --git a/engine/src/flutter/impeller/renderer/renderer_unittests.cc b/engine/src/flutter/impeller/renderer/renderer_unittests.cc index 0d5117f68c..cdfb75b6f9 100644 --- a/engine/src/flutter/impeller/renderer/renderer_unittests.cc +++ b/engine/src/flutter/impeller/renderer/renderer_unittests.cc @@ -25,9 +25,9 @@ namespace impeller { namespace testing { -using CompositorTest = Playground; +using RendererTest = Playground; -TEST_F(CompositorTest, CanCreateBoxPrimitive) { +TEST_F(RendererTest, CanCreateBoxPrimitive) { using VS = BoxFadeVertexShader; using FS = BoxFadeFragmentShader; auto context = GetContext(); @@ -91,7 +91,7 @@ TEST_F(CompositorTest, CanCreateBoxPrimitive) { // OpenPlaygroundHere(callback); } -TEST_F(CompositorTest, CanRenderMultiplePrimitives) { +TEST_F(RendererTest, CanRenderMultiplePrimitives) { using VS = BoxFadeVertexShader; using FS = BoxFadeFragmentShader; auto context = GetContext(); @@ -144,8 +144,8 @@ TEST_F(CompositorTest, CanRenderMultiplePrimitives) { cmd.primitive_type = PrimitiveType::kTriangle; - for (size_t i = 0; i < 50; i++) { - for (size_t j = 0; j < 50; j++) { + for (size_t i = 0; i < 1; i++) { + for (size_t j = 0; j < 1; j++) { VS::UniformBuffer uniforms; uniforms.mvp = Matrix::MakeOrthographic(surface.GetSize()) * Matrix::MakeTranslation({i * 50.0f, j * 50.0f, 0.0f}); @@ -162,7 +162,7 @@ TEST_F(CompositorTest, CanRenderMultiplePrimitives) { // OpenPlaygroundHere(callback); } -TEST_F(CompositorTest, CanRenderToTexture) { +TEST_F(RendererTest, CanRenderToTexture) { using VS = BoxFadeVertexShader; using FS = BoxFadeFragmentShader; auto context = GetContext(); @@ -253,7 +253,7 @@ TEST_F(CompositorTest, CanRenderToTexture) { ASSERT_TRUE(r2t_pass->Commit(*context->GetTransientsAllocator())); } -TEST_F(CompositorTest, CanRenderPath) { +TEST_F(RendererTest, CanRenderPath) { auto path = PathBuilder{}.AddCircle({550, 550}, 500).CreatePath(); ASSERT_FALSE(path.GetBoundingBox().IsZero());