Closed
Bug 1167504
Opened 9 years ago
Closed 9 years ago
Clean up binding of WebGL objects
Categories
(Core :: Graphics: CanvasWebGL, defect)
Core
Graphics: CanvasWebGL
Tracking
()
RESOLVED
FIXED
mozilla41
Tracking | Status | |
---|---|---|
firefox41 | --- | fixed |
People
(Reporter: u480271, Assigned: u480271)
References
Details
(Whiteboard: [gfx-noted])
Attachments
(13 files, 1 obsolete file)
4.97 KB,
patch
|
jgilbert
:
review+
|
Details | Diff | Splinter Review |
4.02 KB,
patch
|
jgilbert
:
review+
|
Details | Diff | Splinter Review |
3.55 KB,
patch
|
jgilbert
:
review+
|
Details | Diff | Splinter Review |
7.58 KB,
patch
|
jgilbert
:
review+
|
Details | Diff | Splinter Review |
3.43 KB,
patch
|
jgilbert
:
review+
|
Details | Diff | Splinter Review |
2.91 KB,
patch
|
jgilbert
:
review+
|
Details | Diff | Splinter Review |
6.46 KB,
patch
|
jgilbert
:
review+
|
Details | Diff | Splinter Review |
2.00 KB,
patch
|
jgilbert
:
review+
|
Details | Diff | Splinter Review |
22.65 KB,
patch
|
jgilbert
:
review+
|
Details | Diff | Splinter Review |
6.59 KB,
patch
|
jgilbert
:
review+
|
Details | Diff | Splinter Review |
2.78 KB,
patch
|
jgilbert
:
review+
|
Details | Diff | Splinter Review |
7.91 KB,
patch
|
jgilbert
:
review+
|
Details | Diff | Splinter Review |
3.86 KB,
patch
|
jgilbert
:
review+
|
Details | Diff | Splinter Review |
WebGL and GL objects are bound to binding points. WebGL2 spec contains language about what this means with the addition of new buffer binding points.
Remove WebGLBindableName. I created it for a situation that never really eventuated. Also, fix up the buffer binding logic to handle `Undefined`, `Element Data`, and `Other Data'.
Attachment #8609945 -
Flags: review?(jgilbert)
Attachment #8609946 -
Flags: review?(jgilbert)
Attachment #8609947 -
Flags: review?(jgilbert)
Attachment #8609948 -
Flags: review?(jgilbert)
Attachment #8609949 -
Flags: review?(jgilbert)
Attachment #8609951 -
Flags: review?(jgilbert)
Attachment #8609952 -
Flags: review?(jgilbert)
Attachment #8609953 -
Flags: review?(jgilbert)
Assignee | ||
Comment 10•9 years ago
|
||
Checked against http://www.khronos.org/registry/webgl/sdk/tests/conformance2/buffers/
Attachment #8609954 -
Flags: review?(jgilbert)
Assignee | ||
Comment 11•9 years ago
|
||
Looks like Linux is why we can't have nice things. https://treeherder.mozilla.org/#/jobs?repo=try&revision=d96c3d09c072
Assignee | ||
Comment 12•9 years ago
|
||
Attachment #8610377 -
Flags: review?(jgilbert)
Comment 13•9 years ago
|
||
Comment on attachment 8609946 [details] [diff] [review] Part 2: Remove BindableName - Renderbuffer. Review of attachment 8609946 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/canvas/WebGLContextGL.cpp @@ +1718,5 @@ > + if (rb->IsDeleted()) > + return false; > + > + MakeContextCurrent(); > + return gl->fIsRenderbuffer(rb->PrimaryGLName()); Unfortunately: https://bugzilla.mozilla.org/show_bug.cgi?id=1140459 Some drivers (including our test slaves!) don't give reasonable answers for IsRenderbuffer, maybe others. What should we do? This is a silly entrypoint anyway, so honestly leaving it broken on rarer platforms would probably be acceptable. That said, it's not a ton of work to fix. I'm going to r+ this, but let's leave a comment with a reference to the bug (and bug number) I mentioned. We can see if the conformance test results are too unacceptable this way.
Attachment #8609946 -
Flags: review?(jgilbert) → review+
Updated•9 years ago
|
Attachment #8609945 -
Flags: review?(jgilbert) → review+
Comment 14•9 years ago
|
||
Comment on attachment 8609947 [details] [diff] [review] Part 3: Remove BindableName - Sampler. Review of attachment 8609947 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/canvas/WebGLSampler.h @@ +37,5 @@ > > private: > ~WebGLSampler(); > + > + GLuint mGLName; Just make this public and const.
Attachment #8609947 -
Flags: review?(jgilbert) → review+
Comment 15•9 years ago
|
||
Comment on attachment 8609948 [details] [diff] [review] Part 4: Remove BindableName - Texture. Review of attachment 8609948 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/canvas/WebGLTexture.h @@ +42,5 @@ > > + bool HasEverBeenBound() const { return mTarget != LOCAL_GL_NONE; } > + GLuint GLName() const { return mGLName; } > + GLenum Target() const { return mTarget; } > + Whitespace!
Attachment #8609948 -
Flags: review?(jgilbert) → review+
Updated•9 years ago
|
Attachment #8609949 -
Flags: review?(jgilbert) → review+
Updated•9 years ago
|
Attachment #8609951 -
Flags: review?(jgilbert) → review+
Updated•9 years ago
|
Attachment #8609952 -
Flags: review?(jgilbert) → review+
Updated•9 years ago
|
Attachment #8609953 -
Flags: review?(jgilbert) → review+
Updated•9 years ago
|
Attachment #8610377 -
Flags: review?(jgilbert) → review+
Assignee | ||
Comment 16•9 years ago
|
||
(In reply to Jeff Gilbert [:jgilbert] from comment #13) > Unfortunately: > https://bugzilla.mozilla.org/show_bug.cgi?id=1140459 > > Some drivers (including our test slaves!) don't give reasonable answers for > IsRenderbuffer, maybe others. Yep. Linux also fails. This is why I said "Looks like Linux is why we can't have nice things" in comment 11. :-( > What should we do? > This is a silly entrypoint anyway, so honestly leaving it broken on rarer > platforms would probably be acceptable. That said, it's not a ton of work to > fix. I'll fix it up, like I had to do for the FakeVAOs. I'll #ifdef it for linux and android (or is it gonk?)
Comment 17•9 years ago
|
||
(In reply to Dan Glastonbury :djg :kamidphish from comment #16) > (In reply to Jeff Gilbert [:jgilbert] from comment #13) > > Unfortunately: > > https://bugzilla.mozilla.org/show_bug.cgi?id=1140459 > > > > Some drivers (including our test slaves!) don't give reasonable answers for > > IsRenderbuffer, maybe others. > > Yep. Linux also fails. This is why I said "Looks like Linux is why we can't > have nice things" in comment 11. :-( > > > What should we do? > > This is a silly entrypoint anyway, so honestly leaving it broken on rarer > > platforms would probably be acceptable. That said, it's not a ton of work to > > fix. > > I'll fix it up, like I had to do for the FakeVAOs. I'll #ifdef it for linux > and android (or is it gonk?) It's specifically the AndroidEmulator driver. Check the other bug.
Comment 18•9 years ago
|
||
Comment on attachment 8609954 [details] [diff] [review] Part 9: Clean up buffer binding constraints. Review of attachment 8609954 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/canvas/WebGL2ContextBuffers.cpp @@ +118,5 @@ > + WebGLBuffer::ContentKind readType = readBuffer->Content(); > + WebGLBuffer::ContentKind writeType = writeBuffer->Content(); > + > + if (readType != WebGLBuffer::Undefined && > + writeType != WebGLBuffer::Undefined && Can these really be Undefined that this point? ::: dom/canvas/WebGLBuffer.h @@ +25,5 @@ > , public WebGLContextBoundObject > { > public: > + > + enum ContentKind { Strong enums please. WebGLBuffer::ContentKind::Undefined is long, but makes far more sense than WebGLBuffer::Undefined. We're probably fine with s/ContentKind/Kind/ this way, too. ::: dom/canvas/WebGLContextBuffers.cpp @@ +417,5 @@ > { > if (IsContextLost()) > return false; > > + Tame your editor! @@ +452,5 @@ > + * ELEMENT_ARRAY_BUFFER will generate an INVALID_OPERATION error, > + * and the state of the binding point will remain untouched. > + */ > + > + GLenum boundTo = IsBound(buffer); It's weird that IsBound does not return bool.
Attachment #8609954 -
Flags: review?(jgilbert) → review+
Assignee | ||
Comment 19•9 years ago
|
||
Attachment #8611118 -
Flags: review?(jgilbert)
Assignee | ||
Comment 20•9 years ago
|
||
Attachment #8611120 -
Flags: review?(jgilbert)
Assignee | ||
Comment 21•9 years ago
|
||
Try - https://treeherder.mozilla.org/#/jobs?repo=try&revision=f6e2c533b6f9
Assignee | ||
Comment 22•9 years ago
|
||
(In reply to Jeff Gilbert [:jgilbert] from comment #18) > Comment on attachment 8609954 [details] [diff] [review] > Part 9: Clean up buffer binding constraints. > > Review of attachment 8609954 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: dom/canvas/WebGL2ContextBuffers.cpp > @@ +118,5 @@ > > + WebGLBuffer::ContentKind readType = readBuffer->Content(); > > + WebGLBuffer::ContentKind writeType = writeBuffer->Content(); > > + > > + if (readType != WebGLBuffer::Undefined && > > + writeType != WebGLBuffer::Undefined && > > Can these really be Undefined that this point? According the conformance test suite, yes. You can create a buffer, bind it to COPY_READ_BUFFER, bufferData to it and the contents is `undefined` until it's bound to a binding point that defines the contents type as `element data` or `other data`. > ::: dom/canvas/WebGLBuffer.h > @@ +25,5 @@ > > , public WebGLContextBoundObject > > { > > public: > > + > > + enum ContentKind { > > Strong enums please. WebGLBuffer::ContentKind::Undefined is long, but makes > far more sense than WebGLBuffer::Undefined. > > We're probably fine with s/ContentKind/Kind/ this way, too. OK. > ::: dom/canvas/WebGLContextBuffers.cpp > @@ +417,5 @@ > > { > > if (IsContextLost()) > > return false; > > > > + > > Tame your editor! Ugh. That's what I get for working on Windows. > > + GLenum boundTo = IsBound(buffer); > > It's weird that IsBound does not return bool. I was having a mental block on naming. How about `IsBoundTo` or `BoundTo`. I thought boundTo = BoundTo(...) was too repetitive.
Comment 23•9 years ago
|
||
(In reply to Dan Glastonbury :djg :kamidphish from comment #22) > (In reply to Jeff Gilbert [:jgilbert] from comment #18) > > Comment on attachment 8609954 [details] [diff] [review] > > Part 9: Clean up buffer binding constraints. > > > > Review of attachment 8609954 [details] [diff] [review]: > > ----------------------------------------------------------------- > > > > ::: dom/canvas/WebGL2ContextBuffers.cpp > > @@ +118,5 @@ > > > + WebGLBuffer::ContentKind readType = readBuffer->Content(); > > > + WebGLBuffer::ContentKind writeType = writeBuffer->Content(); > > > + > > > + if (readType != WebGLBuffer::Undefined && > > > + writeType != WebGLBuffer::Undefined && > > > > Can these really be Undefined that this point? > > According the conformance test suite, yes. > > You can create a buffer, bind it to COPY_READ_BUFFER, bufferData to it and > the contents is `undefined` until it's bound to a binding point that defines > the contents type as `element data` or `other data`. Oh, cool. > > > ::: dom/canvas/WebGLBuffer.h > > @@ +25,5 @@ > > > , public WebGLContextBoundObject > > > { > > > public: > > > + > > > + enum ContentKind { > > > > Strong enums please. WebGLBuffer::ContentKind::Undefined is long, but makes > > far more sense than WebGLBuffer::Undefined. > > > > We're probably fine with s/ContentKind/Kind/ this way, too. > > OK. > > > > ::: dom/canvas/WebGLContextBuffers.cpp > > @@ +417,5 @@ > > > { > > > if (IsContextLost()) > > > return false; > > > > > > + > > > > Tame your editor! > > Ugh. That's what I get for working on Windows. Just VS! I actually use Geany for my basic editing needs, and it happily strips EOL whitespace. Notepad++ also does this. > > > > + GLenum boundTo = IsBound(buffer); > > > > It's weird that IsBound does not return bool. > > I was having a mental block on naming. How about `IsBoundTo` or `BoundTo`. I > thought boundTo = BoundTo(...) was too repetitive. Since it returns the bind point enum (if any), why not Get(Cur)BindPoint?
Comment 24•9 years ago
|
||
Comment on attachment 8611118 [details] [diff] [review] Work around Linux test slave driver bugs. Review of attachment 8611118 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/canvas/WebGLVertexArrayGL.cpp @@ +61,5 @@ > + gl->Vendor() == gl::GLVendor::VMware && > + gl->Renderer() == gl::GLRenderer::GalliumLlvmpipe) > + { > + return mIsVAO; > + } else { No need for else after return, so just fall through to the non-ifdef'd code.
Attachment #8611118 -
Flags: review?(jgilbert) → review+
Comment 25•9 years ago
|
||
Comment on attachment 8611120 [details] [diff] [review] Emulate fIsFramebuffer and fIsRenderbuffer for Android 2.3 emulator. Review of attachment 8611120 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/canvas/WebGLContextGL.cpp @@ +160,5 @@ > gl->fBindFramebuffer(target, 0); > } else { > GLuint framebuffername = wfb->GLName(); > gl->fBindFramebuffer(target, framebuffername); > +#if ANDROID_VERSION >= 9 && ANDROID_VERSION < 11 This same conditional is all over, and *needs* to match. This seems fragile. I think we should make a define specifically for this, and just reference that define everywhere we need to. @@ +1703,5 @@ > + if (gl->WorkAroundDriverBugs() && > + gl->Renderer() == GLRenderer::AndroidEmulator) > + { > + return fb->mIsFB; > + } else { Again, no need for this block. Just let control fall out of the ifdef block to the normal code.
Attachment #8611120 -
Flags: review?(jgilbert) → review-
Assignee | ||
Comment 26•9 years ago
|
||
Attachment #8611120 -
Attachment is obsolete: true
Attachment #8612086 -
Flags: review?(jgilbert)
Updated•9 years ago
|
Attachment #8612086 -
Flags: review?(jgilbert) → review+
Assignee | ||
Comment 27•9 years ago
|
||
Greened up all GL mochitests - https://treeherder.mozilla.org/#/jobs?repo=try&revision=e7e54bd66eec
Assignee | ||
Comment 28•9 years ago
|
||
Attachment #8613346 -
Flags: review?(jgilbert)
Updated•9 years ago
|
Attachment #8613346 -
Flags: review?(jgilbert) → review+
Comment 29•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/05ac4287dd79 https://hg.mozilla.org/integration/mozilla-inbound/rev/49332df2f830 https://hg.mozilla.org/integration/mozilla-inbound/rev/db0c0147c7fb https://hg.mozilla.org/integration/mozilla-inbound/rev/8f4e5ac93a6b https://hg.mozilla.org/integration/mozilla-inbound/rev/0696e1f508f3 https://hg.mozilla.org/integration/mozilla-inbound/rev/3b85d8441047 https://hg.mozilla.org/integration/mozilla-inbound/rev/d71cc076307e https://hg.mozilla.org/integration/mozilla-inbound/rev/5756b0cdb987 https://hg.mozilla.org/integration/mozilla-inbound/rev/f8e64b23ba88 https://hg.mozilla.org/integration/mozilla-inbound/rev/8facb61cae2e https://hg.mozilla.org/integration/mozilla-inbound/rev/a3943eb0e176 https://hg.mozilla.org/integration/mozilla-inbound/rev/46b3c9ba493f
Comment 30•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/05ac4287dd79 https://hg.mozilla.org/mozilla-central/rev/49332df2f830 https://hg.mozilla.org/mozilla-central/rev/db0c0147c7fb https://hg.mozilla.org/mozilla-central/rev/8f4e5ac93a6b https://hg.mozilla.org/mozilla-central/rev/0696e1f508f3 https://hg.mozilla.org/mozilla-central/rev/3b85d8441047 https://hg.mozilla.org/mozilla-central/rev/d71cc076307e https://hg.mozilla.org/mozilla-central/rev/5756b0cdb987 https://hg.mozilla.org/mozilla-central/rev/f8e64b23ba88 https://hg.mozilla.org/mozilla-central/rev/8facb61cae2e https://hg.mozilla.org/mozilla-central/rev/a3943eb0e176 https://hg.mozilla.org/mozilla-central/rev/46b3c9ba493f
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox41:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in
before you can comment on or make changes to this bug.
Description
•