diff options
author | Ian Romanick <[email protected]> | 2016-10-14 18:11:51 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2017-01-20 15:41:23 -0800 |
commit | 330fc2413c61f0bd9c7bb9f3a0ecd91b09de267a (patch) | |
tree | 9f6fa4014c98f04b40539b268a7be7a34c1b56a1 /src/compiler/glsl/int64.glsl | |
parent | aa38bf1e593eba3e65c4e10154410158d6d263c5 (diff) |
glsl: Add "built-in" functions to do 64x64 => 64 multiplication
These functions are directly available in shaders. A #define is added
to detect the presence. This allows these functions to be tested using
piglit regardless of whether the driver uses them for lowering. The
GLSL spec says that functions and macros beginning with __ are reserved
for use by the implementation... hey, that's us!
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/compiler/glsl/int64.glsl')
-rw-r--r-- | src/compiler/glsl/int64.glsl | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/compiler/glsl/int64.glsl b/src/compiler/glsl/int64.glsl new file mode 100644 index 00000000000..f5fb01013c7 --- /dev/null +++ b/src/compiler/glsl/int64.glsl @@ -0,0 +1,19 @@ +/* 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; +} |