glsl: fix return value for subgroupBallot()

The original code attempted to create a second instance of the intrinsic
with only a different return value which isn't possible since the params
(in this case 0 params) are the same. To fix this were need to create
two differently named intrinsics.

Reviewed-by: Qiang Yu <yuq825@gmail.com>

Fixes: a496d84ac88e ("glsl: add KHR_shader_subgroup_ballot builtin functions")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12510
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33231>
diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp
index 11cdb7a..7c3b426 100644
--- a/src/compiler/glsl/builtin_functions.cpp
+++ b/src/compiler/glsl/builtin_functions.cpp
@@ -1938,8 +1938,11 @@
                 FIUBD_AVAIL(_vote_intrinsic, vote_or_v460_desktop, ir_intrinsic_vote_eq),
                 NULL);
 
-   add_function("__intrinsic_ballot",
+   add_function("__intrinsic_ballot_uint64",
                 _ballot_intrinsic(&glsl_type_builtin_uint64_t),
+                NULL);
+
+   add_function("__intrinsic_ballot_uvec4",
                 _ballot_intrinsic(&glsl_type_builtin_uvec4),
                 NULL);
 
@@ -9012,8 +9015,14 @@
    MAKE_SIG(type, avail, 1, value);
    ir_variable *retval = body.make_temp(type, "retval");
 
-   body.emit(call(symbols->get_function("__intrinsic_ballot"),
-                  retval, sig->parameters));
+   if (type == &glsl_type_builtin_uint64_t) {
+      body.emit(call(symbols->get_function("__intrinsic_ballot_uint64"),
+                     retval, sig->parameters));
+   } else {
+      assert(type == &glsl_type_builtin_uvec4);
+      body.emit(call(symbols->get_function("__intrinsic_ballot_uvec4"),
+                     retval, sig->parameters));
+   }
    body.emit(ret(retval));
    return sig;
 }