This is highly hardware dependent. Traditionally, many GPUs would always operate on vectors, even if just a scalar operation (i.e. one component) was needed. It's still possible that clever compiler optimizations could pack several scalar operations into one vector operation. But fundamentally, on this type of architecture, using only one component will not reduce the number of operations.
Partly based on GPUs being used for much more than traditional graphics (compute), architectures that can handle scalar operations more efficiently are becoming increasingly common.
So using operations on vec3
values if you in fact need only one component could be anywhere between the same processing time and 3 times the processing time. Chances are that if you measure on a wide variety of GPUs, you could find results close to both of these extremes.
texture().r
andtexture().rgb
would have exactly the same cost. – Dan