Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkSLStructDefinition.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SKSL_STRUCTDEFINITION
9#define SKSL_STRUCTDEFINITION
10
15#include "src/sksl/ir/SkSLType.h" // IWYU pragma: keep
16
17#include <memory>
18#include <string>
19#include <string_view>
20
21namespace SkSL {
22
23class Context;
24
25/**
26 * A struct at global scope, as in:
27 *
28 * struct RenderData {
29 * float3 color;
30 * bool highQuality;
31 * };
32 */
33class StructDefinition final : public ProgramElement {
34public:
35 inline static constexpr Kind kIRNodeKind = Kind::kStructDefinition;
36
40
41 static std::unique_ptr<StructDefinition> Convert(const Context& context,
43 std::string_view name,
45
46 static std::unique_ptr<StructDefinition> Make(Position pos, const Type& type);
47
48 const Type& type() const {
49 return *fType;
50 }
51
52 std::string description() const override;
53
54private:
55 const Type* fType = nullptr;
56
57 using INHERITED = ProgramElement;
58};
59
60} // namespace SkSL
61
62#endif
SkPoint pos
StructDefinition(Position pos, const Type &type)
static std::unique_ptr< StructDefinition > Make(Position pos, const Type &type)
std::string description() const override
static std::unique_ptr< StructDefinition > Convert(const Context &context, Position pos, std::string_view name, skia_private::TArray< Field > fields)
const Type & type() const
static constexpr Kind kIRNodeKind
const char * name
Definition fuchsia.cc:50
ProgramElementKind
Definition SkSLIRNode.h:19