From 44d3287ecd8b81a30a51613cd578dd31a115d820 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Tue, 9 Apr 2013 16:03:15 -0700 Subject: glsl: Add new bit built-ins IR and prototypes from ARB_gpu_shader5. Reviewed-by: Chris Forbes --- src/glsl/builtins/ir/bitCount.ir | 41 +++++++++++++++++++++ src/glsl/builtins/ir/bitfieldExtract.ir | 57 +++++++++++++++++++++++++++++ src/glsl/builtins/ir/bitfieldInsert.ir | 65 +++++++++++++++++++++++++++++++++ src/glsl/builtins/ir/bitfieldReverse.ir | 41 +++++++++++++++++++++ src/glsl/builtins/ir/findLSB.ir | 41 +++++++++++++++++++++ src/glsl/builtins/ir/findMSB.ir | 41 +++++++++++++++++++++ 6 files changed, 286 insertions(+) create mode 100644 src/glsl/builtins/ir/bitCount.ir create mode 100644 src/glsl/builtins/ir/bitfieldExtract.ir create mode 100644 src/glsl/builtins/ir/bitfieldInsert.ir create mode 100644 src/glsl/builtins/ir/bitfieldReverse.ir create mode 100644 src/glsl/builtins/ir/findLSB.ir create mode 100644 src/glsl/builtins/ir/findMSB.ir (limited to 'src/glsl/builtins/ir') diff --git a/src/glsl/builtins/ir/bitCount.ir b/src/glsl/builtins/ir/bitCount.ir new file mode 100644 index 00000000000..71fcae2db1a --- /dev/null +++ b/src/glsl/builtins/ir/bitCount.ir @@ -0,0 +1,41 @@ +((function bitCount + (signature int + (parameters + (declare (in) int value)) + ((return (expression int bit_count (var_ref value))))) + + (signature ivec2 + (parameters + (declare (in) ivec2 value)) + ((return (expression ivec2 bit_count (var_ref value))))) + + (signature ivec3 + (parameters + (declare (in) ivec3 value)) + ((return (expression ivec3 bit_count (var_ref value))))) + + (signature ivec4 + (parameters + (declare (in) ivec4 value)) + ((return (expression ivec4 bit_count (var_ref value))))) + + (signature int + (parameters + (declare (in) uint value)) + ((return (expression int bit_count (var_ref value))))) + + (signature ivec2 + (parameters + (declare (in) uvec2 value)) + ((return (expression ivec2 bit_count (var_ref value))))) + + (signature ivec3 + (parameters + (declare (in) uvec3 value)) + ((return (expression ivec3 bit_count (var_ref value))))) + + (signature ivec4 + (parameters + (declare (in) uvec4 value)) + ((return (expression ivec4 bit_count (var_ref value))))) +)) diff --git a/src/glsl/builtins/ir/bitfieldExtract.ir b/src/glsl/builtins/ir/bitfieldExtract.ir new file mode 100644 index 00000000000..0491c82180b --- /dev/null +++ b/src/glsl/builtins/ir/bitfieldExtract.ir @@ -0,0 +1,57 @@ +((function bitfieldExtract + (signature int + (parameters + (declare (in) int value) + (declare (in) int offset) + (declare (in) int bits)) + ((return (expression int bitfield_extract (var_ref value) (var_ref offset) (var_ref bits))))) + + (signature ivec2 + (parameters + (declare (in) ivec2 value) + (declare (in) int offset) + (declare (in) int bits)) + ((return (expression ivec2 bitfield_extract (var_ref value) (var_ref offset) (var_ref bits))))) + + (signature ivec3 + (parameters + (declare (in) ivec3 value) + (declare (in) int offset) + (declare (in) int bits)) + ((return (expression ivec3 bitfield_extract (var_ref value) (var_ref offset) (var_ref bits))))) + + (signature ivec4 + (parameters + (declare (in) ivec4 value) + (declare (in) int offset) + (declare (in) int bits)) + ((return (expression ivec4 bitfield_extract (var_ref value) (var_ref offset) (var_ref bits))))) + + (signature uint + (parameters + (declare (in) uint value) + (declare (in) int offset) + (declare (in) int bits)) + ((return (expression uint bitfield_extract (var_ref value) (var_ref offset) (var_ref bits))))) + + (signature uvec2 + (parameters + (declare (in) uvec2 value) + (declare (in) int offset) + (declare (in) int bits)) + ((return (expression uvec2 bitfield_extract (var_ref value) (var_ref offset) (var_ref bits))))) + + (signature uvec3 + (parameters + (declare (in) uvec3 value) + (declare (in) int offset) + (declare (in) int bits)) + ((return (expression uvec3 bitfield_extract (var_ref value) (var_ref offset) (var_ref bits))))) + + (signature uvec4 + (parameters + (declare (in) uvec4 value) + (declare (in) int offset) + (declare (in) int bits)) + ((return (expression uvec4 bitfield_extract (var_ref value) (var_ref offset) (var_ref bits))))) +)) diff --git a/src/glsl/builtins/ir/bitfieldInsert.ir b/src/glsl/builtins/ir/bitfieldInsert.ir new file mode 100644 index 00000000000..2bb4442bef8 --- /dev/null +++ b/src/glsl/builtins/ir/bitfieldInsert.ir @@ -0,0 +1,65 @@ +((function bitfieldInsert + (signature int + (parameters + (declare (in) int base) + (declare (in) int insert) + (declare (in) int offset) + (declare (in) int bits)) + ((return (expression int bitfield_insert (var_ref base) (var_ref insert) (var_ref offset) (var_ref bits))))) + + (signature ivec2 + (parameters + (declare (in) ivec2 base) + (declare (in) ivec2 insert) + (declare (in) int offset) + (declare (in) int bits)) + ((return (expression ivec2 bitfield_insert (var_ref base) (var_ref insert) (var_ref offset) (var_ref bits))))) + + (signature ivec3 + (parameters + (declare (in) ivec3 base) + (declare (in) ivec3 insert) + (declare (in) int offset) + (declare (in) int bits)) + ((return (expression ivec3 bitfield_insert (var_ref base) (var_ref insert) (var_ref offset) (var_ref bits))))) + + (signature ivec4 + (parameters + (declare (in) ivec4 base) + (declare (in) ivec4 insert) + (declare (in) int offset) + (declare (in) int bits)) + ((return (expression ivec4 bitfield_insert (var_ref base) (var_ref insert) (var_ref offset) (var_ref bits))))) + + (signature uint + (parameters + (declare (in) uint base) + (declare (in) uint insert) + (declare (in) int offset) + (declare (in) int bits)) + ((return (expression uint bitfield_insert (var_ref base) (var_ref insert) (var_ref offset) (var_ref bits))))) + + (signature uvec2 + (parameters + (declare (in) uvec2 base) + (declare (in) uvec2 insert) + (declare (in) int offset) + (declare (in) int bits)) + ((return (expression uvec2 bitfield_insert (var_ref base) (var_ref insert) (var_ref offset) (var_ref bits))))) + + (signature uvec3 + (parameters + (declare (in) uvec3 base) + (declare (in) uvec3 insert) + (declare (in) int offset) + (declare (in) int bits)) + ((return (expression uvec3 bitfield_insert (var_ref base) (var_ref insert) (var_ref offset) (var_ref bits))))) + + (signature uvec4 + (parameters + (declare (in) uvec4 base) + (declare (in) uvec4 insert) + (declare (in) int offset) + (declare (in) int bits)) + ((return (expression uvec4 bitfield_insert (var_ref base) (var_ref insert) (var_ref offset) (var_ref bits))))) +)) diff --git a/src/glsl/builtins/ir/bitfieldReverse.ir b/src/glsl/builtins/ir/bitfieldReverse.ir new file mode 100644 index 00000000000..f05c119edb3 --- /dev/null +++ b/src/glsl/builtins/ir/bitfieldReverse.ir @@ -0,0 +1,41 @@ +((function bitfieldReverse + (signature int + (parameters + (declare (in) int value)) + ((return (expression int bitfield_reverse (var_ref value))))) + + (signature ivec2 + (parameters + (declare (in) ivec2 value)) + ((return (expression ivec2 bitfield_reverse (var_ref value))))) + + (signature ivec3 + (parameters + (declare (in) ivec3 value)) + ((return (expression ivec3 bitfield_reverse (var_ref value))))) + + (signature ivec4 + (parameters + (declare (in) ivec4 value)) + ((return (expression ivec4 bitfield_reverse (var_ref value))))) + + (signature uint + (parameters + (declare (in) uint value)) + ((return (expression uint bitfield_reverse (var_ref value))))) + + (signature uvec2 + (parameters + (declare (in) uvec2 value)) + ((return (expression uvec2 bitfield_reverse (var_ref value))))) + + (signature uvec3 + (parameters + (declare (in) uvec3 value)) + ((return (expression uvec3 bitfield_reverse (var_ref value))))) + + (signature uvec4 + (parameters + (declare (in) uvec4 value)) + ((return (expression uvec4 bitfield_reverse (var_ref value))))) +)) diff --git a/src/glsl/builtins/ir/findLSB.ir b/src/glsl/builtins/ir/findLSB.ir new file mode 100644 index 00000000000..2ddbb7f704d --- /dev/null +++ b/src/glsl/builtins/ir/findLSB.ir @@ -0,0 +1,41 @@ +((function findLSB + (signature int + (parameters + (declare (in) int value)) + ((return (expression int find_lsb (var_ref value))))) + + (signature ivec2 + (parameters + (declare (in) ivec2 value)) + ((return (expression ivec2 find_lsb (var_ref value))))) + + (signature ivec3 + (parameters + (declare (in) ivec3 value)) + ((return (expression ivec3 find_lsb (var_ref value))))) + + (signature ivec4 + (parameters + (declare (in) ivec4 value)) + ((return (expression ivec4 find_lsb (var_ref value))))) + + (signature int + (parameters + (declare (in) uint value)) + ((return (expression int find_lsb (var_ref value))))) + + (signature ivec2 + (parameters + (declare (in) uvec2 value)) + ((return (expression ivec2 find_lsb (var_ref value))))) + + (signature ivec3 + (parameters + (declare (in) uvec3 value)) + ((return (expression ivec3 find_lsb (var_ref value))))) + + (signature ivec4 + (parameters + (declare (in) uvec4 value)) + ((return (expression ivec4 find_lsb (var_ref value))))) +)) diff --git a/src/glsl/builtins/ir/findMSB.ir b/src/glsl/builtins/ir/findMSB.ir new file mode 100644 index 00000000000..24e270f5e17 --- /dev/null +++ b/src/glsl/builtins/ir/findMSB.ir @@ -0,0 +1,41 @@ +((function findMSB + (signature int + (parameters + (declare (in) int value)) + ((return (expression int find_msb (var_ref value))))) + + (signature ivec2 + (parameters + (declare (in) ivec2 value)) + ((return (expression ivec2 find_msb (var_ref value))))) + + (signature ivec3 + (parameters + (declare (in) ivec3 value)) + ((return (expression ivec3 find_msb (var_ref value))))) + + (signature ivec4 + (parameters + (declare (in) ivec4 value)) + ((return (expression ivec4 find_msb (var_ref value))))) + + (signature int + (parameters + (declare (in) uint value)) + ((return (expression int find_msb (var_ref value))))) + + (signature ivec2 + (parameters + (declare (in) uvec2 value)) + ((return (expression ivec2 find_msb (var_ref value))))) + + (signature ivec3 + (parameters + (declare (in) uvec3 value)) + ((return (expression ivec3 find_msb (var_ref value))))) + + (signature ivec4 + (parameters + (declare (in) uvec4 value)) + ((return (expression ivec4 find_msb (var_ref value))))) +)) -- cgit v1.2.3