Bug 41828 - [chromium] Allow resizing an offscreen GLES2Context's backing store and getting its texture ID for compositing
Summary: [chromium] Allow resizing an offscreen GLES2Context's backing store and getti...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: James Robinson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-07 19:38 PDT by James Robinson
Modified: 2010-07-08 17:41 PDT (History)
2 users (show)

See Also:


Attachments
Patch (4.20 KB, patch)
2010-07-07 20:02 PDT, James Robinson
no flags Details | Formatted Diff | Diff
Patch (4.68 KB, patch)
2010-07-08 14:24 PDT, James Robinson
fishd: review+
fishd: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Robinson 2010-07-07 19:38:50 PDT
[chromium] Allow resizing an offscreen GLES2Context's backing store and getting its texture ID for compositing
Comment 1 James Robinson 2010-07-07 20:02:24 PDT
Created attachment 60829 [details]
Patch
Comment 2 James Robinson 2010-07-07 20:45:51 PDT
Ken, Darin - mind taking a look?  I added an ASSERT(webContext) rather than returning a bool since currently there is no good way for a caller to handle a failure and because getOffscreenContentParentTextureId naturally returns an unsigned.
Comment 3 Darin Fisher (:fishd, Google) 2010-07-07 23:08:50 PDT
Comment on attachment 60829 [details]
Patch

WebCore/platform/chromium/GLES2Context.h:65
 +      unsigned getOffscreenContentParentTextureId();
i like this name for this method.  it helps me understand its distinction better.

WebCore/platform/chromium/GLES2Context.h:62
 +      void resizeOffscreenContent(const IntSize& size);
nit: webkit style is to leave off parameter names that do not add information.
"size" is redundant with "IntSize"

WebCore/platform/chromium/GLES2Context.h:63
 +      // Returns the ID of the texture used for offscreen rendering in the context of the parent.
nit: a new line above this comment block would be nice for readability.

WebKit/chromium/public/WebGLES2Context.h:52
 +      virtual void resizeOffscreenContent(int width, int height) = 0;
nit: use WebSize in the WebKit API.

WebKit/chromium/public/WebGLES2Context.h:53
 +      virtual unsigned getOffscreenContentParentTextureId() = 0;
how about documenting these methods like you did for GLES2Context.h?
it is important to document the WebKit API methods since that helps
make the contract with the embedder clearer.

WebKit/chromium/src/GLES2Context.cpp:148
 +      webContext->resizeOffscreenContent(size.width(), size.height());
WebSize can be constructed implicitly from IntSize :)

otherwise, LGTM based on this being a faithful interpretation of
what kbr wrote on the whiteboard earlier today :-)
Comment 4 James Robinson 2010-07-08 14:24:47 PDT
Created attachment 60959 [details]
Patch
Comment 5 Kenneth Russell 2010-07-08 14:49:40 PDT
Comment on attachment 60959 [details]
Patch

Looks good to me. As in earlier Chromium review, uint32_t may be a better return type for getOffscreenContentParentTextureId().
Comment 6 Darin Fisher (:fishd, Google) 2010-07-08 16:31:15 PDT
Comment on attachment 60959 [details]
Patch

WebKit/chromium/public/WebGLES2Context.h:54
> +      // The follow two functions are for managing a context that renders offscreen.
nit: put a new line after this comment so that it doesn't look like
this comment is only talking about the first function?

how critical is the unsigned vs uint32_t distinction?  in the webkit api,
we don't really have a uint32_t.  (well, we do have one inherited from
npruntime.h, but it would be odd to use that in this context.)

anyways, r=me modulo the nit above.
Comment 7 James Robinson 2010-07-08 16:34:48 PDT
I don't think uint32_t vs unsigned will be an issue.  If on some crazy moon system 'unsigned' was 64 bits things would still work fine since an unsigned would be able to represent the contents of a uint32_t without issue.  We're using 'unsigned' for the GLuint type for texture IDs and other things elsewhere in WebKit code so I'd rather stick to that.
Comment 8 Kenneth Russell 2010-07-08 16:44:50 PDT
(In reply to comment #7)
> I don't think uint32_t vs unsigned will be an issue.  If on some crazy moon system 'unsigned' was 64 bits things would still work fine since an unsigned would be able to represent the contents of a uint32_t without issue.  We're using 'unsigned' for the GLuint type for texture IDs and other things elsewhere in WebKit code so I'd rather stick to that.

OK, sounds fine.
Comment 9 James Robinson 2010-07-08 17:41:28 PDT
Committed r62874: <http://trac.webkit.org/changeset/62874>
Comment 10 James Robinson 2010-07-08 17:41:54 PDT
Thanks for the review.  Adjusted the space on the comments and landed.