art with code

2009-03-13

Canvas 3D high-priority tests done

Got through my list of high-priority tests. Next up is implementing the missing high-priority methods, writing tests for those, writing tests for getters, and adding int err = glGetError(); if (err != GL_NO_ERROR) return NS_ERROR_GL_JUST_BLEW_UP; to every method's tail.

I don't like gl.uniformf, gl.uniformi and gl.uniformMatrix. Thinking of replacing them with the typed versions. Why? Because uniformf et al have opaque semantics. You need to read the source to figure out how to use them correctly (and even then it's difficult to understand.) Plus renaming oft-used functions makes porting harder.

And, well, the less new code there is, the smaller the maintenance burden. And the less fancy logic there is, the fewer (possibly erroneous) assumptions you need to make. For example, should gl.uniformf(blur_kernel_7, [1,2,3,4,5,6,7]) work? How about gl.uniformf(vec4, [1,2,3,4,5,6,7])?

Using gl.uniform1fv(blur_kernel_7, [1,2,3,4,5,6,7]) and gl.uniform4fv(vec4, [1,2,3,4,5,6,7]) makes it clear what you're trying to do. And hopefully easier to catch the errors and give meaningful error messages.

List of tests I've got now, this should be all the nasty functions (sans the ones with no implementations, i.e. texSubImage2D[HTML] and copyTex[Sub]Image2D.)

== Methods that have tests ==

bufferData
+ with array
+ with bad args

bufferSubData
+ with array
+ with bad args

drawArrays
+ with vertex arrays
+ with buffers
+ with bad args

drawElements
+ with vertex arrays
+ with buffers
+ with bad args (oob count & offset, oob indices)

getImageData
+ normal
+ with GL canvas that has a non-SOP texture uploaded
+ bad args (coords outside viewport, zero size)

readPixels
+ normal
+ with GL canvas that has a non-SOP texture uploaded
+ bad args (coords outside viewport, zero size, bad type)

texImage2D
+ with NULL
+ with array of ints
+ with bad args (bad dims, bad type, bad border)

texImage2DHTML
+ with canvas
+ with img
+ with bad args (non-image element)
+ with non-SOP img
+ with non-SOP canvas (i.e. canvas with non-SOP img)

uniformf
+ with vec
+ with scalar
+ with OOB args
+ with bad uniform id

uniformi
+ with vec
+ with scalar
+ with OOB args
+ with bad uniform id

uniformMatrix
+ with 2x2, 3x3, 4x4 matrices
+ with OOB args
+ with bad uniform id

vertexAttrib
+ normal
+ with oob args
+ with bad attrib id

vertexAttribPointer
+ with array
+ with buffer offset
+ with bad offset
+ with bad attrib id
Post a Comment

Blog Archive

About Me

My photo

Built art installations, web sites, graphics libraries, web browsers, mobile apps, desktop apps, media player themes, many nutty prototypes, much bad code, much bad art.

Have freelanced for Verizon, Google, Mozilla, Warner Bros, Sony Pictures, Yahoo!, Microsoft, Valve Software, TDK Electronics.

Ex-Chrome Developer Relations.