glsl: move and reused code to find first and last shaders

Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
1 file changed