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();
|
this->resetDrawTracking();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GrInOrderDrawBuffer::playback(GrDrawTarget* target) {
|
bool GrInOrderDrawBuffer::flushTo(GrDrawTarget* target) {
|
||||||
GrAssert(kReserved_GeometrySrcType != this->getGeomSrc().fVertexSrc);
|
GrAssert(kReserved_GeometrySrcType != this->getGeomSrc().fVertexSrc);
|
||||||
GrAssert(kReserved_GeometrySrcType != this->getGeomSrc().fIndexSrc);
|
GrAssert(kReserved_GeometrySrcType != this->getGeomSrc().fIndexSrc);
|
||||||
|
|
||||||
@ -637,6 +637,7 @@ bool GrInOrderDrawBuffer::playback(GrDrawTarget* target) {
|
|||||||
|
|
||||||
target->setDrawState(prevDrawState);
|
target->setDrawState(prevDrawState);
|
||||||
prevDrawState->unref();
|
prevDrawState->unref();
|
||||||
|
this->reset();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,17 +25,15 @@ class GrIndexBufferAllocPool;
|
|||||||
class GrVertexBufferAllocPool;
|
class GrVertexBufferAllocPool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GrInOrderDrawBuffer is an implementation of GrDrawTarget that queues up
|
* GrInOrderDrawBuffer is an implementation of GrDrawTarget that queues up draws for eventual
|
||||||
* draws for eventual playback into a GrGpu. In theory one draw buffer could
|
* playback into a GrGpu. In theory one draw buffer could playback into another. When index or
|
||||||
* playback into another. When index or vertex buffers are used as geometry
|
* vertex buffers are used as geometry sources it is the callers the draw buffer only holds
|
||||||
* sources it is the callers the draw buffer only holds references to the
|
* references to the buffers. It is the callers responsibility to ensure that the data is still
|
||||||
* 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
|
||||||
* valid when the draw buffer is played back into a GrGpu. Similarly, it is the
|
* responsibility to ensure that all referenced textures, buffers, and render-targets are associated
|
||||||
* caller's responsibility to ensure that all referenced textures, buffers,
|
* in the GrGpu object that the buffer is played back into. The buffer requires VB and IB pools to
|
||||||
* and rendertargets are associated in the GrGpu object that the buffer is
|
* store geometry.
|
||||||
* played back into. The buffer requires VB and IB pools to store geometry.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class GrInOrderDrawBuffer : public GrDrawTarget {
|
class GrInOrderDrawBuffer : public GrDrawTarget {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -64,52 +62,29 @@ public:
|
|||||||
void setQuadIndexBuffer(const GrIndexBuffer* indexBuffer);
|
void setQuadIndexBuffer(const GrIndexBuffer* indexBuffer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Empties the draw buffer of any queued up draws. This must not be called
|
* Empties the draw buffer of any queued up draws. This must not be called while inside an
|
||||||
* while inside an unbalanced pushGeometrySource().
|
* unbalanced pushGeometrySource(). The current draw state and clip are preserved.
|
||||||
*/
|
*/
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* plays the queued up draws to another target. Does not empty this buffer
|
* This plays the queued up draws to another target. It also resets this object (i.e. flushing
|
||||||
* so that it can be played back multiple times. This buffer must not have
|
* is destructive). This buffer must not have an active reserved vertex or index source. Any
|
||||||
* an active reserved vertex or index source. Any reserved geometry on
|
* reserved geometry on the target will be finalized because it's geometry source will be pushed
|
||||||
* the target will be finalized because it's geometry source will be pushed
|
* before flushing and popped afterwards.
|
||||||
* before playback and popped afterwards.
|
|
||||||
*
|
*
|
||||||
* @return false if the playback trivially drew nothing because nothing was
|
* @return false if the playback trivially drew nothing because nothing was recorded.
|
||||||
* recorded.
|
|
||||||
*
|
*
|
||||||
* @param target the target to receive the playback
|
* @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
|
* This function allows the draw buffer to automatically flush itself to another target. This
|
||||||
* constraints and side-effects or playback() and reset apply().
|
* means the buffer may internally call this->flushTo(target) when it is safe to do so.
|
||||||
*/
|
|
||||||
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.
|
|
||||||
*
|
*
|
||||||
* When the auto flush target is set to NULL (as it initially is) the draw
|
* When the auto flush target is set to NULL (as it initially is) the draw buffer will never
|
||||||
* buffer will never automatically flush itself.
|
* automatically flush itself.
|
||||||
*/
|
*/
|
||||||
void setAutoFlushTarget(GrDrawTarget* target);
|
void setAutoFlushTarget(GrDrawTarget* target);
|
||||||
|
|
||||||
@ -253,7 +228,7 @@ private:
|
|||||||
int fMaxQuads;
|
int fMaxQuads;
|
||||||
int fCurrQuad;
|
int fCurrQuad;
|
||||||
|
|
||||||
// bookkeeping to attempt to concantenate drawIndexedInstances calls
|
// bookkeeping to attempt to concatenate drawIndexedInstances calls
|
||||||
struct {
|
struct {
|
||||||
int fVerticesPerInstance;
|
int fVerticesPerInstance;
|
||||||
int fIndicesPerInstance;
|
int fIndicesPerInstance;
|
||||||
|
Loading…
Reference in New Issue
Block a user