Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrThreadSafePipelineBuilder.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 Google Inc.
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 GrThreadSafePipelineBuilder_Base_DEFINED
9#define GrThreadSafePipelineBuilder_Base_DEFINED
10
13#include <atomic>
14
15#if defined(GR_TEST_UTILS)
18#endif
19
21public:
23
24 class Stats {
25 public:
26 enum class ProgramCacheResult {
27 kHit, // the program was found in the cache
28 kMiss, // the program was not found in the cache (and was, thus, compiled)
29 kPartial, // a precompiled version was found in the persistent cache
30
32 };
33
34#if GR_GPU_STATS
35 static const int kNumProgramCacheResults = (int)ProgramCacheResult::kLast + 1;
36
37 Stats() = default;
38
39 int shaderCompilations() const { return fShaderCompilations; }
40 void incShaderCompilations() { fShaderCompilations++; }
41
42 int numInlineCompilationFailures() const { return fNumInlineCompilationFailures; }
43 void incNumInlineCompilationFailures() { ++fNumInlineCompilationFailures; }
44
45 int numInlineProgramCacheResult(ProgramCacheResult stat) const {
46 return fInlineProgramCacheStats[(int) stat];
47 }
49 ++fInlineProgramCacheStats[(int) stat];
50 }
51
52 int numPreCompilationFailures() const { return fNumPreCompilationFailures; }
53 void incNumPreCompilationFailures() { ++fNumPreCompilationFailures; }
54
55 int numPreProgramCacheResult(ProgramCacheResult stat) const {
56 return fPreProgramCacheStats[(int) stat];
57 }
59 ++fPreProgramCacheStats[(int) stat];
60 }
61
62 int numCompilationFailures() const { return fNumCompilationFailures; }
63 void incNumCompilationFailures() { ++fNumCompilationFailures; }
64
65 int numPartialCompilationSuccesses() const { return fNumPartialCompilationSuccesses; }
66 void incNumPartialCompilationSuccesses() { ++fNumPartialCompilationSuccesses; }
67
68 int numCompilationSuccesses() const { return fNumCompilationSuccesses; }
69 void incNumCompilationSuccesses() { ++fNumCompilationSuccesses; }
70
71#if defined(GR_TEST_UTILS)
72 void dump(SkString*);
73 void dumpKeyValuePairs(skia_private::TArray<SkString>* keys, skia_private::TArray<double>* values);
74#endif
75
76 private:
77 std::atomic<int> fShaderCompilations{0};
78
79 std::atomic<int> fNumInlineCompilationFailures{0};
80 std::atomic<int> fInlineProgramCacheStats[kNumProgramCacheResults]{};
81
82 std::atomic<int> fNumPreCompilationFailures{0};
83 std::atomic<int> fPreProgramCacheStats[kNumProgramCacheResults]{};
84
85 std::atomic<int> fNumCompilationFailures{0};
86 std::atomic<int> fNumPartialCompilationSuccesses{0};
87 std::atomic<int> fNumCompilationSuccesses{0};
88
89#else
98
99#if defined(GR_TEST_UTILS)
100 void dump(SkString*) {}
102#endif
103
104#endif // GR_GPU_STATS
105 };
106
107 Stats* stats() { return &fStats; }
108
109protected:
111};
112
113#endif
static void dump(const float m[20], SkYUVColorSpace cs, bool rgb2yuv)
Type::kYUV Type::kRGBA() int(0.7 *637)
void incNumPreProgramCacheResult(ProgramCacheResult stat)
void incNumInlineProgramCacheResult(ProgramCacheResult stat)