From 865b9553719d68b7f497b197451f5072d854cf19 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 25 May 2021 14:51:27 -0700 Subject: [PATCH] Cleanup vertex descriptor API. --- .../impeller/impeller/compositor/vertex_descriptor.h | 6 ++++++ engine/src/flutter/impeller/impeller/primitives/box.mm | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/impeller/impeller/compositor/vertex_descriptor.h b/engine/src/flutter/impeller/impeller/compositor/vertex_descriptor.h index 43f8ba9ed1..8c2c0bb938 100644 --- a/engine/src/flutter/impeller/impeller/compositor/vertex_descriptor.h +++ b/engine/src/flutter/impeller/impeller/compositor/vertex_descriptor.h @@ -20,6 +20,12 @@ class VertexDescriptor final : public Comparable { virtual ~VertexDescriptor(); + template + bool SetStageInputs( + const std::array& inputs) { + return SetStageInputs(inputs.data(), inputs.size()); + } + bool SetStageInputs(const ShaderStageIOSlot* const stage_inputs[], size_t count); diff --git a/engine/src/flutter/impeller/impeller/primitives/box.mm b/engine/src/flutter/impeller/impeller/primitives/box.mm index 02b832aab8..f303313df5 100644 --- a/engine/src/flutter/impeller/impeller/primitives/box.mm +++ b/engine/src/flutter/impeller/impeller/primitives/box.mm @@ -8,6 +8,7 @@ #include "box.frag.h" #include "box.vert.h" +#include "flutter/fml/logging.h" #include "impeller/compositor/pipeline_descriptor.h" #include "impeller/compositor/shader_library.h" #include "impeller/compositor/vertex_descriptor.h" @@ -31,8 +32,8 @@ bool RenderBox(std::shared_ptr context) { { auto vertex_descriptor = std::make_shared(); if (!vertex_descriptor->SetStageInputs( - shader::BoxVertexInfo::kAllShaderStageInputs.data(), - shader::BoxVertexInfo::kAllShaderStageInputs.size())) { + shader::BoxVertexInfo::kAllShaderStageInputs)) { + FML_LOG(ERROR) << "Could not configure vertex descriptor."; return false; } desc.SetVertexDescriptor(std::move(vertex_descriptor)); @@ -41,6 +42,7 @@ bool RenderBox(std::shared_ptr context) { auto pipeline = context->GetPipelineLibrary()->GetRenderPipeline(std::move(desc)).get(); if (!pipeline) { + FML_LOG(ERROR) << "Could not create the render pipeline."; return false; }