Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
skgpu::graphite::FileIntersectionBench Class Reference
Inheritance diagram for skgpu::graphite::FileIntersectionBench:
skgpu::graphite::IntersectionTreeBench Benchmark SkRefCnt SkRefCntBase

Public Member Functions

 FileIntersectionBench ()
 
- Public Member Functions inherited from Benchmark
 Benchmark ()
 
const char * getName ()
 
const char * getUniqueName ()
 
SkISize getSize ()
 
virtual void modifyGrContextOptions (GrContextOptions *)
 
virtual bool shouldLoop () const
 
void delayedSetup ()
 
void perCanvasPreDraw (SkCanvas *)
 
void perCanvasPostDraw (SkCanvas *)
 
void preDraw (SkCanvas *)
 
void postDraw (SkCanvas *)
 
void draw (int loops, SkCanvas *)
 
virtual void getGpuStats (SkCanvas *, skia_private::TArray< SkString > *keys, skia_private::TArray< double > *values)
 
virtual bool getDMSAAStats (GrRecordingContext *)
 
int getUnits () const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Private Member Functions

bool isSuitableFor (Backend backend) final
 
void gatherRects (TArray< SkRect > *rects) override
 
void onPerCanvasPostDraw (SkCanvas *) override
 

Additional Inherited Members

- Public Types inherited from Benchmark
enum class  Backend {
  kNonRendering , kRaster , kGanesh , kGraphite ,
  kPDF , kHWUI
}
 
- Protected Member Functions inherited from skgpu::graphite::IntersectionTreeBench
const char * onGetName () final
 
bool isSuitableFor (Backend backend) override
 
void onDelayedSetup () final
 
void onDraw (int loops, SkCanvas *) final
 
void doBench ()
 
- Protected Member Functions inherited from Benchmark
void setUnits (int units)
 
virtual void setupPaint (SkPaint *paint)
 
virtual const char * onGetUniqueName ()
 
virtual void onPerCanvasPreDraw (SkCanvas *)
 
virtual void onPreDraw (SkCanvas *)
 
virtual void onPostDraw (SkCanvas *)
 
virtual SkISize onGetSize ()
 
- Protected Attributes inherited from skgpu::graphite::IntersectionTreeBench
SkString fName
 
SkArenaAlloc fAlignedAllocator {0}
 
int fRectCount
 
RectfRects
 
RectfRectBufferA
 
RectfRectBufferB
 
int fNumTrees = 0
 

Detailed Description

Definition at line 106 of file IntersectionTreeBench.cpp.

Constructor & Destructor Documentation

◆ FileIntersectionBench()

skgpu::graphite::FileIntersectionBench::FileIntersectionBench ( )
inline

Definition at line 108 of file IntersectionTreeBench.cpp.

108 {
109 if (FLAGS_intersectionTreeFile.isEmpty()) {
110 return;
111 }
112 const char* filename = strrchr(FLAGS_intersectionTreeFile[0], '/');
113 if (filename) {
114 ++filename;
115 } else {
116 filename = FLAGS_intersectionTreeFile[0];
117 }
118 fName.printf("IntersectionTree_file_%s", filename);
119 }
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition SkString.cpp:534

Member Function Documentation

◆ gatherRects()

void skgpu::graphite::FileIntersectionBench::gatherRects ( TArray< SkRect > *  rects)
inlineoverrideprivatevirtual

Implements skgpu::graphite::IntersectionTreeBench.

Definition at line 129 of file IntersectionTreeBench.cpp.

129 {
130 if (FLAGS_intersectionTreeFile.isEmpty()) {
131 return;
132 }
133 auto callback = [&](const SkMatrix& matrix,
134 const SkPath& path,
135 const SkPaint& paint) {
136 if (paint.getStyle() == SkPaint::kStroke_Style) {
137 return; // Goes to stroker.
138 }
139 if (path.isConvex()) {
140 return; // Goes to convex renderer.
141 }
142 int numVerbs = path.countVerbs();
143 SkRect drawBounds = matrix.mapRect(path.getBounds());
144 float gpuFragmentWork = drawBounds.height() * drawBounds.width();
145 float cpuTessellationWork = numVerbs * SkNextLog2(numVerbs); // N log N.
146 constexpr static float kCpuWeight = 512;
147 constexpr static float kMinNumPixelsToTriangulate = 256 * 256;
148 if (cpuTessellationWork * kCpuWeight + kMinNumPixelsToTriangulate < gpuFragmentWork) {
149 return; // Goes to inner triangulator.
150 }
151 rects->push_back(drawBounds);
152 };
153 const char* path = FLAGS_intersectionTreeFile[0];
154 if (const char* ext = strrchr(path, '.'); ext && !strcmp(ext, ".svg")) {
155#if defined(SK_ENABLE_SVG)
157#else
158 SK_ABORT("must compile with svg backend to process svgs");
159#endif
160 } else {
162 }
163 SkDebugf(">> Found %i stencil/cover paths in %s <<\n",
164 rects->size(), FLAGS_intersectionTreeFile[0]);
165 }
#define SK_ABORT(message,...)
Definition SkAssert.h:70
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static int SkNextLog2(uint32_t value)
Definition SkMathPriv.h:238
@ kStroke_Style
set to stroke geometry
Definition SkPaint.h:194
int size() const
Definition SkTArray.h:416
const Paint & paint
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
unsigned useCenter Optional< SkMatrix > matrix
Definition SkRecords.h:258
void ExtractPathsFromSVG(const char filepath[], std::function< PathSniffCallback >)
void ExtractPathsFromSKP(const char filepath[], std::function< PathSniffCallback > callback)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switches.h:57
constexpr float height() const
Definition SkRect.h:769
constexpr float width() const
Definition SkRect.h:762

◆ isSuitableFor()

bool skgpu::graphite::FileIntersectionBench::isSuitableFor ( Backend  backend)
inlinefinalprivatevirtual

Reimplemented from Benchmark.

Definition at line 122 of file IntersectionTreeBench.cpp.

122 {
123 if (FLAGS_intersectionTreeFile.isEmpty()) {
124 return false;
125 }
127 }
bool isSuitableFor(Backend backend) override

◆ onPerCanvasPostDraw()

void skgpu::graphite::FileIntersectionBench::onPerCanvasPostDraw ( SkCanvas )
inlineoverrideprivatevirtual

Reimplemented from Benchmark.

Definition at line 167 of file IntersectionTreeBench.cpp.

167 {
168 if (FLAGS_intersectionTreeFile.isEmpty()) {
169 return;
170 }
171 SkDebugf(">> Reordered %s into %i different stencil/cover draws <<\n",
172 FLAGS_intersectionTreeFile[0], fNumTrees);
173 }

The documentation for this class was generated from the following file: