v3d: use inc/dec operations for add/sub of +1/-1

Alejandro Piñeiro requested to merge apinheiro/mesa:apinheiro/inc-dec into master

v3d hw include increase/decrease atomic operations, that could be used instead of atomic additions/substractions of value 1. Among other things it allows to remove the mov with the value to be added, as on such cases it is implicit on the operation.

From the GLSL point of view, this affects atomicCounterIncrement, atomicCounterDecrement, atomicAdd (with 1/-1 values) and imageAtomicAdd (ditto).

This improvement was mentioned on a source comment. This also mentions the possibility of a higher NIR support for this. But after checking it a little, that seemed as not needed. If we wanted to give some NIR support, one alternative would be to tweak nir_lower_atomics_to_ssbo, so it could detect those cases and keep/use the inc/dec intrinsics. But that seemed too much, as we can just detect that case with a small auxiliar method on the driver. That is what Intel already does.

Finally, a comment about shader-db stats: the shader-db set I have used those operations on OpenGL 4.X shaders. In general there isn't too many OpenGL ES shaders there. So I didn't get any improvement there. As a workaround, I used the shaders from vk-gl-cts. Those are not real usage shaders, but at least, would provide some guidance if this improvements some shaders or not.

Merge request reports