Hi, I would like to pass a struct contained in a shader storage buffer to a function and perform some atomic additions on a uint member of the struct. However the shader won’t compile because:
A shader will fail to compile if the value passed to the mem argument of an atomic memory function does not correspond to a buffer or shared variable
I was wondering if there’s some variable qualifier to enforce a function parameter to be backed by a buffer. As far as I know in, out, inout and const in are the only available parameter qualifiers, but maybe I’m missing something here.
EDIT:
Actually, thinking about how GLSL functions copy arguments in and out, I’m guessing it’s not possible, is it?
I’m curious which one isn’t just inlining the function and automatically realizing what inputs back the function arguments?
Also, could you post a short shader that illustrates the problem? I (and maybe others too) would be interested in compiling it on a few drivers to see what behavior I get here.
Is explicitly not allowed by the rules of GLSL, even if you call it by passing in a SomeStruct member of a buffer variable. Inlining cannot change those rules.