[Mesa-dev] [PATCH v2 12/28] glsl/ir: Add builtin constant function support for doubles
Ilia Mirkin
imirkin at alum.mit.edu
Sat Feb 7 18:23:44 PST 2015
On Fri, Feb 6, 2015 at 3:02 AM, Ian Romanick <idr at freedesktop.org> wrote:
>> + case ir_unop_pack_double_2x32: {
>> + /* XXX needs to be checked on big-endian */
>
> I think this should just work. The spec says that the 32-bit values are
> little-endian:
>
> "The first vector component specifies the 32 least significant
> bits; the second component specifies the 32 most significant bits."
>
> On a little-endian system, you have a memcpy, and on big-endian it will
> be a 32-bit word swap... which is correct... I think...
>
>
>> + uint64_t temp;
>> + temp = (uint64_t)op[0]->value.u[0] | ((uint64_t)op[0]->value.u[1] << 32);
>> + data.d[0] = *(double *)&temp;
>> +
>> + break;
Yeah. But what endianness are those 32 most/least significant bits?
With a big endian CPU and little endian GPU? I put the XXX's there so
that it's clear that the code is potentially questionable after Matt
suggested it should always just do memcpy (which I think definitely
won't work on BE).
More information about the mesa-dev
mailing list