Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Unified Diff: src/gpu/GrGpu.h

Issue 17027003: Add flag bits for partial GrContext reset (Closed)
Patch Set: add flags for partial resetContext Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrGpu.h
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 3acfac2703e6d25dd45f8d51539db636a6bc858a..c7b3bd189f920a048c08f7d06142099d9ce444a3 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -66,7 +66,10 @@ public:
* the GrGpu that the state was modified and it shouldn't make assumptions
* about the state.
*/
- void markContextDirty() { fContextIsDirty = true; }
+ void markContextDirty(GrContext::GrState state = GrContext::kGrState_ALL) {
+ fContextIsDirty = true;
+ fResetBits |= state;
+ }
void unimpl(const char[]);
@@ -331,6 +334,11 @@ public:
// expensive than clearing all bits.
virtual void clearStencilClip(const GrIRect& rect, bool insideClip) = 0;
+ /**
+ * Only reset texture binding
+ */
+ virtual void resetTextureBinding() = 0;
+
enum PrivateDrawStateStateBits {
kFirstBit = (GrDrawState::kLastPublicStateBit << 1),
@@ -426,7 +434,7 @@ private:
// 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;
+ virtual void onResetContext(int resetBits) = 0;
// overridden by backend-specific derived class to create objects.
virtual GrTexture* onCreateTexture(const GrTextureDesc& desc,
@@ -507,7 +515,8 @@ private:
// stencil buffer. Perhaps we should detect whether it is a
// internally created stencil buffer and if so skip the invalidate.
fClipMaskManager.invalidateStencilMask();
- this->onResetContext();
+ this->onResetContext(fResetBits);
+ fResetBits = 0;
++fResetTimestamp;
}
@@ -532,6 +541,7 @@ private:
// these are mutable so they can be created on-demand
mutable GrIndexBuffer* fQuadIndexBuffer;
bool fContextIsDirty;
+ int fResetBits;
// Used to abandon/release all resources created by this GrGpu. TODO: Move this
// functionality to GrResourceCache.
ResourceList fResourceList;
« include/gpu/GrContext.h ('K') | « src/gpu/GrContext.cpp ('k') | src/gpu/gl/GrGpuGL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698