summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/int64.glsl
blob: a2bec011e3e0771fd08afe11dc4a7999cf964342 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* Compile with:
 *
 * glsl_compiler --version 140 --dump-builder int64.glsl > builtin_int64.h
 *
 * Using version 1.40+ prevents built-in variables from being included.
 */
#version 140
#extension GL_MESA_shader_integer_functions: require

uvec2
umul64(uvec2 a, uvec2 b)
{
   uvec2 result;

   umulExtended(a.x, b.x, result.y, result.x);
   result.y += a.x * b.y + a.y * b.x;

   return result;
}

ivec2
sign64(ivec2 a)
{
   ivec2 result;

   result.y = a.y >> 31;
   result.x = result.y | int((a.x | a.y) != 0);

   return result;
}