-
Notifications
You must be signed in to change notification settings - Fork 353
Description
What are the restrictions on function parameters?
We can have different rules between builtin functions and user-written functions.
Regarding pointer arguments:
In SPIR-V for Vulkan, a pointer operand to a function must be into one of the following storage classes: UniformConstant, Function, Private, Workgroup. So no UBO or SSBO pointers are allowed.
In recent discussion @kvark recalled that we had already decided to disallow passing textures and samplers as function parameters (and also pointers-to-these-things).
GLSL allows opaque types to be "in" parameters to functions. However, I've found some concerning behaviour (a.k.a. a bug?) for passing a formatted write-only storage image into a user-defined helper function. See KhronosGroup/glslang#2415
I want to avoid any workaround that requires inlining the called function.
So I would much prefer for WGSL to disallow textures and samplers (or pointers to them) to be passed into user-defined functions.