aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-31 21:44:25 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-31 21:44:25 +0000
commit56ce48ade325f6f49acb0da31d6252806e4ed7ef (patch)
treee804f1b07497ae7bc57e6b52bf27100364cca1f0 /src/gpu/gl
parentfc7ceefd1a6d90e659960336ecea8742f4d4d146 (diff)
Add can-ignore-rect hint to clear call
Diffstat (limited to 'src/gpu/gl')
-rw-r--r--src/gpu/gl/GrGLCaps.cpp7
-rw-r--r--src/gpu/gl/GrGLCaps.h3
-rw-r--r--src/gpu/gl/GrGpuGL.cpp6
-rw-r--r--src/gpu/gl/GrGpuGL.h2
4 files changed, 16 insertions, 2 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 8e6c3e2d23..60c0dfaf10 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -48,6 +48,7 @@ void GrGLCaps::reset() {
fIsCoreProfile = false;
fFixedFunctionSupport = false;
fDiscardFBSupport = false;
+ fFullClearIsFree = false;
}
GrGLCaps::GrGLCaps(const GrGLCaps& caps) : GrDrawTargetCaps() {
@@ -84,6 +85,7 @@ GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) {
fIsCoreProfile = caps.fIsCoreProfile;
fFixedFunctionSupport = caps.fFixedFunctionSupport;
fDiscardFBSupport = caps.fDiscardFBSupport;
+ fFullClearIsFree = caps.fFullClearIsFree;
return *this;
}
@@ -224,6 +226,10 @@ void GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
fDiscardFBSupport = ctxInfo.hasExtension("GL_EXT_discard_framebuffer");
+ if (kARM_GrGLVendor == ctxInfo.vendor() || kImagination_GrGLVendor == ctxInfo.vendor()) {
+ fFullClearIsFree = true;
+ }
+
if (kDesktop_GrGLBinding == binding) {
fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) ||
ctxInfo.hasExtension("GL_ARB_vertex_array_object");
@@ -648,4 +654,5 @@ void GrGLCaps::print() const {
GrPrintf("Use non-VBO for dynamic data: %s\n",
(fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO"));
GrPrintf("Discard FrameBuffer support: %s\n", (fDiscardFBSupport ? "YES" : "NO"));
+ GrPrintf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO"));
}
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index 81391ecc6b..c126a76774 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -248,6 +248,8 @@ public:
/// Is there support for discarding the frame buffer
bool discardFBSupport() const { return fDiscardFBSupport; }
+ bool fullClearIsFree() const { return fFullClearIsFree; }
+
private:
/**
* Maintains a bit per GrPixelConfig. It is used to avoid redundantly
@@ -329,6 +331,7 @@ private:
bool fIsCoreProfile : 1;
bool fFixedFunctionSupport : 1;
bool fDiscardFBSupport : 1;
+ bool fFullClearIsFree : 1;
typedef GrDrawTargetCaps INHERITED;
};
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index adbfc35bef..92e496c3ee 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -1255,12 +1255,16 @@ void GrGpuGL::flushScissor() {
}
}
-void GrGpuGL::onClear(const SkIRect* rect, GrColor color) {
+void GrGpuGL::onClear(const SkIRect* rect, GrColor color, bool canIgnoreRect) {
const GrDrawState& drawState = this->getDrawState();
const GrRenderTarget* rt = drawState.getRenderTarget();
// parent class should never let us get here with no RT
SkASSERT(NULL != rt);
+ if (canIgnoreRect && this->glCaps().fullClearIsFree()) {
+ rect = NULL;
+ }
+
SkIRect clippedRect;
if (NULL != rect) {
// flushScissor expects rect to be clipped to the target.
diff --git a/src/gpu/gl/GrGpuGL.h b/src/gpu/gl/GrGpuGL.h
index 677e48cb0f..7c97080e5f 100644
--- a/src/gpu/gl/GrGpuGL.h
+++ b/src/gpu/gl/GrGpuGL.h
@@ -135,7 +135,7 @@ private:
GrStencilBuffer* sb,
GrRenderTarget* rt) SK_OVERRIDE;
- virtual void onClear(const SkIRect* rect, GrColor color) SK_OVERRIDE;
+ virtual void onClear(const SkIRect* rect, GrColor color, bool canIgnoreRect) SK_OVERRIDE;
virtual void onForceRenderTargetFlush() SK_OVERRIDE;