17#if defined(SK_GRAPHITE)
26static DEFINE_int(CPUbenchTileW, 256,
"Tile width used for CPU SKP playback.");
27static DEFINE_int(CPUbenchTileH, 256,
"Tile height used for CPU SKP playback.");
29static DEFINE_int(GPUbenchTileW, 1600,
"Tile width used for GPU SKP playback.");
30static DEFINE_int(GPUbenchTileH, 512,
"Tile height used for GPU SKP playback.");
38 , fDoLooping(doLooping) {
43 for (
int i = 0;
i < fSurfaces.
size(); ++
i) {
44 fSurfaces[
i]->unref();
53 return fUniqueName.
c_str();
62#if defined(SK_GRAPHITE)
67 int tileW = gpu ? FLAGS_GPUbenchTileW : FLAGS_CPUbenchTileW,
68 tileH = gpu ? FLAGS_GPUbenchTileH : FLAGS_CPUbenchTileH;
77 fTileRects.
reserve(xTiles * yTiles);
84 *fTileRects.
append() = tileRect;
102 for (
int i = 0;
i < fTileRects.
size(); ++
i) {
137#if defined(SK_GRAPHITE)
140 std::unique_ptr<skgpu::graphite::Recording> recording = recorder->
snap();
143 info.fRecording = recording.get();
158 for (
int j = 0; j < fTileRects.
size(); ++j) {
160 -fTileRects[j].fTop / fScale);
161 fSurfaces[j]->getCanvas()->drawPicture(fPic.
get(), &trans,
nullptr);
164 for (
int j = 0; j < fTileRects.
size(); ++j) {
174 dContext->
priv().resetGpuStats();
175 dContext->
priv().resetContextStats();
179 dContext->
priv().dumpGpuStatsKeyValuePairs(keys,
values);
180 dContext->
priv().dumpCacheStatsKeyValuePairs(keys,
values);
181 dContext->
priv().dumpContextStatsKeyValuePairs(keys,
values);
194 direct->freeGpuResources();
195 direct->resetContext();
196 direct->priv().getGpu()->resetShaderCacheForTesting();
207 rContext->
priv().dmsaaStats() = {};
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
static DEFINE_int(CPUbenchTileW, 256, "Tile width used for CPU SKP playback.")
static void draw_pic_for_stats(SkCanvas *canvas, GrDirectContext *dContext, const SkPicture *picture, TArray< SkString > *keys, TArray< double > *values)
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
#define SkScalarCeilToInt(x)
virtual GrDirectContext * asDirectContext()
void flushAndSubmit(GrSyncCpu sync=GrSyncCpu::kNo)
GrSemaphoresSubmitted flush(const GrFlushInfo &info)
GrDirectContextPriv priv()
GrRecordingContextPriv priv()
const char * onGetName() override
void onPerCanvasPreDraw(SkCanvas *) override
SKPBench(const char *name, const SkPicture *, const SkIRect &devClip, SkScalar scale, bool doLooping)
void getGpuStats(SkCanvas *, skia_private::TArray< SkString > *keys, skia_private::TArray< double > *values) override
void onPerCanvasPostDraw(SkCanvas *) override
bool getDMSAAStats(GrRecordingContext *) override
virtual void drawMPDPicture()
void onDraw(int loops, SkCanvas *canvas) override
const char * onGetUniqueName() override
virtual void drawPicture()
bool isSuitableFor(Backend backend) override
SkISize onGetSize() override
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
sk_sp< SkSurface > makeSurface(const SkImageInfo &info, const SkSurfaceProps *props=nullptr)
virtual GrRecordingContext * recordingContext() const
virtual skgpu::graphite::Recorder * recorder() const
SkM44 getLocalToDevice() const
SkIRect getDeviceClipBounds() const
void setMatrix(const SkM44 &matrix)
void scale(SkScalar sx, SkScalar sy)
void drawPicture(const SkPicture *picture)
SkImageInfo imageInfo() const
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
static SkMatrix Translate(SkScalar dx, SkScalar dy)
void offset(SkScalar dx, SkScalar dy, SkPath *dst) const
virtual SkRect cullRect() const =0
void printf(const char format[],...) SK_PRINTF_LIKE(2
const char * c_str() const
bool submit(SyncToCpu=SyncToCpu::kNo)
bool insertRecording(const InsertRecordingInfo &)
std::unique_ptr< Recording > snap()
void reserve_exact(int n)
T & emplace_back(Args &&... args)
static float min(float r, float g, float b)
Optional< SkRect > bounds
sk_sp< const SkImage > image
sk_sp< const SkPicture > picture
DEF_SWITCHES_START aot vmservice shared library name
const myers::Point & get(const myers::Segment &)
void Flush(SkSurface *surface)
constexpr int32_t height() const
int32_t fTop
smaller y-axis bounds
constexpr int32_t width() const
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
int32_t fLeft
smaller x-axis bounds
static constexpr SkISize Make(int32_t w, int32_t h)
SkImageInfo makeWH(int newWidth, int newHeight) const
static SkRect Make(const SkISize &size)
void roundOut(SkIRect *dst) const