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

Re: [Public WebGL] Shared resources between contexts



On Thu, Jan 5, 2012 at 1:53 PM, Kenneth Russell <kbr@google.com> wrote:
> On Thu, Jan 5, 2012 at 1:31 PM, David Sheets <kosmo.zb@gmail.com> wrote:
>> On Thu, Jan 5, 2012 at 1:11 PM, Chris Marrin <cmarrin@apple.com> wrote:
>>>
>>>
>>> On Jan 5, 2012, at 11:05 AM, Kenneth Russell wrote:
>>>
>>>>
>>>> On Thu, Jan 5, 2012 at 2:17 AM, Rehno Lindeque <rehno.lindeque@gmail.com> wrote:
>>>>>
>>>>> What happens if one calls getContext twice on the canvas with the same
>>>>> contextId but different arguments?
>>>>
>>>> The same WebGL context object that was created during the first call
>>>> to getContext() will be returned from the second call. The context
>>>> creation attributes will be ignored during the second call. See
>>>> http://www.khronos.org/registry/webgl/specs/latest/#2.2 , "The
>>>> WebGLContextAttributes object is only used on the first call to
>>>> getContext".
>>>
>>> I looked and didn't find any tests for this. We should add tests that ensure that multiple calls with different params return the same context.
>>
>> Why isn't getContext referentially transparent? If the same context
>> object must be returned, surely it is more intuitive to only return a
>> context if the attributes are compatible? If this constraint is
>> unfulfillable (say, because a previous context was generated with
>> differing parameters), shouldn't the result be a variant (null?) or
>> exception?
>
> This behavior was discussed at *great* length early in the development
> of the WebGL specification. The current semantics are compatible with
> Canvas's getContext specification, allow easier composition of
> libraries using WebGL and, I would argue, are the desired semantics
> for the majority of web developers.
>
>> Already I have wasted too much of my life debugging getContext calls
>> that return contexts that do not have the attributes I asked for.
>
> In this case you should make a habit of calling getContextAttributes()
> on the returned context and fail early if they do not satisfy your
> requirements.

Thanks for the tip. This prior discussion was also enlightening:
http://www.khronos.org/webgl/public-mailing-list/archives/1001/msg00206.html

> -Ken
>
>> David
>>
>>> -----
>>> ~Chris
>>> cmarrin@apple.com
>>>
>>>
>>>
>>>
>>>
>>> -----------------------------------------------------------
>>> 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:
>>> unsubscribe public_webgl
>>> -----------------------------------------------------------
>>>

-----------------------------------------------------------
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:
unsubscribe public_webgl
-----------------------------------------------------------