'GLSL big-endian/little-endian compatibility
In my pixel format, I have the following union (c++ end):
union
{
int mInteger;
struct
{
short mData1;
short mData2;
};
};
in GLSL I want to access whatever's in mData1... so I do this:
layout (location=4) in uint input_mInteger;
...
uint access_mData1=(input_mInteger&uint(0x0000FFFF));
// Do something with access_mData1...
My question is... will that work on both BigEndian and LittleEndian systems? Or will I have to switch my and mask to 0xFFFF0000 (and will it otherwise be the same code, or will I need to do even more work to access the value in the low word of mInteger?)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
