Closed NicolBolas closed 5 years ago
See https://github.com/KhronosGroup/GLSL/issues/57. I think it was left as "You currently can't use layouts on function parameters, but somebody could write an extension to add it".
Closing since this is covered by KhronosGroup/GLSL#57.
GLSL has a pretty strong statement that layout qualifiers are not allowed on formal parameters.
That seems pretty ironclad. However, the GLSL specification has several places in it that implies strongly that image variables can have format layout qualifiers:
Note that there is no statement exempting parameters, which are still (I think?) variable declarations.
Furthermore:
That too strongly implies the ability to apply layout qualifiers to function parameters. The reason being that image load/atomic operations require layout qualifiers on the variable they're used on. So without being able to put layout qualifiers on formal parameters, you would be unable to use image load/atomic operations on them.
Also, I skimmed through ARB_bindless_texture, and I didn't find a place that explicitly rescinded the prohibition from the first quote (the quote is from section 4.10, which bindless_texture doesn't touch). Which means you can't work with them there either. My guess is that the writers of that extension assumed that it was already legal.
In ARB_image_load_store, there was some disagreement or confusion about the issue. Directly before the statement quoted at the top is a code example that uses
layout
qualifiers in formal parameters. When the text was moved to GLSL 4.20, thoselayout
qualifiers disappeared.So... what's going on here? Is the intent of the spec to not allow users to use image load/atomic operations on image variables passed through function parameters? If so, then ARB_bindless_texture needs to be updated to allow it (presumably?). And if not, then GLSL itself needs to be changed to correct this.