Cleanup vertex descriptor API.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user