Skip to content

glsl: Prohibit implicit conversion of mem parameter in atomicOP functions

Per OpenGL Shading Language, section 8.11. "Atomic Memory Functions" first argument "mem" of all atomicOP functions is inout. The same is true for ARB_shader_storage_buffer_object and GL_INTEL_shader_atomic_float_minmax

For implicit conversion of inout parameters it is required for type to support bi-directional conversion, since there is no such types in glsl - implicit conversion is effectively prohibited.

Alternatively we could have marked atomic_var parameter of built-in atomicOP functions as inout, however it opens another can of worms during NIR lowerings.

Fixes: ea0a1f5b
Closes: #2837 (closed)

I'm not sure that adding another flag to use exactly in one place is the best approach. I've tried to make atomic_var in _atomic_op2 and _atomic_op3 inout, but while it fixes the issue on glsl level, lowerings in NIR are not happy about it (e.g. nir_lower_locals_to_regs doesn't handle nir_intrinsic_deref_atomic_* instructions).

Edited by Danylo Piliaiev

Merge request reports