GLSL大型/小型兼容性
以我的像素格式,我有以下联盟(C ++结束):
union
{
int mInteger;
struct
{
short mData1;
short mData2;
};
};
在GLSL中,我想访问MDATA1中的任何内容...所以我这样做:
layout (location=4) in uint input_mInteger;
...
uint access_mData1=(input_mInteger&uint(0x0000FFFF));
// Do something with access_mData1...
我的问题是...这对Bigendian和Littleendian Systems都可以使用吗?还是我必须将我的和掩码切换到0xffff0000(否则它将是相同的代码,还是我需要做更多的工作以访问Minteger低音的值?)
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?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论