aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrOptDrawState.h
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2014-12-03 13:57:36 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-03 13:57:37 -0800
commit829e1b80b1020b17f2078020c990e079b70c077c (patch)
tree92dbe51acc4dcf5e7ebceea1edd0880cfd06fe1f /src/gpu/GrOptDrawState.h
parente5750729e4b5e9434d8449e4b63dd7110248e694 (diff)
move program descriptor generation to flush
Diffstat (limited to 'src/gpu/GrOptDrawState.h')
-rw-r--r--src/gpu/GrOptDrawState.h35
1 files changed, 12 insertions, 23 deletions
diff --git a/src/gpu/GrOptDrawState.h b/src/gpu/GrOptDrawState.h
index ac7ec16402..25a3a49995 100644
--- a/src/gpu/GrOptDrawState.h
+++ b/src/gpu/GrOptDrawState.h
@@ -30,7 +30,7 @@ public:
typedef GrClipMaskManager::ScissorState ScissorState;
- GrOptDrawState(const GrDrawState& drawState, GrGpu*, const ScissorState&,
+ GrOptDrawState(const GrDrawState& drawState, const GrDrawTargetCaps&, const ScissorState&,
const GrDeviceCoordTexture* dstCopy, GrGpu::DrawType);
bool operator== (const GrOptDrawState& that) const;
@@ -180,33 +180,20 @@ public:
///////////////////////////////////////////////////////////////////////////
- const GrDeviceCoordTexture* getDstCopy() const { return fDstCopy.texture() ? &fDstCopy : NULL; }
+ GrGpu::DrawType drawType() const { return fDrawType; }
- const GrProgramDesc& programDesc() const { return fDesc; }
+ const GrDeviceCoordTexture* getDstCopy() const { return fDstCopy.texture() ? &fDstCopy : NULL; }
-private:
- /**
- * Loops through all the color stage effects to check if the stage will ignore color input or
- * always output a constant color. In the ignore color input case we can ignore all previous
- * stages. In the constant color case, we can ignore all previous stages and
- * the current one and set the state color to the constant color.
- */
- void computeEffectiveColorStages(const GrDrawState& ds, GrProgramDesc::DescInfo*,
- int* firstColorStageIdx, uint8_t* fixFunctionVAToRemove);
+ // Finalize *MUST* be called before programDesc()
+ void finalize(GrGpu*);
- /**
- * Loops through all the coverage stage effects to check if the stage will ignore color input.
- * If a coverage stage will ignore input, then we can ignore all coverage stages before it. We
- * loop to determine the first effective coverage stage.
- */
- void computeEffectiveCoverageStages(const GrDrawState& ds, GrProgramDesc::DescInfo* descInfo,
- int* firstCoverageStageIdx);
+ const GrProgramDesc& programDesc() const { SkASSERT(fFinalized); return fDesc; }
+private:
/**
* Alter the program desc and inputs (attribs and processors) based on the blend optimization.
*/
void adjustProgramForBlendOpt(const GrDrawState& ds, GrDrawState::BlendOpt,
- GrProgramDesc::DescInfo*,
int* firstColorStageIdx, int* firstCoverageStageIdx);
/**
@@ -214,15 +201,14 @@ private:
* shaders they require.
*/
void getStageStats(const GrDrawState& ds, int firstColorStageIdx, int firstCoverageStageIdx,
- bool hasLocalCoords, GrProgramDesc::DescInfo*);
+ bool hasLocalCoords);
/**
* Calculates the primary and secondary output types of the shader. For certain output types
* the function may adjust the blend coefficients. After this function is called the src and dst
* blend coeffs will represent those used by backend API.
*/
- void setOutputStateInfo(const GrDrawState& ds, GrDrawState::BlendOpt, const GrDrawTargetCaps&,
- GrProgramDesc::DescInfo*);
+ void setOutputStateInfo(const GrDrawState& ds, GrDrawState::BlendOpt, const GrDrawTargetCaps&);
enum Flags {
kDither_Flag = 0x1,
@@ -249,6 +235,9 @@ private:
ProgramGeometryProcessor fGeometryProcessor;
ProgramXferProcessor fXferProcessor;
FragmentStageArray fFragmentStages;
+ GrGpu::DrawType fDrawType;
+ GrProgramDesc::DescInfo fDescInfo;
+ bool fFinalized;
// This function is equivalent to the offset into fFragmentStages where coverage stages begin.
int fNumColorStages;