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

Issue 17230006: Implement WEBGL_shared_resources

Created:
7 years, 6 months ago by greggman
Modified:
7 years, 6 months ago
CC:
blink-reviews, Nils Barth (inactive), jsbell+bindings_chromium.org, eae+blinkwatch, abarth-chromium, marja+watch_chromium.org, Rik, adamk+blink_chromium.org, haraken, Nate Chapin, do-not-use, bajones, Zhenyao Mo
Visibility:
Public.

Description

Implement WEBGL_shared_resources BUG=235718

Patch Set 1 #

Patch Set 2 : #

Total comments: 2

Patch Set 3 : #

Patch Set 4 : #

Total comments: 31

Patch Set 5 : #

Patch Set 6 : #

Patch Set 7 : #

Patch Set 8 : #

Patch Set 9 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1261 lines, -359 lines) Patch
M Source/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp View 2 chunks +8 lines, -0 lines 0 comments Download
M Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp View 1 2 3 4 2 chunks +5 lines, -0 lines 0 comments Download
M Source/core/core.gypi View 1 2 3 4 5 6 7 5 chunks +12 lines, -0 lines 0 comments Download
A + Source/core/html/canvas/WebGLAcquireSharedResourceCallback.h View 1 2 3 4 2 chunks +11 lines, -10 lines 0 comments Download
A + Source/core/html/canvas/WebGLAcquireSharedResourceCallback.cpp View 3 chunks +7 lines, -8 lines 0 comments Download
A + Source/core/html/canvas/WebGLAcquireSharedResourceCallback.idl View 1 2 3 4 3 chunks +5 lines, -4 lines 0 comments Download
M Source/core/html/canvas/WebGLBuffer.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/html/canvas/WebGLBuffer.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/html/canvas/WebGLContextAttributes.h View 3 chunks +7 lines, -0 lines 0 comments Download
M Source/core/html/canvas/WebGLContextAttributes.cpp View 2 chunks +11 lines, -0 lines 0 comments Download
M Source/core/html/canvas/WebGLContextGroup.h View 1 2 3 4 3 chunks +5 lines, -0 lines 0 comments Download
M Source/core/html/canvas/WebGLContextGroup.cpp View 1 2 3 4 5 6 7 2 chunks +15 lines, -0 lines 0 comments Download
M Source/core/html/canvas/WebGLContextObject.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/html/canvas/WebGLDebugShaders.cpp View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M Source/core/html/canvas/WebGLExtension.h View 2 chunks +2 lines, -1 line 0 comments Download
M Source/core/html/canvas/WebGLFramebuffer.h View 1 chunk +2 lines, -2 lines 0 comments Download
M Source/core/html/canvas/WebGLFramebuffer.cpp View 1 2 3 chunks +6 lines, -3 lines 0 comments Download
M Source/core/html/canvas/WebGLObject.h View 2 chunks +3 lines, -3 lines 0 comments Download
A + Source/core/html/canvas/WebGLObject.idl View 1 2 3 4 3 chunks +4 lines, -4 lines 0 comments Download
M Source/core/html/canvas/WebGLProgram.h View 1 2 3 4 4 chunks +40 lines, -6 lines 0 comments Download
M Source/core/html/canvas/WebGLProgram.cpp View 1 2 3 4 3 chunks +68 lines, -18 lines 0 comments Download
M Source/core/html/canvas/WebGLProgram.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/html/canvas/WebGLRenderbuffer.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/html/canvas/WebGLRenderbuffer.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/html/canvas/WebGLRenderingContext.h View 1 2 14 chunks +36 lines, -17 lines 0 comments Download
M Source/core/html/canvas/WebGLRenderingContext.cpp View 1 2 3 4 103 chunks +419 lines, -194 lines 0 comments Download
M Source/core/html/canvas/WebGLShader.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/html/canvas/WebGLShader.idl View 1 chunk +1 line, -1 line 0 comments Download
A + Source/core/html/canvas/WebGLShareGroup.h View 1 2 3 4 5 2 chunks +16 lines, -18 lines 0 comments Download
A + Source/core/html/canvas/WebGLShareGroup.cpp View 1 2 3 4 5 3 chunks +21 lines, -7 lines 0 comments Download
A + Source/core/html/canvas/WebGLShareGroup.idl View 1 2 3 4 5 3 chunks +4 lines, -4 lines 0 comments Download
M Source/core/html/canvas/WebGLSharedObject.h View 1 2 3 4 5 6 7 2 chunks +87 lines, -4 lines 0 comments Download
M Source/core/html/canvas/WebGLSharedObject.cpp View 1 2 3 4 5 6 7 2 chunks +296 lines, -3 lines 0 comments Download
A + Source/core/html/canvas/WebGLSharedObject.idl View 1 2 3 4 5 3 chunks +4 lines, -4 lines 0 comments Download
A + Source/core/html/canvas/WebGLSharedResources.h View 1 2 3 4 5 2 chunks +24 lines, -21 lines 0 comments Download
A Source/core/html/canvas/WebGLSharedResources.cpp View 1 2 3 4 5 1 chunk +118 lines, -0 lines 0 comments Download
A + Source/core/html/canvas/WebGLSharedResources.idl View 1 2 3 4 5 2 chunks +14 lines, -21 lines 0 comments Download
M Source/core/html/canvas/WebGLTexture.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/html/canvas/WebGLTexture.idl View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 6 (0 generated)
do-not-use
https://codereview.chromium.org/17230006/diff/2001/Source/core/html/canvas/WebGLSharedObject.idl File Source/core/html/canvas/WebGLSharedObject.idl (right): https://codereview.chromium.org/17230006/diff/2001/Source/core/html/canvas/WebGLSharedObject.idl#newcode26 Source/core/html/canvas/WebGLSharedObject.idl:26: interface WebGLSharedObject { Isn't it supposed to inherit WebGLObject? ...
7 years, 6 months ago (2013-06-18 08:08:00 UTC) #1
greggman
Hey Ken, PTAL Sorry it's so big. Some parts are smaller than they look (a ...
7 years, 6 months ago (2013-06-19 00:03:20 UTC) #2
Ken Russell (switch to Gerrit)
This is brilliant work. It's clear this was carefully written and tested; despite the fact ...
7 years, 6 months ago (2013-06-19 03:51:24 UTC) #3
do-not-use
https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/WebGLSharedObject.idl File Source/core/html/canvas/WebGLSharedObject.idl (right): https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/WebGLSharedObject.idl#newcode26 Source/core/html/canvas/WebGLSharedObject.idl:26: interface WebGLSharedObject { from your link (http://www.khronos.org/registry/webgl/extensions/WEBGL_shared_resources/): interface WebGLSharedObject ...
7 years, 6 months ago (2013-06-19 05:57:38 UTC) #4
Ken Russell (switch to Gerrit)
https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/WebGLSharedObject.idl File Source/core/html/canvas/WebGLSharedObject.idl (right): https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/WebGLSharedObject.idl#newcode26 Source/core/html/canvas/WebGLSharedObject.idl:26: interface WebGLSharedObject { On 2013/06/19 05:57:38, Christophe Dumez wrote: ...
7 years, 6 months ago (2013-06-19 20:29:59 UTC) #5
greggman
7 years, 6 months ago (2013-06-21 19:54:21 UTC) #6
I think I covered all your comments but it looks like I'm not going to be able
to commit this


1) I think there's a debate to be had on if this is the righ direction

https://www.khronos.org/webgl/public-mailing-list/archives/1306/msg00046.html



2) When I run the conformance tests in debug on OSX the GPU process crashes
randomly while creating an offscreen view.

I can't see how this code causes that. It's certainly possible it does but the
mailbox code causes a similar issue with the texture-size.html 

https://code.google.com/p/chromium/issues/detail?id=251628



In any case I don't have time to track down why and I can't check this in until
that issue is solved

So, at the moment this is in limbo

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
File Source/core/html/canvas/WebGLAcquireSharedResourceCallback.idl (right):

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
Source/core/html/canvas/WebGLAcquireSharedResourceCallback.idl:27: boolean
handleEvent(WebGLSharedObject object);
On 2013/06/19 03:51:24, kbr wrote:
> Is the extension spec correct here? It looks like the object is passed as
> argument to the callback (which seems good), but the extension spec says the
> callback takes no arguments.

No, That's just because I copied it from somewhere else. Removed. There's no
need for it to pass you the resource. It's easy to track that in JavaScript with
closures.

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
File Source/core/html/canvas/WebGLContextGroup.h (right):

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
Source/core/html/canvas/WebGLContextGroup.h:48: // Adds the context to this
group and returns a context index of the context.
On 2013/06/19 03:51:24, kbr wrote:
> Is the context index used anywhere? It looks like it's ignored at the call
site.

Done.

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
File Source/core/html/canvas/WebGLDebugShaders.cpp (right):

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
Source/core/html/canvas/WebGLDebugShaders.cpp:1: /*
On 2013/06/19 03:51:24, kbr wrote:
> Accidental whitespace change.

Done.

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
File Source/core/html/canvas/WebGLProgram.cpp (right):

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
Source/core/html/canvas/WebGLProgram.cpp:189: for (int j = 0; location >= 0 && j
< info.size; ++j) {
On 2013/06/19 03:51:24, kbr wrote:
> This inner loop is tricky to understand. Can you add a comment saying that the
> point of the loop is to chain together the locations of uniform sampler
arrays?

Done.

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
Source/core/html/canvas/WebGLProgram.cpp:234: location = it->value.nextLocation;
On 2013/06/19 03:51:24, kbr wrote:
> This chaining together of the locations of uniform sampler arrays is extremely
> clever. I wonder whether anyone is going to understand it in the future...

added a comment. Or are you suggesting I should use another implementation?

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
File Source/core/html/canvas/WebGLProgram.h (right):

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
Source/core/html/canvas/WebGLProgram.h:84: void
setSampler(WebGLRenderingContext*, GC3Dint, GC3Dsizei, const GC3Dint*);
On 2013/06/19 03:51:24, kbr wrote:
> Would a more descriptive name like "conditionallySetSamplersToTextureUnits" be
> useful here?

Done.

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
File Source/core/html/canvas/WebGLRenderingContext.cpp (right):

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
Source/core/html/canvas/WebGLRenderingContext.cpp:1673: if
(!object->validate(functionName, this, WebGLSharedObject::Exclusive, true, 0)) {
On 2013/06/19 03:51:24, kbr wrote:
> What happens if the implementation tries to force context loss (because of
page
> navigation, etc.) but the user has messed up the acquire state of the object?
It
> looks like validation will fail and the object won't actually be deleted. Is a
> "force" flag needed?

I don't think so. context lost doesn't go through this code AFAICT

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
Source/core/html/canvas/WebGLRenderingContext.cpp:4515: return false;
On 2013/06/19 03:51:24, kbr wrote:
> The code associated with resetActiveUnit isn't run in this case; I assume
that's
> OK because the next call with prepareToDraw=false will take care of it?

Yes, added a comment

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
File Source/core/html/canvas/WebGLSharedObject.cpp (right):

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
Source/core/html/canvas/WebGLSharedObject.cpp:45: case 4:
On 2013/06/19 03:51:24, kbr wrote:
> Should these ints come from WebGLSharedResources.h instead?

Done.

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
Source/core/html/canvas/WebGLSharedObject.cpp:58:
acquire(WebGLSharedObject::Exclusive, context);
On 2013/06/19 03:51:24, kbr wrote:
> Should there be an ASSERT on the result of this call?

Done.

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
Source/core/html/canvas/WebGLSharedObject.cpp:171: // Checks the object belonngs
to this group.
On 2013/06/19 03:51:24, kbr wrote:
> Typo: belonngs

Done.

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
File Source/core/html/canvas/WebGLSharedObject.h (right):

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
Source/core/html/canvas/WebGLSharedObject.h:55: static bool
IntToAcquireMode(unsigned, AcquireMode*);
On 2013/06/19 03:51:24, kbr wrote:
> nit: I think Blink naming convention is intToAcquireMode.

Done.

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
Source/core/html/canvas/WebGLSharedObject.h:143: WebGLRenderingContext*
m_context;
On 2013/06/19 03:51:24, kbr wrote:
> How about a comment: // Weak, but context is kept alive strongly via
> m_sharedObject
> (if that's correct)?

Done.

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
File Source/core/html/canvas/WebGLSharedObject.idl (right):

https://codereview.chromium.org/17230006/diff/9001/Source/core/html/canvas/We...
Source/core/html/canvas/WebGLSharedObject.idl:26: interface WebGLSharedObject {
On 2013/06/19 20:30:00, kbr wrote:
> On 2013/06/19 05:57:38, Christophe Dumez wrote:
> > from your link
> >
(http://www.khronos.org/registry/webgl/extensions/WEBGL_shared_resources/%2529:
> > interface WebGLSharedObject : WebGLObject {
> > }
> > 
> > so I still don't understand why this doesn't inherit WebGLObject.
> 
> Thanks for pointing this out; I missed it in my review. It does look like a
> mistake.

Done.

Powered by Google App Engine
This is Rietveld 408576698