aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/GrContext.cpp')
-rw-r--r--src/gpu/GrContext.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 0f6fa1651c..934f1784af 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -425,6 +425,11 @@ GrTexture* GrContext::lockAndRefScratchTexture(const GrTextureDesc& inDesc, Scra
desc.fHeight = GrMax(MIN_SIZE, GrNextPow2(desc.fHeight));
}
+ // Renderable A8 targets are not universally supported (e.g., not on ANGLE)
+ GrAssert(this->isConfigRenderable(kAlpha_8_GrPixelConfig) ||
+ !(desc.fFlags & kRenderTarget_GrTextureFlagBit) ||
+ (desc.fConfig != kAlpha_8_GrPixelConfig));
+
GrResource* resource = NULL;
int origWidth = desc.fWidth;
int origHeight = desc.fHeight;
@@ -1435,7 +1440,10 @@ bool GrContext::readRenderTargetPixels(GrRenderTarget* target,
}
swapRAndB = false; // we will handle the swap in the draw.
- GrDrawTarget::AutoStateRestore asr(fGpu, GrDrawTarget::kReset_ASRInit);
+ // We protect the existing geometry here since it may not be
+ // clear to the caller that a draw operation (i.e., drawSimpleRect)
+ // can be invoked in this method
+ GrDrawTarget::AutoGeometryAndStatePush agasp(fGpu, GrDrawTarget::kReset_ASRInit);
GrDrawState* drawState = fGpu->drawState();
GrAssert(effect);
drawState->setEffect(0, effect);
@@ -1622,7 +1630,10 @@ bool GrContext::writeRenderTargetPixels(GrRenderTarget* target,
return false;
}
- GrDrawTarget::AutoStateRestore asr(fGpu, GrDrawTarget::kReset_ASRInit);
+ // writeRenderTargetPixels can be called in the midst of drawing another
+ // object (e.g., when uploading a SW path rendering to the gpu while
+ // drawing a rect) so preserve the current geometry.
+ GrDrawTarget::AutoGeometryAndStatePush agasp(fGpu, GrDrawTarget::kReset_ASRInit);
GrDrawState* drawState = fGpu->drawState();
GrAssert(effect);
drawState->setEffect(0, effect);