diff options
author | Ian Romanick <[email protected]> | 2016-10-17 13:55:27 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2017-01-20 15:41:23 -0800 |
commit | 6b03b345eb64e15e577bc8b2cf04b314a4c70537 (patch) | |
tree | b472924f541ee22c833aef886065c4410611814e /src/compiler/glsl/int64.glsl | |
parent | 6c3af043633997633d03e5409939263162076e81 (diff) |
glsl: Add "built-in" function for 64-bit integer sign()
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 | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/compiler/glsl/int64.glsl b/src/compiler/glsl/int64.glsl index f5fb01013c7..a2bec011e3e 100644 --- a/src/compiler/glsl/int64.glsl +++ b/src/compiler/glsl/int64.glsl @@ -17,3 +17,14 @@ umul64(uvec2 a, uvec2 b) 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; +} |