Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
RectanizerBench Class Reference
Inheritance diagram for RectanizerBench:
Benchmark SkRefCnt SkRefCntBase

Public Types

enum  RectanizerType { kPow2_RectanizerType , kSkyline_RectanizerType }
 
enum  RectType { kRand_RectType , kRandPow2_RectType , kSmallPow2_RectType }
 
- Public Types inherited from Benchmark
enum class  Backend {
  kNonRendering , kRaster , kGanesh , kGraphite ,
  kPDF , kHWUI
}
 

Public Member Functions

 RectanizerBench (RectanizerType rectanizerType, RectType rectType)
 
- Public Member Functions inherited from Benchmark
 Benchmark ()
 
const char * getName ()
 
const char * getUniqueName ()
 
SkISize getSize ()
 
virtual bool isSuitableFor (Backend backend)
 
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
 

Static Public Attributes

static constexpr int kWidth = 1024
 
static constexpr int kHeight = 1024
 

Protected Member Functions

bool isSuitableFor (Backend backend) override
 
const char * onGetName () override
 
void onDelayedSetup () override
 
void onDraw (int loops, SkCanvas *canvas) override
 
- Protected Member Functions inherited from Benchmark
void setUnits (int units)
 
virtual void setupPaint (SkPaint *paint)
 
virtual const char * onGetName ()=0
 
virtual const char * onGetUniqueName ()
 
virtual void onDelayedSetup ()
 
virtual void onPerCanvasPreDraw (SkCanvas *)
 
virtual void onPerCanvasPostDraw (SkCanvas *)
 
virtual void onPreDraw (SkCanvas *)
 
virtual void onPostDraw (SkCanvas *)
 
virtual void onDraw (int loops, SkCanvas *)=0
 
virtual SkISize onGetSize ()
 

Detailed Description

This bench exercises the GPU backend's Rectanizer classes. It exercises the following rectanizers: Pow2 Rectanizer Skyline Rectanizer in the following cases: random rects (e.g., pull-save-layers forward use case) random power of two rects small constant sized power of 2 rects (e.g., glyph cache use case)

Definition at line 30 of file RectanizerBench.cpp.

Member Enumeration Documentation

◆ RectanizerType

Enumerator
kPow2_RectanizerType 
kSkyline_RectanizerType 

Definition at line 35 of file RectanizerBench.cpp.

◆ RectType

Enumerator
kRand_RectType 
kRandPow2_RectType 
kSmallPow2_RectType 

Definition at line 40 of file RectanizerBench.cpp.

Constructor & Destructor Documentation

◆ RectanizerBench()

RectanizerBench::RectanizerBench ( RectanizerType  rectanizerType,
RectType  rectType 
)
inline

Definition at line 46 of file RectanizerBench.cpp.

47 : fName("rectanizer_")
48 , fRectanizerType(rectanizerType)
49 , fRectType(rectType) {
50
51 if (kPow2_RectanizerType == fRectanizerType) {
52 fName.append("pow2_");
53 } else {
54 SkASSERT(kSkyline_RectanizerType == fRectanizerType);
55 fName.append("skyline_");
56 }
57
58 if (kRand_RectType == fRectType) {
59 fName.append("rand");
60 } else if (kRandPow2_RectType == fRectType) {
61 fName.append("rand2");
62 } else {
63 SkASSERT(kSmallPow2_RectType == fRectType);
64 fName.append("sm2");
65 }
66 }
#define SkASSERT(cond)
Definition: SkAssert.h:116
void append(const char text[])
Definition: SkString.h:203

Member Function Documentation

◆ isSuitableFor()

bool RectanizerBench::isSuitableFor ( Backend  backend)
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 69 of file RectanizerBench.cpp.

69 {
71 }
const char * backend

◆ onDelayedSetup()

void RectanizerBench::onDelayedSetup ( )
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 77 of file RectanizerBench.cpp.

77 {
78 SkASSERT(nullptr == fRectanizer.get());
79
80 if (kPow2_RectanizerType == fRectanizerType) {
81 fRectanizer = std::make_unique<RectanizerPow2>(kWidth, kHeight);
82 } else {
83 SkASSERT(kSkyline_RectanizerType == fRectanizerType);
84 fRectanizer = std::make_unique<RectanizerSkyline>(kWidth, kHeight);
85 }
86 }
static constexpr int kHeight
static constexpr int kWidth

◆ onDraw()

void RectanizerBench::onDraw ( int  loops,
SkCanvas canvas 
)
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 88 of file RectanizerBench.cpp.

88 {
89 SkRandom rand;
90 SkIPoint16 loc;
92
93 for (int i = 0; i < loops; ++i) {
94 if (kRand_RectType == fRectType) {
95 size = SkISize::Make(rand.nextRangeU(1, kWidth / 2),
96 rand.nextRangeU(1, kHeight / 2));
97 } else if (kRandPow2_RectType == fRectType) {
99 GrNextPow2(rand.nextRangeU(1, kHeight / 2)));
100 } else {
101 SkASSERT(kSmallPow2_RectType == fRectType);
102 size = SkISize::Make(128, 128);
103 }
104
105 if (!fRectanizer->addRect(size.fWidth, size.fHeight, &loc)) {
106 // insert failed so clear out the rectanizer and give the
107 // current rect another try
108 fRectanizer->reset();
109 i--;
110 }
111 }
112
113 fRectanizer->reset();
114 }
static uint32_t GrNextPow2(uint32_t n)
Definition: SkMathPriv.h:302
uint32_t nextRangeU(uint32_t min, uint32_t max)
Definition: SkRandom.h:80
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
Definition: SkSize.h:16
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ onGetName()

const char * RectanizerBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 73 of file RectanizerBench.cpp.

73 {
74 return fName.c_str();
75 }
const char * c_str() const
Definition: SkString.h:133

Member Data Documentation

◆ kHeight

constexpr int RectanizerBench::kHeight = 1024
inlinestaticconstexpr

Definition at line 33 of file RectanizerBench.cpp.

◆ kWidth

constexpr int RectanizerBench::kWidth = 1024
inlinestaticconstexpr

Definition at line 32 of file RectanizerBench.cpp.


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