Index: src/gpu/GrOptDrawState.h |
diff --git a/src/gpu/GrOptDrawState.h b/src/gpu/GrOptDrawState.h |
index 00e368c66a570c00353a1253977706b3bfcfe8b2..81c35100932912dcd2202cae8b1fc736bf2d7f7d 100644 |
--- a/src/gpu/GrOptDrawState.h |
+++ b/src/gpu/GrOptDrawState.h |
@@ -17,9 +17,9 @@ |
#include "SkMatrix.h" |
#include "SkRefCnt.h" |
+class GrBatch; |
class GrDeviceCoordTexture; |
class GrDrawState; |
-class GrPathProcessor; |
/** |
* Class that holds an optimized version of a GrDrawState. It is meant to be an immutable class, |
@@ -29,15 +29,22 @@ class GrOptDrawState { |
public: |
SK_DECLARE_INST_COUNT(GrOptDrawState) |
+ // TODO get rid of this version of the constructor when we use batch everywhere |
GrOptDrawState(const GrDrawState& drawState, const GrPrimitiveProcessor*, |
const GrDrawTargetCaps&, const GrScissorState&, |
const GrDeviceCoordTexture* dstCopy, GrGpu::DrawType); |
+ GrOptDrawState(GrBatch*, |
+ const GrDrawState& drawState, |
+ const GrDrawTargetCaps&, const GrScissorState&, |
+ const GrDeviceCoordTexture* dstCopy, GrGpu::DrawType); |
+ |
+ |
/* |
* Returns true if it is possible to combine the two GrOptDrawStates and it will update 'this' |
* to subsume 'that''s draw. |
*/ |
- bool combineIfPossible(const GrOptDrawState& that); |
+ bool combineIfPossible(GrOptDrawState& that); |
/// @} |
@@ -136,11 +143,35 @@ public: |
const GrDeviceCoordTexture* getDstCopy() const { return fDstCopy.texture() ? &fDstCopy : NULL; } |
// Finalize *MUST* be called before programDesc() |
+ // TODO we need to move the descriptor out of GrOptDrawState. The program Descriptor should be |
+ // a combination of OptState descriptor(which can be created when optstate is constructed) |
+ // and GrGeometryProcessor key. |
void finalize(GrGpu*); |
const GrProgramDesc& programDesc() const { SkASSERT(fFinalized); return fDesc; } |
+ void flush(GrGpu*, GrVertexBufferAllocPool*, GrIndexBufferAllocPool*); |
+ |
+ // TODO this is unfortunate, but GrBatch needs to initialize the batch tracker on the GP |
+ // NOBODY ELSE should be using this. Once we use GrBatch everywhere we can remove this |
+ GrBatchTracker* batchTracker() { return &fBatchTracker; } |
+ |
+ // TODO this goes away when I pull primitive processor off optstate |
+ void setPrimitiveProcessor(const GrPrimitiveProcessor* primProc) { |
+ fFinalized = false; |
+ fPrimitiveProcessor.reset(primProc); |
+ } |
+ |
private: |
+ // TODO we can have one constructor once GrBatch is complete |
+ void internalConstructor(GrGeometryProcessor::InitBT*, |
+ const GrDrawState&, |
+ const GrProcOptInfo& colorPOI, |
+ const GrProcOptInfo& coveragePOI, |
+ const GrDrawTargetCaps&, |
+ const GrScissorState&, |
+ const GrDeviceCoordTexture* dstCopy); |
+ |
/** |
* Alter the program desc and inputs (attribs and processors) based on the blend optimization. |
*/ |