diff options
author | 2011-11-05 12:47:43 +0000 | |
---|---|---|
committer | 2011-11-05 12:47:43 +0000 | |
commit | b635d39172bb4080e7996c1f41f38f299c32d2d7 (patch) | |
tree | 42cb8ff55479e4fc655966497b1cdf7d86a0868c /src | |
parent | 1bf1c21025e50dba3352ccb660e384f8540ff89c (diff) |
bump GrGpu reset context timestamp size
git-svn-id: http://skia.googlecode.com/svn/trunk@2606 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/GrGpu.cpp | 7 | ||||
-rw-r--r-- | src/gpu/GrGpu.h | 24 |
2 files changed, 18 insertions, 13 deletions
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index 9ce8fa05e6..cbbd74f93a 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -32,7 +32,7 @@ extern void gr_run_unittests(); GrGpu::GrGpu() : fContext(NULL) - , fResetCnt(0) + , fResetTimestamp(0) , fVertexPool(NULL) , fIndexPool(NULL) , fVertexPoolUseCnt(0) @@ -62,11 +62,6 @@ GrGpu::~GrGpu() { this->releaseResources(); } -void GrGpu::resetContext() { - this->onResetContext(); - ++fResetCnt; -} - void GrGpu::abandonResources() { while (NULL != fResourceHead) { diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h index 6961a30b59..abcd8ac4b5 100644 --- a/src/gpu/GrGpu.h +++ b/src/gpu/GrGpu.h @@ -288,15 +288,20 @@ protected: void finalizeReservedVertices(); void finalizeReservedIndices(); - // called to handle re-emitting 3D API preample and dirtying state cache. - void resetContext(); - // returns the number of times resetContext has been called. This value - // can be used a timestamp to detect when state cache is dirty. - int resetCount() const { return fResetCnt; } + // at 10 resets / frame and 60fps a 64bit timestamp will overflow in about + // a billion years. + typedef uint64_t ResetContextTimestamp; - // subclass implementation of resetContext + // called when the 3D context state is unknown. Subclass should emit any + // assumed 3D context state and dirty any state cache virtual void onResetContext() = 0; + // returns the number of times the context was reset. This timestamp can be + // used to lazily detect when cached 3D context state is dirty. + ResetContextTimestamp resetContextTimestamp() const { + return fResetTimestamp; + } + // overridden by API-specific derived class to create objects. virtual GrTexture* onCreateTexture(const GrTextureDesc& desc, const void* srcData, @@ -369,7 +374,7 @@ protected: private: GrContext* fContext; // not reffed (context refs gpu) - int fResetCnt; + ResetContextTimestamp fResetTimestamp; GrVertexBufferAllocPool* fVertexPool; @@ -419,6 +424,11 @@ private: // determines the path renderer used to draw a clip path element. GrPathRenderer* getClipPathRenderer(const SkPath& path, GrPathFill fill); + void resetContext() { + this->onResetContext(); + ++fResetTimestamp; + } + void handleDirtyContext() { if (fContextIsDirty) { this->resetContext(); |