Cleanup vertex descriptor API.

This commit is contained in:
Chinmay Garde
2021-05-25 14:51:27 -07:00
committed by Dan Field
parent 2364e5990c
commit 865b955371
2 changed files with 10 additions and 2 deletions

View File

@@ -20,6 +20,12 @@ class VertexDescriptor final : public Comparable<VertexDescriptor> {
virtual ~VertexDescriptor();
template <size_t Size>
bool SetStageInputs(
const std::array<const ShaderStageIOSlot*, Size>& inputs) {
return SetStageInputs(inputs.data(), inputs.size());
}
bool SetStageInputs(const ShaderStageIOSlot* const stage_inputs[],
size_t count);

View File

@@ -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> context) {
{
auto vertex_descriptor = std::make_shared<VertexDescriptor>();
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> context) {
auto pipeline =
context->GetPipelineLibrary()->GetRenderPipeline(std::move(desc)).get();
if (!pipeline) {
FML_LOG(ERROR) << "Could not create the render pipeline.";
return false;
}