我正在编写一个框架,需要提供一些在 image2D 类型上定义的函数。
但要做到这一点似乎有点困难,而且我找不到任何有关将 an 传递image2D给函数的文档。
这是我的问题的一个最小示例:
#version 440
layout (local_size_x = 16, local_size_y = 16) in;
struct Test
{
bool empty;
};
// Version 1:
// fails with 0:11: '' : imageLoad function cannot access the image defined
// without layout format qualifier or with writeonly memory qualifier
float kernel1(image2D x, Test arg1){
return imageLoad(x, ivec2(1, 1)).x;
}
// Version 2:
// fails with ERROR: 0:16: 'Test' : syntax error syntax error
// doesn't fail without the …Run Code Online (Sandbox Code Playgroud)