It seems samplers, image buffers and bindless graphics pointers cannot be placed in GLSL structs. This would be quite useful in the following situation where multiple complex structures need to be accessed by the same function:
struct MyStruct
{
layout(rgba32f) imageBuffer someData; //or vec4* someData
layout(rgba32f) imageBuffer someOtherData;
ivec2 size;
};
uniform MyStruct data1;
uniform MyStruct data2;
void OperateOnStruct(MyStruct d)
{
…
}
void main()
{
OperateOnStruct(data1);
OperateOnStruct(data2);
…
}
One dirty workaround might be to write a preprocessor and/or do something fancy with macros. Is there a nice way to handle this or is the solution just to have lots of duplicated variables with prefixes such as data1_someData, data1_someOtherData, data2_someData etc?
Any suggestions appreciated!