Add GrContext::resetGLTextureBindings().
This function binds texture ID 0 to any texture unit/target combo that
Skia has modified.
Bug: chromium:926017
Change-Id: I3ac8f8050c863232886102886e60d3b91a5380c9
Reviewed-on: https://skia-review.googlesource.com/c/190663
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index b559dee..f14bd23 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -182,6 +182,8 @@
// GrGpu overrides
void onResetContext(uint32_t resetBits) override;
+ void onResetTextureBindings() override;
+
void xferBarrier(GrRenderTarget*, GrXferBarrierType) override;
sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
@@ -603,12 +605,17 @@
TextureUnitBindings& operator=(const TextureUnitBindings&) = delete;
GrGpuResource::UniqueID boundID(GrGLenum target) const;
+ bool hasBeenModified(GrGLenum target) const;
void setBoundID(GrGLenum target, GrGpuResource::UniqueID);
- void invalidate(GrGLenum target);
- void invalidateAllTargets();
+ void invalidateForScratchUse(GrGLenum target);
+ void invalidateAllTargets(bool markUnmodified);
private:
- GrGpuResource::UniqueID fBoundResourceIDs[3];
+ struct TargetBinding {
+ GrGpuResource::UniqueID fBoundResourceID;
+ bool fHasBeenModified = false;
+ };
+ TargetBinding fTargetBindings[3];
};
SkAutoTArray<TextureUnitBindings> fHWTextureUnitBindings;