| Index: src/gpu/GrPipelineBuilder.h
|
| diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrPipelineBuilder.h
|
| similarity index 85%
|
| rename from src/gpu/GrDrawState.h
|
| rename to src/gpu/GrPipelineBuilder.h
|
| index 45fc574bde78c8b5a511d8223f5133f16efe9b6d..9579024d6a38453e336f78acbdc6322c79111a41 100644
|
| --- a/src/gpu/GrDrawState.h
|
| +++ b/src/gpu/GrPipelineBuilder.h
|
| @@ -1,12 +1,12 @@
|
| /*
|
| - * Copyright 2011 Google Inc.
|
| + * 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 GrDrawState_DEFINED
|
| -#define GrDrawState_DEFINED
|
| +#ifndef GrPipelineBuilder_DEFINED
|
| +#define GrPipelineBuilder_DEFINED
|
|
|
|
|
| #include "GrBlend.h"
|
| @@ -28,24 +28,22 @@ class GrDrawTargetCaps;
|
| class GrPaint;
|
| class GrTexture;
|
|
|
| -class GrDrawState {
|
| +class GrPipelineBuilder {
|
| public:
|
| - GrDrawState();
|
| - /**
|
| - * Copies another draw state.
|
| - **/
|
| - GrDrawState(const GrDrawState& state) {
|
| + GrPipelineBuilder();
|
| +
|
| + GrPipelineBuilder(const GrPipelineBuilder& pipelineBuilder) {
|
| SkDEBUGCODE(fBlockEffectRemovalCnt = 0;)
|
| - *this = state;
|
| + *this = pipelineBuilder;
|
| }
|
|
|
| - virtual ~GrDrawState();
|
| + virtual ~GrPipelineBuilder();
|
|
|
| /**
|
| - * Initializes the GrDrawState based on a GrPaint, view matrix and render target. Note that
|
| - * GrDrawState encompasses more than GrPaint. Aspects of GrDrawState that have no GrPaint
|
| - * equivalents are set to default values with the exception of vertex attribute state which
|
| - * is unmodified by this function and clipping which will be enabled.
|
| + * Initializes the GrPipelineBuilder based on a GrPaint, view matrix and render target. Note
|
| + * that GrPipelineBuilder encompasses more than GrPaint. Aspects of GrPipelineBuilder that have
|
| + * no GrPaint equivalents are set to default values with the exception of vertex attribute state
|
| + * which is unmodified by this function and clipping which will be enabled.
|
| */
|
| void setFromPaint(const GrPaint&, GrRenderTarget*);
|
|
|
| @@ -56,7 +54,7 @@ public:
|
| * it may or may not be possible to correctly blend with fractional pixel coverage generated by
|
| * the fragment shader.
|
| *
|
| - * This function considers the current draw state and the draw target's capabilities to
|
| + * This function considers the current GrPipelineBuilder and the draw target's capabilities to
|
| * determine whether coverage can be handled correctly. This function assumes that the caller
|
| * intends to specify fractional pixel coverage via a primitive processor but may not have
|
| * specified it yet.
|
| @@ -171,30 +169,23 @@ public:
|
| }
|
|
|
| /**
|
| - * When this object is destroyed it will remove any color/coverage effects from the draw state
|
| - * that were added after its constructor.
|
| - *
|
| - * This class has strange behavior around geometry processor. If there is a GP on the draw state
|
| - * it will assert that the GP is not modified until after the destructor of the ARE. If the
|
| - * draw state has a NULL GP when the ARE is constructed then it will reset it to null in the
|
| - * destructor.
|
| + * When this object is destroyed it will remove any color/coverage effects from the pipeline
|
| + * builder that were added after its constructor.
|
| *
|
| - * TODO: We'd prefer for the ARE to just save and restore the GP. However, this would add
|
| - * significant complexity to the multi-ref architecture for deferred drawing. Once GrDrawState
|
| - * and GrOptDrawState are fully separated then GrDrawState will never be in the deferred
|
| - * execution state and GrOptDrawState always will be (and will be immutable and therefore
|
| - * unable to have an ARE). At this point we can restore sanity and have the ARE save and restore
|
| - * the GP.
|
| + * This class has strange behavior around geometry processor. If there is a GP on the
|
| + * GrPipelineBuilder it will assert that the GP is not modified until after the destructor of
|
| + * the ARE. If the GrPipelineBuilder has a NULL GP when the ARE is constructed then it will reset
|
| + * it to null in the destructor.
|
| */
|
| class AutoRestoreEffects : public ::SkNoncopyable {
|
| public:
|
| AutoRestoreEffects()
|
| - : fDrawState(NULL)
|
| + : fPipelineBuilder(NULL)
|
| , fColorEffectCnt(0)
|
| , fCoverageEffectCnt(0) {}
|
|
|
| - AutoRestoreEffects(GrDrawState* ds)
|
| - : fDrawState(NULL)
|
| + AutoRestoreEffects(GrPipelineBuilder* ds)
|
| + : fPipelineBuilder(NULL)
|
| , fColorEffectCnt(0)
|
| , fCoverageEffectCnt(0) {
|
| this->set(ds);
|
| @@ -202,12 +193,12 @@ public:
|
|
|
| ~AutoRestoreEffects() { this->set(NULL); }
|
|
|
| - void set(GrDrawState* ds);
|
| + void set(GrPipelineBuilder* ds);
|
|
|
| - bool isSet() const { return SkToBool(fDrawState); }
|
| + bool isSet() const { return SkToBool(fPipelineBuilder); }
|
|
|
| private:
|
| - GrDrawState* fDrawState;
|
| + GrPipelineBuilder* fPipelineBuilder;
|
| int fColorEffectCnt;
|
| int fCoverageEffectCnt;
|
| };
|
| @@ -219,27 +210,27 @@ public:
|
| */
|
| class AutoRestoreStencil : public ::SkNoncopyable {
|
| public:
|
| - AutoRestoreStencil() : fDrawState(NULL) {}
|
| + AutoRestoreStencil() : fPipelineBuilder(NULL) {}
|
|
|
| - AutoRestoreStencil(GrDrawState* ds) : fDrawState(NULL) { this->set(ds); }
|
| + AutoRestoreStencil(GrPipelineBuilder* ds) : fPipelineBuilder(NULL) { this->set(ds); }
|
|
|
| ~AutoRestoreStencil() { this->set(NULL); }
|
|
|
| - void set(GrDrawState* ds) {
|
| - if (fDrawState) {
|
| - fDrawState->setStencil(fStencilSettings);
|
| + void set(GrPipelineBuilder* ds) {
|
| + if (fPipelineBuilder) {
|
| + fPipelineBuilder->setStencil(fStencilSettings);
|
| }
|
| - fDrawState = ds;
|
| + fPipelineBuilder = ds;
|
| if (ds) {
|
| fStencilSettings = ds->getStencil();
|
| }
|
| }
|
|
|
| - bool isSet() const { return SkToBool(fDrawState); }
|
| + bool isSet() const { return SkToBool(fPipelineBuilder); }
|
|
|
| private:
|
| - GrDrawState* fDrawState;
|
| - GrStencilSettings fStencilSettings;
|
| + GrPipelineBuilder* fPipelineBuilder;
|
| + GrStencilSettings fStencilSettings;
|
| };
|
|
|
| /// @}
|
| @@ -397,7 +388,7 @@ public:
|
|
|
| ///////////////////////////////////////////////////////////////////////////
|
|
|
| - GrDrawState& operator= (const GrDrawState& that);
|
| + GrPipelineBuilder& operator= (const GrPipelineBuilder& that);
|
|
|
| private:
|
| const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const {
|
| @@ -457,7 +448,7 @@ private:
|
| mutable const GrPrimitiveProcessor* fColorPrimProc;
|
| mutable const GrPrimitiveProcessor* fCoveragePrimProc;
|
|
|
| - friend class GrOptDrawState;
|
| + friend class GrPipeline;
|
| };
|
|
|
| #endif
|
|
|