[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Purpose of WebGLObjectArray ?

On Fri, Jun 4, 2010 at 9:07 AM, Cedric Vivier <cedricv@neonux.com> wrote:
> On Fri, Jun 4, 2010 at 22:10, Chris Marrin <cmarrin@apple.com> wrote:
>> The semantics needs to be that a new array is created, filled and
>> returned.
> Yes that's what I assumed too, afaik this semantic is the one defined by T[
> ] not sequence<T>.
>> Seems like whether this is literally returned by value or by a reference
>> to a newly created object is a detail of the language binding.
> According to the WebIDL spec sequence<T> is always passed by value,
> difference might be subtle in Javascript but it certainly can have negative
> consequences (at least in other languages) because it involves unnecessary
> copying.
> In performance-sensitive methods like uniform*() it could be quite expensive
> to do so, e.g uniformMatrix4fv would copy 16 floats on the stack instead of
> just passing reference.
> Performance aside, sequence<T> is not allowed to be null (since by-value)
> whereas T[] is allowed to be null (since by-reference [1]), in WebGL we need
> the value returned to possibly be null when a GL error has been generated
> (or context is lost).
> [1] :  "The T[] type is a parameterized type whose values are (possibly
> zero-length) arrays of values of type T or the special value null."

Agreed, WebGLShader[] should be used here. The next (large) round of
specification changes will remove WebGLObjectArray and return
WebGLShader[] from getAttachedShaders.


You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: