Closed Bug 812121 Opened 13 years ago Closed 13 years ago

DrawArrays and DrawElements don't allow drawing without using vertex attrib arrays

Categories

(Core :: Graphics: CanvasWebGL, defect)

defect
Not set
major

Tracking

()

RESOLVED FIXED
mozilla20
Tracking Status
firefox19 --- verified
firefox20 --- verified

People

(Reporter: jgilbert, Assigned: jgilbert)

Details

(Whiteboard: webgl-conformance webgl-test-needed)

Attachments

(2 files, 4 obsolete files)

Ran into this checking out someone's example which wasn't working in Firefox. This isn't a common usecase, but there doesn't seem to be anything wrong with it. Non-array vertex attribs are used for all vertexes, effectively becoming uniforms. When we don't have any active attrib arrays, we return -1 as the 'max length'. However, we don't check for this case, so naturally we throw a buffer-too-small error.
Attached file testcase
Attached patch patch (obsolete) — Splinter Review
Attachment #681910 - Flags: review?(bjacob)
This really really needs a test in the conformance suite.
Then it is webgl-test-needed! (comment 3) And webgl-conformance (comment 0)
Whiteboard: webgl-conformance webgl-test-needed
Comment on attachment 681910 [details] [diff] [review] patch Review of attachment 681910 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/canvas/src/WebGLContextGL.cpp @@ +1428,5 @@ > return ErrorInvalidOperation("drawArrays: overflow in first+count"); > > + // A maxAllowedCount of -1 means unlimited. (No attrib arrays) > + // If we have any attribs at all, they're all non-array. > + if (maxAllowedCount >= 0) { Just have maxAllowedCount be INT32_MAX in that case so there is no need for special-casing.
Attachment #681910 - Flags: review?(bjacob)
Attached patch patch (obsolete) — Splinter Review
Here it is using INT32_MAX instead.
Attachment #681910 - Attachment is obsolete: true
Attachment #682355 - Flags: review?(bjacob)
Comment on attachment 682355 [details] [diff] [review] patch Review of attachment 682355 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/canvas/src/WebGLContextValidate.cpp @@ +137,5 @@ > } > + > + if (*maxAllowedCount == -1) { > + *maxAllowedCount = INT32_MAX; > + } I'd prefer if you took out the whole -1 thing and replaced it by INT32_MAX in place.
Attachment #682355 - Flags: review?(bjacob) → review-
Attached patch patch (obsolete) — Splinter Review
How about this?
Attachment #682355 - Attachment is obsolete: true
Attachment #683086 - Flags: review?(bjacob)
Attachment #683086 - Attachment is patch: true
Comment on attachment 683086 [details] [diff] [review] patch Review of attachment 683086 [details] [diff] [review]: ----------------------------------------------------------------- Sorry, r- because this is really important: ::: content/canvas/src/WebGLContext.h @@ +1169,5 @@ > int32_t mGLMaxVertexUniformVectors; > > // Cache the max number of elements that can be read from bound VBOs > // (result of ValidateBuffers). > + bool mMinInUseAttribArrayLengthCached; This new member needs to be initialized by the constructor, right?
Attachment #683086 - Flags: review?(bjacob) → review-
Attached patch patch (obsolete) — Splinter Review
We didn't seem to initialize the previous value we used for this, so it's probably buried somewhere. I added the vars to the constructor, though.
Attachment #683086 - Attachment is obsolete: true
Attachment #683090 - Flags: review?(bjacob)
Comment on attachment 683090 [details] [diff] [review] patch Review of attachment 683090 [details] [diff] [review]: ----------------------------------------------------------------- R+ provided that the following issue is not causing new signed-unsigned-comparison warnings: ::: content/canvas/src/WebGLContextValidate.cpp @@ +68,5 @@ > * that will be legal to be read from bound VBOs. > */ > > bool > +WebGLContext::ValidateBuffers(uint32_t *maxAllowedCount, const char *info) Decide: either uint32_t everywhere (so mMinInUseAttribArrayLengthCached becomes uint32_t, and it's UINT32_MAX) or int32_t everywhere. As we plan to allow uint32 elements, I suppose that uint32 makes sense.
Attachment #683090 - Flags: review?(bjacob) → review+
Attached patch patchSplinter Review
Carrying forward r+.
Attachment #683090 - Attachment is obsolete: true
Attachment #683115 - Flags: review+
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
Comment on attachment 683115 [details] [diff] [review] patch [Approval Request Comment] Bug caused by (feature/regressing bug #): Long-standing bug. User impact if declined: Some basic WebGL tutorials and examples will fail to work with Firefox. Testing completed (on m-c, etc.): On m-c. Risk to taking this patch (and alternatives if risky): Low risk. The code here is fairly simple, and we're working with CheckedInts anyways. String or UUID changes made by this patch: None.
Attachment #683115 - Flags: approval-mozilla-aurora?
Comment on attachment 683115 [details] [diff] [review] patch Fast tracking this low risk fix since this sounds like a bit of a WebGL black eye.
Attachment #683115 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Verified the issue with testcase from comment 1 on 2012-11-15 Nightly Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/19.0 Firefox/19.0 Build ID: 20121115030705 Verified the fix for Firefox 19.0 beta 3 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0 Build ID: 20130123083802 The black rectangle from 2012-11-15 Nightly contains a small green rectangle in Firefox 19.0 beta 3.
Verified fix for Firefox 20.0 beta 1 (20130220104816) on Windows 7 x64 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: