Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Renderer.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2022 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
9
10namespace skgpu::graphite {
11
12static uint32_t next_id() {
13 static std::atomic<uint32_t> nextID{0};
14 // Not worried about overflow since each Context won't have that many RenderSteps, so even if
15 // it wraps back to 0, that RenderStep will not be in the same Context as the original 0.
16 return nextID.fetch_add(1, std::memory_order_relaxed);
17}
18
19RenderStep::RenderStep(std::string_view className,
20 std::string_view variantName,
22 std::initializer_list<Uniform> uniforms,
23 PrimitiveType primitiveType,
24 DepthStencilSettings depthStencilSettings,
25 SkSpan<const Attribute> vertexAttrs,
26 SkSpan<const Attribute> instanceAttrs,
27 SkSpan<const Varying> varyings)
28 : fUniqueID(next_id())
29 , fFlags(flags)
30 , fPrimitiveType(primitiveType)
31 , fDepthStencilSettings(depthStencilSettings)
32 , fUniforms(uniforms)
33 , fVertexAttrs(vertexAttrs.begin(), vertexAttrs.end())
34 , fInstanceAttrs(instanceAttrs.begin(), instanceAttrs.end())
35 , fVaryings(varyings.begin(), varyings.end())
36 , fVertexStride(0)
37 , fInstanceStride(0)
38 , fName(className) {
39 for (auto v : this->vertexAttributes()) {
40 fVertexStride += v.sizeAlign4();
41 }
42 for (auto i : this->instanceAttributes()) {
43 fInstanceStride += i.sizeAlign4();
44 }
45 if (variantName.size() > 0) {
46 fName += "[";
47 fName += variantName;
48 fName += "]";
49 }
50}
51
52Coverage RenderStep::GetCoverage(SkEnumBitMask<Flags> flags) {
56}
57
58} // namespace skgpu::graphite
const char * fName
uint16_t fFlags
SkSpan< const Attribute > instanceAttributes() const
Definition Renderer.h:145
SkSpan< const Attribute > vertexAttributes() const
Definition Renderer.h:144
RenderStep(std::string_view className, std::string_view variantName, SkEnumBitMask< Flags > flags, std::initializer_list< Uniform > uniforms, PrimitiveType primitiveType, DepthStencilSettings depthStencilSettings, SkSpan< const Attribute > vertexAttrs, SkSpan< const Attribute > instanceAttrs, SkSpan< const Varying > varyings={})
Definition Renderer.cpp:19
static const char * begin(const StringSlice &s)
Definition editor.cpp:252
FlutterSemanticsFlag flags
glong glong end
static uint32_t next_id()
Definition DrawAtlas.cpp:69