Remove non-destructive playback from GrIODB.
Review URL: https://codereview.appspot.com/7057070 git-svn-id: http://skia.googlecode.com/svn/trunk@7128 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
f49b28745f
commit
55e4a2005e
@ -553,7 +553,7 @@ void GrInOrderDrawBuffer::reset() {
|
||||
this->resetDrawTracking();
|
||||
}
|
||||
|
||||
bool GrInOrderDrawBuffer::playback(GrDrawTarget* target) {
|
||||
bool GrInOrderDrawBuffer::flushTo(GrDrawTarget* target) {
|
||||
GrAssert(kReserved_GeometrySrcType != this->getGeomSrc().fVertexSrc);
|
||||
GrAssert(kReserved_GeometrySrcType != this->getGeomSrc().fIndexSrc);
|
||||
|
||||
@ -637,6 +637,7 @@ bool GrInOrderDrawBuffer::playback(GrDrawTarget* target) {
|
||||
|
||||
target->setDrawState(prevDrawState);
|
||||
prevDrawState->unref();
|
||||
this->reset();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -25,17 +25,15 @@ class GrIndexBufferAllocPool;
|
||||
class GrVertexBufferAllocPool;
|
||||
|
||||
/**
|
||||
* GrInOrderDrawBuffer is an implementation of GrDrawTarget that queues up
|
||||
* draws for eventual playback into a GrGpu. In theory one draw buffer could
|
||||
* playback into another. When index or vertex buffers are used as geometry
|
||||
* sources it is the callers the draw buffer only holds references to the
|
||||
* buffers. It is the callers responsibility to ensure that the data is still
|
||||
* valid when the draw buffer is played back into a GrGpu. Similarly, it is the
|
||||
* caller's responsibility to ensure that all referenced textures, buffers,
|
||||
* and rendertargets are associated in the GrGpu object that the buffer is
|
||||
* played back into. The buffer requires VB and IB pools to store geometry.
|
||||
* GrInOrderDrawBuffer is an implementation of GrDrawTarget that queues up draws for eventual
|
||||
* playback into a GrGpu. In theory one draw buffer could playback into another. When index or
|
||||
* vertex buffers are used as geometry sources it is the callers the draw buffer only holds
|
||||
* references to the buffers. It is the callers responsibility to ensure that the data is still
|
||||
* valid when the draw buffer is played back into a GrGpu. Similarly, it is the caller's
|
||||
* responsibility to ensure that all referenced textures, buffers, and render-targets are associated
|
||||
* in the GrGpu object that the buffer is played back into. The buffer requires VB and IB pools to
|
||||
* store geometry.
|
||||
*/
|
||||
|
||||
class GrInOrderDrawBuffer : public GrDrawTarget {
|
||||
public:
|
||||
|
||||
@ -64,52 +62,29 @@ public:
|
||||
void setQuadIndexBuffer(const GrIndexBuffer* indexBuffer);
|
||||
|
||||
/**
|
||||
* Empties the draw buffer of any queued up draws. This must not be called
|
||||
* while inside an unbalanced pushGeometrySource().
|
||||
* Empties the draw buffer of any queued up draws. This must not be called while inside an
|
||||
* unbalanced pushGeometrySource(). The current draw state and clip are preserved.
|
||||
*/
|
||||
void reset();
|
||||
|
||||
/**
|
||||
* plays the queued up draws to another target. Does not empty this buffer
|
||||
* so that it can be played back multiple times. This buffer must not have
|
||||
* an active reserved vertex or index source. Any reserved geometry on
|
||||
* the target will be finalized because it's geometry source will be pushed
|
||||
* before playback and popped afterwards.
|
||||
* This plays the queued up draws to another target. It also resets this object (i.e. flushing
|
||||
* is destructive). This buffer must not have an active reserved vertex or index source. Any
|
||||
* reserved geometry on the target will be finalized because it's geometry source will be pushed
|
||||
* before flushing and popped afterwards.
|
||||
*
|
||||
* @return false if the playback trivially drew nothing because nothing was
|
||||
* recorded.
|
||||
* @return false if the playback trivially drew nothing because nothing was recorded.
|
||||
*
|
||||
* @param target the target to receive the playback
|
||||
*/
|
||||
bool playback(GrDrawTarget* target);
|
||||
bool flushTo(GrDrawTarget* target);
|
||||
|
||||
/**
|
||||
* A convenience method to do a playback followed by a reset. All the
|
||||
* constraints and side-effects or playback() and reset apply().
|
||||
*/
|
||||
void flushTo(GrDrawTarget* target) {
|
||||
if (fFlushing) {
|
||||
// When creating SW-only clip masks, the GrClipMaskManager can
|
||||
// cause a GrContext::flush (when copying the mask results back
|
||||
// to the GPU). Without a guard this results in a recursive call
|
||||
// to this method.
|
||||
return;
|
||||
}
|
||||
|
||||
fFlushing = true;
|
||||
if (this->playback(target)) {
|
||||
this->reset();
|
||||
}
|
||||
fFlushing = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function allows the draw buffer to automatically flush itself to
|
||||
* another target. This means the buffer may internally call
|
||||
* this->flushTo(target) when it is safe to do so.
|
||||
* This function allows the draw buffer to automatically flush itself to another target. This
|
||||
* means the buffer may internally call this->flushTo(target) when it is safe to do so.
|
||||
*
|
||||
* When the auto flush target is set to NULL (as it initially is) the draw
|
||||
* buffer will never automatically flush itself.
|
||||
* When the auto flush target is set to NULL (as it initially is) the draw buffer will never
|
||||
* automatically flush itself.
|
||||
*/
|
||||
void setAutoFlushTarget(GrDrawTarget* target);
|
||||
|
||||
@ -253,7 +228,7 @@ private:
|
||||
int fMaxQuads;
|
||||
int fCurrQuad;
|
||||
|
||||
// bookkeeping to attempt to concantenate drawIndexedInstances calls
|
||||
// bookkeeping to attempt to concatenate drawIndexedInstances calls
|
||||
struct {
|
||||
int fVerticesPerInstance;
|
||||
int fIndicesPerInstance;
|
||||
|
Loading…
Reference in New Issue
Block a user