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 <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Ian Romanick
2016-10-14 18:11:51 -07:00
parent aa38bf1e59
commit 330fc2413c
9 changed files with 117 additions and 3 deletions

View File

@@ -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;
}