From 330fc2413c61f0bd9c7bb9f3a0ecd91b09de267a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 14 Oct 2016 18:11:51 -0700 Subject: 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 Reviewed-by: Matt Turner --- src/compiler/glsl/int64.glsl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/compiler/glsl/int64.glsl (limited to 'src/compiler/glsl/int64.glsl') 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; +} -- cgit v1.2.3