diff options
author | 2016-04-29 06:41:29 -0700 | |
---|---|---|
committer | 2016-04-29 06:41:29 -0700 | |
commit | fe635fd76bbc375d527d1884af23cc617ca364ee (patch) | |
tree | 97474bb463cf7768c24b948a1e66d08cf113d8df /src/gpu/gl | |
parent | 219ac2bc091d8f7b0fbf586ada24af9a55e9ca45 (diff) |
Make stencils be attachable to render targets created via SkSurface::MakeFromBackendTextureAsRenderTarget
This is a regression from "Refactor to separate backend object lifecycle
and GpuResource budget decision".
GrGLRenderTarget::CreateWrapped creates only render targets that wrap
the FBO.
GrGLRenderTargetTexture::CreateWrapped creates render targets that
wrap the texture.
Use the latter as the implementation for
SkSurface::MakeFromBackendTextureAsRenderTarget.
The test contains disabled code. The
MakeFromBackendTextureAsRenderTarget does not copy the existing texture
contents to the FBO render buffer.
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1924183003
Review-Url: https://codereview.chromium.org/1924183003
Diffstat (limited to 'src/gpu/gl')
-rw-r--r-- | src/gpu/gl/GrGLGpu.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 29add839bd..affdadfe77 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -723,19 +723,20 @@ GrRenderTarget* GrGLGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTextu } #endif - GrGLTextureInfo texInfo; + GrGLTexture::IDDesc idDesc; + idDesc.fOwnership = GrBackendObjectOwnership::kBorrowed; GrSurfaceDesc surfDesc; #ifdef SK_IGNORE_GL_TEXTURE_TARGET - texInfo.fID = static_cast<GrGLuint>(desc.fTextureHandle); + idDesc.fInfo.fID = static_cast<GrGLuint>(desc.fTextureHandle); // We only support GL_TEXTURE_2D at the moment. - texInfo.fTarget = GR_GL_TEXTURE_2D; + idDesc.fInfo.fTarget = GR_GL_TEXTURE_2D; #else - texInfo = *info; + idDesc.fInfo = *info; #endif - if (GR_GL_TEXTURE_RECTANGLE != texInfo.fTarget && - GR_GL_TEXTURE_2D != texInfo.fTarget) { + if (GR_GL_TEXTURE_RECTANGLE != idDesc.fInfo.fTarget && + GR_GL_TEXTURE_2D != idDesc.fInfo.fTarget) { // Only texture rectangle and texture 2d are supported. We do not check whether texture // rectangle is supported by Skia - if the caller provided us with a texture rectangle, // we assume the necessary support exists. @@ -758,10 +759,10 @@ GrRenderTarget* GrGLGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTextu } GrGLRenderTarget::IDDesc rtIDDesc; - if (!this->createRenderTargetObjects(surfDesc, texInfo, &rtIDDesc)) { + if (!this->createRenderTargetObjects(surfDesc, idDesc.fInfo, &rtIDDesc)) { return nullptr; } - return GrGLRenderTarget::CreateWrapped(this, surfDesc, rtIDDesc, 0); + return GrGLTextureRenderTarget::CreateWrapped(this, surfDesc, idDesc, rtIDDesc); } //////////////////////////////////////////////////////////////////////////////// |