2015-05-26 18:38:03 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2015 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GrDrawContext_DEFINED
|
|
|
|
#define GrDrawContext_DEFINED
|
|
|
|
|
|
|
|
#include "GrColor.h"
|
2016-06-08 17:08:43 +00:00
|
|
|
#include "GrPaint.h"
|
2015-12-01 20:51:26 +00:00
|
|
|
#include "GrRenderTarget.h"
|
2015-05-26 18:38:03 +00:00
|
|
|
#include "SkRefCnt.h"
|
2016-03-02 17:26:36 +00:00
|
|
|
#include "SkRegion.h"
|
2015-06-19 18:49:52 +00:00
|
|
|
#include "SkSurfaceProps.h"
|
Begin instanced rendering for simple shapes
Adds a module that performs instanced rendering and starts using it
for a select subset of draws on Mac GL platforms. The instance
processor can currently handle rects, ovals, round rects, and double
round rects. It can generalize shapes as round rects in order to
improve batching. The instance processor also employs new drawing
algorithms, irrespective of instanced rendering, that improve GPU-side
performance (e.g. sample mask, different triangle layouts, etc.).
This change only scratches the surface of instanced rendering. The
majority of draws still only have one instance. Future work may
include:
* Passing coord transforms through the texel buffer.
* Sending FP uniforms through instanced vertex attribs.
* Using instanced rendering for more draws (stencil writes,
drawAtlas, etc.).
* Adding more shapes to the instance processor’s repertoire.
* Batching draws that have mismatched scissors (analyzing draw
bounds, inserting clip planes, etc.).
* Bindless textures.
* Uber shaders.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2066993003
Committed: https://skia.googlesource.com/skia/+/42eafa4bc00354b132ad114d22ed6b95d8849891
Review-Url: https://codereview.chromium.org/2066993003
2016-07-07 15:49:11 +00:00
|
|
|
#include "../private/GrInstancedPipelineInfo.h"
|
2016-01-06 16:26:09 +00:00
|
|
|
#include "../private/GrSingleOwner.h"
|
2015-05-26 18:38:03 +00:00
|
|
|
|
2016-02-16 19:09:25 +00:00
|
|
|
class GrAtlasTextContext;
|
2016-01-13 14:45:40 +00:00
|
|
|
class GrAuditTrail;
|
2015-05-26 18:38:03 +00:00
|
|
|
class GrClip;
|
|
|
|
class GrContext;
|
2015-08-13 20:34:48 +00:00
|
|
|
class GrDrawBatch;
|
2016-03-02 17:26:36 +00:00
|
|
|
class GrDrawContextPriv;
|
2015-12-08 18:20:32 +00:00
|
|
|
class GrDrawPathBatchBase;
|
2015-10-17 14:43:27 +00:00
|
|
|
class GrDrawingManager;
|
2015-05-26 18:38:03 +00:00
|
|
|
class GrDrawTarget;
|
|
|
|
class GrPaint;
|
|
|
|
class GrPathProcessor;
|
|
|
|
class GrPipelineBuilder;
|
|
|
|
class GrRenderTarget;
|
2016-05-10 16:14:17 +00:00
|
|
|
class GrStyle;
|
2015-05-26 18:38:03 +00:00
|
|
|
class GrSurface;
|
2016-07-08 21:43:03 +00:00
|
|
|
struct GrUserStencilSettings;
|
2015-06-17 12:43:33 +00:00
|
|
|
class SkDrawFilter;
|
2015-05-26 18:38:03 +00:00
|
|
|
struct SkIPoint;
|
|
|
|
struct SkIRect;
|
|
|
|
class SkMatrix;
|
2015-06-17 12:43:33 +00:00
|
|
|
class SkPaint;
|
2015-05-26 18:38:03 +00:00
|
|
|
class SkPath;
|
|
|
|
struct SkPoint;
|
|
|
|
struct SkRect;
|
|
|
|
class SkRRect;
|
2015-08-07 17:09:28 +00:00
|
|
|
struct SkRSXform;
|
2015-06-17 12:43:33 +00:00
|
|
|
class SkTextBlob;
|
2015-05-26 18:38:03 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* A helper object to orchestrate draws
|
|
|
|
*/
|
|
|
|
class SK_API GrDrawContext : public SkRefCnt {
|
|
|
|
public:
|
2015-06-17 12:43:33 +00:00
|
|
|
~GrDrawContext() override;
|
|
|
|
|
2016-02-16 15:34:17 +00:00
|
|
|
bool copySurface(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dstPoint);
|
2015-05-26 18:38:03 +00:00
|
|
|
|
2015-06-17 12:43:33 +00:00
|
|
|
// TODO: it is odd that we need both the SkPaint in the following 3 methods.
|
|
|
|
// We should extract the text parameters from SkPaint and pass them separately
|
2016-05-10 16:14:17 +00:00
|
|
|
// akin to GrStyle (GrTextInfo?)
|
2016-02-16 18:36:53 +00:00
|
|
|
virtual void drawText(const GrClip&, const GrPaint&, const SkPaint&,
|
|
|
|
const SkMatrix& viewMatrix, const char text[], size_t byteLength,
|
|
|
|
SkScalar x, SkScalar y, const SkIRect& clipBounds);
|
|
|
|
virtual void drawPosText(const GrClip&, const GrPaint&, const SkPaint&,
|
|
|
|
const SkMatrix& viewMatrix, const char text[], size_t byteLength,
|
|
|
|
const SkScalar pos[], int scalarsPerPosition,
|
|
|
|
const SkPoint& offset, const SkIRect& clipBounds);
|
|
|
|
virtual void drawTextBlob(const GrClip&, const SkPaint&,
|
|
|
|
const SkMatrix& viewMatrix, const SkTextBlob*,
|
|
|
|
SkScalar x, SkScalar y,
|
|
|
|
SkDrawFilter*, const SkIRect& clipBounds);
|
2015-05-26 18:38:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Provides a perfomance hint that the render target's contents are allowed
|
|
|
|
* to become undefined.
|
|
|
|
*/
|
2015-10-15 15:01:48 +00:00
|
|
|
void discard();
|
2015-05-26 18:38:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Clear the entire or rect of the render target, ignoring any clips.
|
|
|
|
* @param rect the rect to clear or the whole thing if rect is NULL.
|
|
|
|
* @param color the color to clear to.
|
|
|
|
* @param canIgnoreRect allows partial clears to be converted to whole
|
|
|
|
* clears on platforms for which that is cheap
|
|
|
|
*/
|
2015-10-15 15:01:48 +00:00
|
|
|
void clear(const SkIRect* rect, GrColor color, bool canIgnoreRect);
|
2015-05-26 18:38:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Draw everywhere (respecting the clip) with the paint.
|
|
|
|
*/
|
2015-10-15 15:01:48 +00:00
|
|
|
void drawPaint(const GrClip&, const GrPaint&, const SkMatrix& viewMatrix);
|
2015-05-26 18:38:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Draw the rect using a paint.
|
|
|
|
* @param paint describes how to color pixels.
|
|
|
|
* @param viewMatrix transformation matrix
|
2016-05-10 16:14:17 +00:00
|
|
|
* @param style The style to apply. Null means fill. Currently path effects are not
|
|
|
|
* allowed.
|
2015-05-26 18:38:03 +00:00
|
|
|
* The rects coords are used to access the paint (through texture matrix)
|
|
|
|
*/
|
2015-10-15 15:01:48 +00:00
|
|
|
void drawRect(const GrClip&,
|
2015-05-26 18:38:03 +00:00
|
|
|
const GrPaint& paint,
|
|
|
|
const SkMatrix& viewMatrix,
|
|
|
|
const SkRect&,
|
2016-05-10 16:14:17 +00:00
|
|
|
const GrStyle* style = nullptr);
|
2015-05-26 18:38:03 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-05 18:41:43 +00:00
|
|
|
* Maps a rectangle of shader coordinates to a rectangle and fills that rectangle.
|
2015-05-26 18:38:03 +00:00
|
|
|
*
|
|
|
|
* @param paint describes how to color pixels.
|
|
|
|
* @param viewMatrix transformation matrix which applies to rectToDraw
|
|
|
|
* @param rectToDraw the rectangle to draw
|
|
|
|
* @param localRect the rectangle of shader coordinates applied to rectToDraw
|
|
|
|
*/
|
2015-11-05 18:41:43 +00:00
|
|
|
void fillRectToRect(const GrClip&,
|
|
|
|
const GrPaint& paint,
|
|
|
|
const SkMatrix& viewMatrix,
|
|
|
|
const SkRect& rectToDraw,
|
|
|
|
const SkRect& localRect);
|
2015-05-26 18:38:03 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-05 18:41:43 +00:00
|
|
|
* Fills a rect with a paint and a localMatrix.
|
2015-05-26 18:38:03 +00:00
|
|
|
*/
|
2015-11-05 18:41:43 +00:00
|
|
|
void fillRectWithLocalMatrix(const GrClip& clip,
|
|
|
|
const GrPaint& paint,
|
|
|
|
const SkMatrix& viewMatrix,
|
|
|
|
const SkRect& rect,
|
|
|
|
const SkMatrix& localMatrix);
|
2015-05-26 18:38:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Draw a roundrect using a paint.
|
|
|
|
*
|
|
|
|
* @param paint describes how to color pixels.
|
|
|
|
* @param viewMatrix transformation matrix
|
|
|
|
* @param rrect the roundrect to draw
|
2016-05-10 16:14:17 +00:00
|
|
|
* @param style style to apply to the rrect. Currently path effects are not allowed.
|
2015-05-26 18:38:03 +00:00
|
|
|
*/
|
2015-10-15 15:01:48 +00:00
|
|
|
void drawRRect(const GrClip&,
|
2015-05-26 18:38:03 +00:00
|
|
|
const GrPaint&,
|
|
|
|
const SkMatrix& viewMatrix,
|
|
|
|
const SkRRect& rrect,
|
2016-05-10 16:14:17 +00:00
|
|
|
const GrStyle& style);
|
2015-05-26 18:38:03 +00:00
|
|
|
|
2016-02-29 21:50:40 +00:00
|
|
|
/**
|
|
|
|
* Shortcut for drawing an SkPath consisting of nested rrects using a paint.
|
|
|
|
* Does not support stroking. The result is undefined if outer does not contain
|
|
|
|
* inner.
|
|
|
|
*
|
|
|
|
* @param paint describes how to color pixels.
|
|
|
|
* @param viewMatrix transformation matrix
|
|
|
|
* @param outer the outer roundrect
|
|
|
|
* @param inner the inner roundrect
|
|
|
|
*/
|
|
|
|
void drawDRRect(const GrClip&,
|
|
|
|
const GrPaint&,
|
|
|
|
const SkMatrix& viewMatrix,
|
|
|
|
const SkRRect& outer,
|
|
|
|
const SkRRect& inner);
|
|
|
|
|
2015-05-26 18:38:03 +00:00
|
|
|
/**
|
|
|
|
* Draws a path.
|
|
|
|
*
|
|
|
|
* @param paint describes how to color pixels.
|
|
|
|
* @param viewMatrix transformation matrix
|
|
|
|
* @param path the path to draw
|
2016-05-10 16:14:17 +00:00
|
|
|
* @param style style to apply to the path.
|
2015-05-26 18:38:03 +00:00
|
|
|
*/
|
2015-10-15 15:01:48 +00:00
|
|
|
void drawPath(const GrClip&,
|
2015-05-26 18:38:03 +00:00
|
|
|
const GrPaint&,
|
|
|
|
const SkMatrix& viewMatrix,
|
|
|
|
const SkPath&,
|
2016-05-10 16:14:17 +00:00
|
|
|
const GrStyle& style);
|
2015-05-26 18:38:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Draws vertices with a paint.
|
|
|
|
*
|
|
|
|
* @param paint describes how to color pixels.
|
|
|
|
* @param viewMatrix transformation matrix
|
|
|
|
* @param primitiveType primitives type to draw.
|
|
|
|
* @param vertexCount number of vertices.
|
|
|
|
* @param positions array of vertex positions, required.
|
|
|
|
* @param texCoords optional array of texture coordinates used
|
|
|
|
* to access the paint.
|
|
|
|
* @param colors optional array of per-vertex colors, supercedes
|
|
|
|
* the paint's color field.
|
|
|
|
* @param indices optional array of indices. If NULL vertices
|
|
|
|
* are drawn non-indexed.
|
|
|
|
* @param indexCount if indices is non-null then this is the
|
|
|
|
* number of indices.
|
|
|
|
*/
|
2015-10-15 15:01:48 +00:00
|
|
|
void drawVertices(const GrClip&,
|
2015-05-26 18:38:03 +00:00
|
|
|
const GrPaint& paint,
|
|
|
|
const SkMatrix& viewMatrix,
|
|
|
|
GrPrimitiveType primitiveType,
|
|
|
|
int vertexCount,
|
|
|
|
const SkPoint positions[],
|
|
|
|
const SkPoint texs[],
|
|
|
|
const GrColor colors[],
|
|
|
|
const uint16_t indices[],
|
|
|
|
int indexCount);
|
|
|
|
|
2015-08-07 17:09:28 +00:00
|
|
|
/**
|
|
|
|
* Draws textured sprites from an atlas with a paint.
|
|
|
|
*
|
|
|
|
* @param paint describes how to color pixels.
|
|
|
|
* @param viewMatrix transformation matrix
|
|
|
|
* @param spriteCount number of sprites.
|
|
|
|
* @param xform array of compressed transformation data, required.
|
|
|
|
* @param texRect array of texture rectangles used to access the paint.
|
|
|
|
* @param colors optional array of per-sprite colors, supercedes
|
|
|
|
* the paint's color field.
|
|
|
|
*/
|
2015-10-15 15:01:48 +00:00
|
|
|
void drawAtlas(const GrClip&,
|
2015-08-07 17:09:28 +00:00
|
|
|
const GrPaint& paint,
|
|
|
|
const SkMatrix& viewMatrix,
|
|
|
|
int spriteCount,
|
|
|
|
const SkRSXform xform[],
|
|
|
|
const SkRect texRect[],
|
|
|
|
const SkColor colors[]);
|
|
|
|
|
2015-05-26 18:38:03 +00:00
|
|
|
/**
|
|
|
|
* Draws an oval.
|
|
|
|
*
|
|
|
|
* @param paint describes how to color pixels.
|
|
|
|
* @param viewMatrix transformation matrix
|
|
|
|
* @param oval the bounding rect of the oval.
|
2016-05-10 16:14:17 +00:00
|
|
|
* @param style style to apply to the oval. Currently path effects are not allowed.
|
2015-05-26 18:38:03 +00:00
|
|
|
*/
|
2015-10-15 15:01:48 +00:00
|
|
|
void drawOval(const GrClip&,
|
2015-05-26 18:38:03 +00:00
|
|
|
const GrPaint& paint,
|
|
|
|
const SkMatrix& viewMatrix,
|
|
|
|
const SkRect& oval,
|
2016-05-10 16:14:17 +00:00
|
|
|
const GrStyle& style);
|
2015-05-26 18:38:03 +00:00
|
|
|
|
2015-11-18 21:28:51 +00:00
|
|
|
/**
|
|
|
|
* Draw the image stretched differentially to fit into dst.
|
|
|
|
* center is a rect within the image, and logically divides the image
|
|
|
|
* into 9 sections (3x3). For example, if the middle pixel of a [5x5]
|
|
|
|
* image is the "center", then the center-rect should be [2, 2, 3, 3].
|
|
|
|
*
|
|
|
|
* If the dst is >= the image size, then...
|
|
|
|
* - The 4 corners are not stretched at all.
|
|
|
|
* - The sides are stretched in only one axis.
|
|
|
|
* - The center is stretched in both axes.
|
|
|
|
* Else, for each axis where dst < image,
|
|
|
|
* - The corners shrink proportionally
|
|
|
|
* - The sides (along the shrink axis) and center are not drawn
|
|
|
|
*/
|
|
|
|
void drawImageNine(const GrClip&,
|
|
|
|
const GrPaint& paint,
|
|
|
|
const SkMatrix& viewMatrix,
|
|
|
|
int imageWidth,
|
|
|
|
int imageHeight,
|
|
|
|
const SkIRect& center,
|
|
|
|
const SkRect& dst);
|
2015-05-26 18:38:03 +00:00
|
|
|
|
2016-07-26 14:41:00 +00:00
|
|
|
/**
|
|
|
|
* After this returns any pending surface IO will be issued to the backend 3D API and
|
|
|
|
* if the surface has MSAA it will be resolved.
|
|
|
|
*/
|
|
|
|
void prepareForExternalIO();
|
|
|
|
|
2016-06-03 17:59:20 +00:00
|
|
|
bool isStencilBufferMultisampled() const {
|
|
|
|
return fRenderTarget->isStencilBufferMultisampled();
|
|
|
|
}
|
2016-06-06 13:16:20 +00:00
|
|
|
bool isUnifiedMultisampled() const { return fRenderTarget->isUnifiedMultisampled(); }
|
2016-05-19 21:01:05 +00:00
|
|
|
bool hasMixedSamples() const { return fRenderTarget->hasMixedSamples(); }
|
|
|
|
|
2016-06-08 17:08:43 +00:00
|
|
|
bool mustUseHWAA(const GrPaint& paint) const {
|
2016-07-22 14:10:19 +00:00
|
|
|
return paint.isAntiAlias() && fRenderTarget->isUnifiedMultisampled();
|
2016-06-08 17:08:43 +00:00
|
|
|
}
|
|
|
|
|
2016-05-13 18:20:46 +00:00
|
|
|
const GrSurfaceDesc& desc() const { return fRenderTarget->desc(); }
|
2015-12-01 20:51:26 +00:00
|
|
|
int width() const { return fRenderTarget->width(); }
|
|
|
|
int height() const { return fRenderTarget->height(); }
|
2016-05-17 16:57:46 +00:00
|
|
|
GrPixelConfig config() const { return fRenderTarget->config(); }
|
2015-12-01 20:51:26 +00:00
|
|
|
int numColorSamples() const { return fRenderTarget->numColorSamples(); }
|
2016-07-26 17:21:54 +00:00
|
|
|
bool isGammaCorrect() const { return SkToBool(fColorSpace.get()); }
|
2016-07-25 19:31:51 +00:00
|
|
|
SkSourceGammaTreatment sourceGammaTreatment() const {
|
|
|
|
return this->isGammaCorrect() ? SkSourceGammaTreatment::kRespect
|
|
|
|
: SkSourceGammaTreatment::kIgnore;
|
|
|
|
}
|
2016-05-17 16:57:46 +00:00
|
|
|
const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; }
|
2016-07-21 20:28:36 +00:00
|
|
|
SkColorSpace* getColorSpace() const { return fColorSpace.get(); }
|
2015-12-01 20:51:26 +00:00
|
|
|
|
2016-05-16 16:14:53 +00:00
|
|
|
bool wasAbandoned() const;
|
|
|
|
|
2016-04-27 17:47:51 +00:00
|
|
|
GrRenderTarget* accessRenderTarget() { return fRenderTarget.get(); }
|
|
|
|
|
|
|
|
sk_sp<GrRenderTarget> renderTarget() { return fRenderTarget; }
|
|
|
|
|
|
|
|
sk_sp<GrTexture> asTexture() { return sk_ref_sp(fRenderTarget->asTexture()); }
|
2015-12-04 14:58:16 +00:00
|
|
|
|
2016-03-02 17:26:36 +00:00
|
|
|
// Provides access to functions that aren't part of the public API.
|
|
|
|
GrDrawContextPriv drawContextPriv();
|
|
|
|
const GrDrawContextPriv drawContextPriv() const;
|
2016-01-13 15:47:38 +00:00
|
|
|
|
2016-06-03 17:59:20 +00:00
|
|
|
GrAuditTrail* auditTrail() { return fAuditTrail; }
|
|
|
|
|
2016-02-16 18:36:53 +00:00
|
|
|
protected:
|
2016-07-21 20:28:36 +00:00
|
|
|
GrDrawContext(GrContext*, GrDrawingManager*, sk_sp<GrRenderTarget>, sk_sp<SkColorSpace>,
|
2016-02-16 18:36:53 +00:00
|
|
|
const SkSurfaceProps* surfaceProps, GrAuditTrail*, GrSingleOwner*);
|
2015-05-26 18:38:03 +00:00
|
|
|
|
2016-02-16 18:36:53 +00:00
|
|
|
GrDrawingManager* drawingManager() { return fDrawingManager; }
|
2016-05-17 16:57:46 +00:00
|
|
|
|
2016-02-16 18:36:53 +00:00
|
|
|
SkDEBUGCODE(GrSingleOwner* singleOwner() { return fSingleOwner; })
|
2015-10-15 15:01:48 +00:00
|
|
|
SkDEBUGCODE(void validate() const;)
|
2015-05-26 18:38:03 +00:00
|
|
|
|
2016-02-16 18:36:53 +00:00
|
|
|
private:
|
|
|
|
friend class GrAtlasTextBlob; // for access to drawBatch
|
2016-05-12 18:52:02 +00:00
|
|
|
friend class GrStencilAndCoverTextContext; // for access to drawBatch
|
2016-06-06 13:16:20 +00:00
|
|
|
|
2016-02-16 18:36:53 +00:00
|
|
|
friend class GrDrawingManager; // for ctor
|
2016-03-02 17:26:36 +00:00
|
|
|
friend class GrDrawContextPriv;
|
2016-05-20 18:14:33 +00:00
|
|
|
friend class GrTestTarget; // for access to getDrawTarget
|
2016-06-03 17:59:20 +00:00
|
|
|
friend class GrSWMaskHelper; // for access to drawBatch
|
|
|
|
friend class GrClipMaskManager; // for access to drawBatch
|
|
|
|
|
|
|
|
// All the path renderers currently make their own batches
|
|
|
|
friend class GrSoftwarePathRenderer; // for access to drawBatch
|
|
|
|
friend class GrAAConvexPathRenderer; // for access to drawBatch
|
|
|
|
friend class GrDashLinePathRenderer; // for access to drawBatch
|
|
|
|
friend class GrAAHairLinePathRenderer; // for access to drawBatch
|
|
|
|
friend class GrAALinearizingConvexPathRenderer; // for access to drawBatch
|
|
|
|
friend class GrAADistanceFieldPathRenderer; // for access to drawBatch
|
|
|
|
friend class GrDefaultPathRenderer; // for access to drawBatch
|
|
|
|
friend class GrPLSPathRenderer; // for access to drawBatch
|
|
|
|
friend class GrMSAAPathRenderer; // for access to drawBatch
|
|
|
|
friend class GrStencilAndCoverPathRenderer; // for access to drawBatch
|
|
|
|
friend class GrTessellatingPathRenderer; // for access to drawBatch
|
2015-05-26 18:38:03 +00:00
|
|
|
|
2016-02-29 21:50:40 +00:00
|
|
|
bool drawFilledDRRect(const GrClip& clip,
|
|
|
|
const GrPaint& paint,
|
|
|
|
const SkMatrix& viewMatrix,
|
|
|
|
const SkRRect& origOuter,
|
|
|
|
const SkRRect& origInner);
|
|
|
|
|
2016-07-08 21:43:03 +00:00
|
|
|
bool drawFilledRect(const GrClip& clip,
|
|
|
|
const GrPaint& paint,
|
|
|
|
const SkMatrix& viewMatrix,
|
|
|
|
const SkRect& rect,
|
|
|
|
const GrUserStencilSettings* ss);
|
|
|
|
|
|
|
|
void drawNonAAFilledRect(const GrClip&,
|
|
|
|
const GrPaint&,
|
|
|
|
const SkMatrix& viewMatrix,
|
|
|
|
const SkRect& rect,
|
|
|
|
const SkRect* localRect,
|
|
|
|
const SkMatrix* localMatrix,
|
|
|
|
const GrUserStencilSettings* ss);
|
2016-03-02 17:26:36 +00:00
|
|
|
|
2016-03-01 20:22:49 +00:00
|
|
|
void internalDrawPath(const GrClip& clip,
|
|
|
|
const GrPaint& paint,
|
2015-05-26 18:38:03 +00:00
|
|
|
const SkMatrix& viewMatrix,
|
2016-03-01 20:22:49 +00:00
|
|
|
const SkPath& path,
|
2016-05-10 16:14:17 +00:00
|
|
|
const GrStyle& style);
|
2015-05-26 18:38:03 +00:00
|
|
|
|
2015-06-17 12:43:33 +00:00
|
|
|
// This entry point allows the GrTextContext-derived classes to add their batches to
|
|
|
|
// the drawTarget.
|
2016-07-22 14:10:19 +00:00
|
|
|
void drawBatch(const GrPipelineBuilder& pipelineBuilder, const GrClip&, GrDrawBatch* batch);
|
2015-06-17 12:43:33 +00:00
|
|
|
|
2015-10-16 16:07:06 +00:00
|
|
|
GrDrawTarget* getDrawTarget();
|
|
|
|
|
2016-02-17 13:40:00 +00:00
|
|
|
GrDrawingManager* fDrawingManager;
|
2016-04-27 17:47:51 +00:00
|
|
|
sk_sp<GrRenderTarget> fRenderTarget;
|
2015-10-16 16:07:06 +00:00
|
|
|
|
|
|
|
// In MDB-mode the drawTarget can be closed by some other drawContext that has picked
|
|
|
|
// it up. For this reason, the drawTarget should only ever be accessed via 'getDrawTarget'.
|
2016-02-17 13:40:00 +00:00
|
|
|
GrDrawTarget* fDrawTarget;
|
|
|
|
SkAutoTDelete<GrAtlasTextContext> fAtlasTextContext;
|
|
|
|
GrContext* fContext;
|
Begin instanced rendering for simple shapes
Adds a module that performs instanced rendering and starts using it
for a select subset of draws on Mac GL platforms. The instance
processor can currently handle rects, ovals, round rects, and double
round rects. It can generalize shapes as round rects in order to
improve batching. The instance processor also employs new drawing
algorithms, irrespective of instanced rendering, that improve GPU-side
performance (e.g. sample mask, different triangle layouts, etc.).
This change only scratches the surface of instanced rendering. The
majority of draws still only have one instance. Future work may
include:
* Passing coord transforms through the texel buffer.
* Sending FP uniforms through instanced vertex attribs.
* Using instanced rendering for more draws (stencil writes,
drawAtlas, etc.).
* Adding more shapes to the instance processor’s repertoire.
* Batching draws that have mismatched scissors (analyzing draw
bounds, inserting clip planes, etc.).
* Bindless textures.
* Uber shaders.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2066993003
Committed: https://skia.googlesource.com/skia/+/42eafa4bc00354b132ad114d22ed6b95d8849891
Review-Url: https://codereview.chromium.org/2066993003
2016-07-07 15:49:11 +00:00
|
|
|
GrInstancedPipelineInfo fInstancedPipelineInfo;
|
2015-06-17 12:43:33 +00:00
|
|
|
|
2016-07-21 20:28:36 +00:00
|
|
|
sk_sp<SkColorSpace> fColorSpace;
|
2016-02-17 13:40:00 +00:00
|
|
|
SkSurfaceProps fSurfaceProps;
|
|
|
|
GrAuditTrail* fAuditTrail;
|
2016-01-06 16:26:09 +00:00
|
|
|
|
|
|
|
// In debug builds we guard against improper thread handling
|
2016-01-11 16:27:48 +00:00
|
|
|
SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;)
|
2015-05-26 18:38:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|