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

Re: [Public WebGL] Defining GLintptr and GLsizeiptr as long long is incompatible with GLES2 on 32-bit systems



On 13-09-02 10:18 AM, Benoit Jacob wrote:
> On 13-09-02 06:56 AM, Olli Etuaho wrote:
>> Hi all,
>>
>> WebGL defines GLintptr and GLsizeiptr to always be 64-bit, but in GLES2 they can actually be either 32-bit or 64-bit depending on the platform. And in practice Chrome and Firefox treat for example bufferData GLsizeiptr size parameter as 32-bit (tested on latest 64-bit stable versions on Linux).
> That sounds like an interesting bug, could you please provide a
> testcase? I'm looking at Gecko code now, WebGLContext::BufferData takes
> a WebGLintptr which is a typedef for int64_t, so I don't see a bug out
> of hand.
>
>>  It would seem like changing the spec to define pointer values as 32-bit would make sense for compatibility.
> That would indeed improve compatibility by preventing taking advantage
> of the extra memory available on 64-bit systems. But that's not really
> how everything else works; everything else not just in WebGL but
> generally around JavaScript allows taking advantage of all the memory
> available on the client system, e.g. you can create a TypedArray bigger
> than 4G.
My bad, the typed arrays spec actually says that the byteLength of an
ArrayBuffer is unsigned long, so the above example is wrong.

Still, many other things in the Web platform don't enforce a 4G byte
limit. For example, ordinary JS arrays can have 4G elements, which is
more than 4G bytes.

Benoit

>
> Benoit
>
>>  The obvious downside is that buffers would be limited to 2GB, but this should not at least break existing applications. Any potential practical application of >2GB buffers in WebGL is still probably years away as well. Should the spec be changed, or are there any other ideas how this could be handled?
>>
>> Reference below.
>>
>> WebGL spec:
>> typedef long long      GLintptr;
>> typedef long long      GLsizeiptr;
>>
>> WebIDL spec:
>> The long long type is a signed integer type that has values in the range [−9223372036854775808, 9223372036854775807]. 
>>
>> gl2.h:
>> typedef khronos_intptr_t GLintptr;
>> typedef khronos_ssize_t  GLsizeiptr;
>>
>> khrplatform.h (signed long int is typically 32-bit on 32-bit platforms, and typically 64-bit on 64-bit platforms):
>> typedef signed   long  int     khronos_intptr_t;
>> typedef signed   long  int     khronos_ssize_t;
>>
>> -Olli Etuahob����.����\����&�v�)��bs��Y!��貊�N�����r��zǧu�ޙ�������ݢj$��'��+����^~�e����&��݊{ay�ʇ��ޙ���{.n�+�����bs�gl==
>
> -----------------------------------------------------------
> 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
-----------------------------------------------------------