ad8a43f769
Chrome would like to perform cpu-side preprocessing for gpu draws in parallel. They do not want to go through a picture (since they have their own display list format). The general idea is that we add a new SkDeferredDisplayListRecorder class to perform all of Ganesh's cpu-side preprocessing ahead of time and in parallel. The SkDDLRecorder operates like SkPictureRecorder. The user can get an SkCanvas from the SkDDLRecorder and feed it draw operations. Once finished, the user calls 'detach' to get an SkDeferredDisplayList. All the work up to and including the 'detach' call can be done in parallel and will not touch the GPU. To actually get pixels the client must call SkSurface::draw(SkDDL) on an SkSurface that is "compatible" with the surface characterization initially given to the SkDDLMaker. The surface characterization contains the minimum amount of information Ganesh needs to know about the ultimate destination in order to perform its cpu-side work (i.e., caps, width, height, config). Change-Id: I75faa483ab5a6b779c8de56ea56b9d90b990f43a Reviewed-on: https://skia-review.googlesource.com/30140 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
55 lines
1.4 KiB
C++
55 lines
1.4 KiB
C++
/*
|
|
* Copyright 2017 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef SkSurfaceCharacterization_DEFINED
|
|
#define SkSurfaceCharacterization_DEFINED
|
|
|
|
#include "GrTypes.h"
|
|
|
|
class SkSurface;
|
|
|
|
// This class captures all the pertinent data about an SkSurface required
|
|
// to perform cpu-preprocessing for gpu-rendering.
|
|
class SkSurfaceCharacterization {
|
|
public:
|
|
SkSurfaceCharacterization()
|
|
: fOrigin(kBottomLeft_GrSurfaceOrigin)
|
|
, fWidth(0)
|
|
, fHeight(0)
|
|
, fConfig(kRGBA_8888_GrPixelConfig)
|
|
, fSampleCnt(0) {
|
|
}
|
|
|
|
void set(GrSurfaceOrigin origin,
|
|
int width, int height,
|
|
GrPixelConfig config,
|
|
int sampleCnt) {
|
|
fOrigin = origin;
|
|
fWidth = width;
|
|
fHeight = height;
|
|
fConfig = config;
|
|
fSampleCnt = sampleCnt;
|
|
}
|
|
|
|
GrSurfaceOrigin origin() const { return fOrigin; }
|
|
int width() const { return fWidth; }
|
|
int height() const { return fHeight; }
|
|
GrPixelConfig config() const { return fConfig; }
|
|
int sampleCount() const { return fSampleCnt; }
|
|
|
|
private:
|
|
GrSurfaceOrigin fOrigin;
|
|
int fWidth;
|
|
int fHeight;
|
|
GrPixelConfig fConfig;
|
|
int fSampleCnt;
|
|
// TODO: need to include caps!
|
|
// Maybe use GrContextThreadSafeProxy (it has the caps & the unique Context ID already)
|
|
};
|
|
|
|
#endif
|