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

Issue 1709163003: Add wrapBackendTextureAsRenderTarget API (Closed)

Created:
4 years, 10 months ago by ericrk
Modified:
4 years, 10 months ago
Reviewers:
bsalomon
CC:
reviews_skia.org, erikchen
Base URL:
https://chromium.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Add wrapBackendTextureAsRenderTarget API Skia's GrTextureProvider currently exposes two APIs for wrapping backend objects: * wrapBackendTexture - wraps a texture into a GrTexture. Depending on flags, this GrTexture can be converted to a GrRenderTarget. Skia manages the render target objects it may create to provide a render target for the texture. This allows Skia to create stencil buffers if needed and manager MSAA resolves. * wrapBackendRenderTarget - wraps a FBO into a GrRenderTarget. This object cannot be converted to a GrTexture. Skia does not manage the render target objects for such a GrRenderTarget, and as such cannot attach stencil buffers or perform MSAA resolves on the created GrRenderTarget. Given these two options, wrapBackendTexture provides more versatility and allows Skia more room for optimization. Chrome currently uses wrapBackendTexture for this reason. While these two functions cover most cases, they do not provide a way for Skia to wrap a texture into a render target (and gain the MSAA and stencil buffer management), without also creating a GrTexture. This is problematic in cases where a texture can be bound to a render target, but cannot be textured from, as is the case in Chrome's limited support for GL_TEXTURE_RECTANGLE. To address this, a new function is created: * wrapBackendTextureAsRenderTarget - wraps a texture into a GrRenderTarget. As with wrapBackendTexture, the created render target objects are fully managed by Skia. Unlike wrapBackendTexture no GrTexture is created, and the created object will never be textured from. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1709163003 Committed: https://skia.googlesource.com/skia/+/f7b8b8affec91fcfab0d79199e466c16c254fe56

Patch Set 1 #

Patch Set 2 : Remove assert that is no longer true #

Total comments: 8

Patch Set 3 : move prepareForExternalIO to SkSurface #

Total comments: 4

Patch Set 4 : nits #

Patch Set 5 : extra line #

Patch Set 6 : fix test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+173 lines, -12 lines) Patch
M include/core/SkSurface.h View 1 2 3 chunks +16 lines, -1 line 0 comments Download
M include/gpu/GrTextureProvider.h View 1 2 1 chunk +1 line, -1 line 0 comments Download
M src/gpu/GrGpu.h View 2 chunks +9 lines, -2 lines 0 comments Download
M src/gpu/GrGpu.cpp View 1 2 2 chunks +20 lines, -0 lines 0 comments Download
M src/gpu/GrResourceProvider.h View 1 2 1 chunk +9 lines, -0 lines 0 comments Download
M src/gpu/GrResourceProvider.cpp View 1 2 3 1 chunk +7 lines, -0 lines 0 comments Download
M src/gpu/GrTest.cpp View 1 2 3 4 5 1 chunk +5 lines, -0 lines 0 comments Download
M src/gpu/gl/GrGLGpu.h View 1 chunk +2 lines, -0 lines 0 comments Download
M src/gpu/gl/GrGLGpu.cpp View 1 2 3 4 3 chunks +65 lines, -8 lines 0 comments Download
M src/image/SkSurface.cpp View 1 2 2 chunks +9 lines, -0 lines 0 comments Download
M src/image/SkSurface_Base.h View 1 2 1 chunk +5 lines, -0 lines 0 comments Download
M src/image/SkSurface_Gpu.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M src/image/SkSurface_Gpu.cpp View 1 2 3 chunks +24 lines, -0 lines 0 comments Download

Messages

Total messages: 21 (10 generated)
ericrk
Hey Brian, here's my initial take on the API we discussed a couple days ago. ...
4 years, 10 months ago (2016-02-19 21:34:08 UTC) #3
bsalomon
Seems like the right direction to me. https://codereview.chromium.org/1709163003/diff/20001/include/gpu/GrTextureProvider.h File include/gpu/GrTextureProvider.h (right): https://codereview.chromium.org/1709163003/diff/20001/include/gpu/GrTextureProvider.h#newcode111 include/gpu/GrTextureProvider.h:111: GrRenderTarget* wrapBackendTextureAsRenderTarget(const ...
4 years, 10 months ago (2016-02-22 16:41:01 UTC) #4
ericrk
Thanks for the feedback - a few questions. https://codereview.chromium.org/1709163003/diff/20001/include/gpu/GrTextureProvider.h File include/gpu/GrTextureProvider.h (right): https://codereview.chromium.org/1709163003/diff/20001/include/gpu/GrTextureProvider.h#newcode111 include/gpu/GrTextureProvider.h:111: GrRenderTarget* ...
4 years, 10 months ago (2016-02-22 21:02:59 UTC) #5
bsalomon
https://codereview.chromium.org/1709163003/diff/20001/include/gpu/GrTextureProvider.h File include/gpu/GrTextureProvider.h (right): https://codereview.chromium.org/1709163003/diff/20001/include/gpu/GrTextureProvider.h#newcode111 include/gpu/GrTextureProvider.h:111: GrRenderTarget* wrapBackendTextureAsRenderTarget(const GrBackendTextureDesc& desc, On 2016/02/22 21:02:59, ericrk wrote: ...
4 years, 10 months ago (2016-02-23 02:25:27 UTC) #6
ericrk
Made the suggested edits and added a parallel public function on SkSurface. Let me know ...
4 years, 10 months ago (2016-02-24 00:39:53 UTC) #8
bsalomon
lgtm with some minor nits https://codereview.chromium.org/1709163003/diff/60001/src/gpu/GrResourceProvider.cpp File src/gpu/GrResourceProvider.cpp (right): https://codereview.chromium.org/1709163003/diff/60001/src/gpu/GrResourceProvider.cpp#newcode233 src/gpu/GrResourceProvider.cpp:233: return nullptr; four space ...
4 years, 10 months ago (2016-02-24 18:22:02 UTC) #9
ericrk
https://codereview.chromium.org/1709163003/diff/60001/src/gpu/GrResourceProvider.cpp File src/gpu/GrResourceProvider.cpp (right): https://codereview.chromium.org/1709163003/diff/60001/src/gpu/GrResourceProvider.cpp#newcode233 src/gpu/GrResourceProvider.cpp:233: return nullptr; On 2016/02/24 18:22:02, bsalomon wrote: > four ...
4 years, 10 months ago (2016-02-24 19:59:09 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1709163003/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1709163003/120001
4 years, 10 months ago (2016-02-24 20:04:31 UTC) #14
commit-bot: I haz the power
Try jobs failed on following builders: Build-Mac-Clang-x86_64-Release-Trybot on client.skia.compile (JOB_FAILED, http://build.chromium.org/p/client.skia.compile/builders/Build-Mac-Clang-x86_64-Release-Trybot/builds/600)
4 years, 10 months ago (2016-02-24 20:05:46 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1709163003/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1709163003/140001
4 years, 10 months ago (2016-02-24 21:10:52 UTC) #19
commit-bot: I haz the power
4 years, 10 months ago (2016-02-24 22:49:56 UTC) #21
Message was sent while issue was closed.
Committed patchset #6 (id:140001) as
https://skia.googlesource.com/skia/+/f7b8b8affec91fcfab0d79199e466c16c254fe56

Powered by Google App Engine
This is Rietveld 408576698