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:
19
src/compiler/glsl/int64.glsl
Normal file
19
src/compiler/glsl/int64.glsl
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user