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

Unified Diff: src/gpu/gl/GrGpuGL.cpp

Issue 15643013: Force checking of all color, stencil and FBO allocations for SkSurface_Gpu. This fixes the software… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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
« no previous file with comments | « src/gpu/gl/GrGLRenderTarget.h ('k') | src/image/SkSurface_Gpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGpuGL.cpp
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 2f218a0c86e543f42f5393cc629709fb7fa3aa24..784432ca4a48bd28dd0abda7a521b57196436861 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -426,6 +426,7 @@ GrTexture* GrGpuGL::onWrapBackendTexture(const GrBackendTextureDesc& desc) {
glRTDesc.fConfig = desc.fConfig;
glRTDesc.fSampleCnt = desc.fSampleCnt;
glRTDesc.fOrigin = glTexDesc.fOrigin;
+ glRTDesc.fCheckAllocation = false;
if (!this->createRenderTargetObjects(glTexDesc.fWidth,
glTexDesc.fHeight,
glTexDesc.fTextureID,
@@ -451,6 +452,7 @@ GrRenderTarget* GrGpuGL::onWrapBackendRenderTarget(const GrBackendRenderTargetDe
glDesc.fTexFBOID = GrGLRenderTarget::kUnresolvableFBOID;
glDesc.fSampleCnt = desc.fSampleCnt;
glDesc.fIsWrapped = true;
+ glDesc.fCheckAllocation = false;
glDesc.fOrigin = resolve_origin(desc.fOrigin, true);
GrGLIRect viewport;
@@ -535,6 +537,15 @@ bool adjust_pixel_ops_params(int surfaceWidth,
*height = subRect.height();
return true;
}
+
+GrGLenum checkAllocError(const GrTextureDesc& desc, const GrGLInterface* interface) {
bsalomon 2013/06/10 13:21:47 could you namespace {} and_rename_this_to_this_sty
Stephen White 2013/06/10 13:53:14 It already is.
+ if (0 != (desc.fFlags & kCheckAllocation_GrTextureFlagBit)) {
+ return GR_GL_GET_ERROR(interface);
+ } else {
+ return CHECK_ALLOC_ERROR(interface);
+ }
+}
+
}
bool GrGpuGL::uploadTexData(const GrGLTexture::Desc& desc,
@@ -670,7 +681,7 @@ bool GrGpuGL::uploadTexData(const GrGLTexture::Desc& desc,
data));
}
}
- GrGLenum error = CHECK_ALLOC_ERROR(this->glInterface());
+ GrGLenum error = checkAllocError(desc, this->glInterface());
if (error != GR_GL_NO_ERROR) {
succeeded = false;
} else {
@@ -798,7 +809,7 @@ bool GrGpuGL::createRenderTargetObjects(int width, int height,
GR_GL_COLOR_ATTACHMENT0,
GR_GL_RENDERBUFFER,
desc->fMSColorRenderbufferID));
- if (!this->glCaps().isConfigVerifiedColorAttachment(desc->fConfig)) {
+ if (desc->fCheckAllocation || !this->glCaps().isConfigVerifiedColorAttachment(desc->fConfig)) {
bsalomon 2013/06/10 13:21:47 can you wrap this if and the next one?
Stephen White 2013/06/10 13:53:14 Done.
GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER));
if (status != GR_GL_FRAMEBUFFER_COMPLETE) {
goto FAILED;
@@ -819,7 +830,7 @@ bool GrGpuGL::createRenderTargetObjects(int width, int height,
GR_GL_TEXTURE_2D,
texID, 0));
}
- if (!this->glCaps().isConfigVerifiedColorAttachment(desc->fConfig)) {
+ if (desc->fCheckAllocation || !this->glCaps().isConfigVerifiedColorAttachment(desc->fConfig)) {
GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER));
if (status != GR_GL_FRAMEBUFFER_COMPLETE) {
goto FAILED;
@@ -882,6 +893,7 @@ GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc,
glRTDesc.fTexFBOID = 0;
glRTDesc.fIsWrapped = false;
glRTDesc.fConfig = glTexDesc.fConfig;
+ glRTDesc.fCheckAllocation = 0 != (desc.fFlags & kCheckAllocation_GrTextureFlagBit);
bsalomon 2013/06/10 13:21:47 SkToBool(desc.fFlags & ...)
Stephen White 2013/06/10 13:53:14 Done. Want me to do the line below? :)
bsalomon 2013/06/10 14:04:42 Yes, please! Much of the GPU code doesn't use SkTo
Stephen White 2013/06/10 14:54:39 Done (here and two other places in this file).
bool renderTarget = 0 != (desc.fFlags & kRenderTarget_GrTextureFlagBit);
@@ -1039,7 +1051,7 @@ bool GrGpuGL::createStencilBufferForRenderTarget(GrRenderTarget* rt,
sFmt.fInternalFormat,
width, height));
created =
- (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(this->glInterface()));
+ (GR_GL_NO_ERROR == checkAllocError(rt->desc(), this->glInterface()));
}
if (created) {
// After sized formats we attempt an unsized format and take
« no previous file with comments | « src/gpu/gl/GrGLRenderTarget.h ('k') | src/image/SkSurface_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698