diff options
author | Matt Turner <[email protected]> | 2013-04-09 16:03:15 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2013-05-06 10:17:13 -0700 |
commit | 44d3287ecd8b81a30a51613cd578dd31a115d820 (patch) | |
tree | 9136e236e0d583efa24c08562357ec8f400c7f5e /src/glsl/builtins | |
parent | f9e37879eb6407d9374e74d3982651b60ce096a1 (diff) |
glsl: Add new bit built-ins IR and prototypes from ARB_gpu_shader5.
Reviewed-by: Chris Forbes <[email protected]>
Diffstat (limited to 'src/glsl/builtins')
-rw-r--r-- | src/glsl/builtins/ir/bitCount.ir | 41 | ||||
-rw-r--r-- | src/glsl/builtins/ir/bitfieldExtract.ir | 57 | ||||
-rw-r--r-- | src/glsl/builtins/ir/bitfieldInsert.ir | 65 | ||||
-rw-r--r-- | src/glsl/builtins/ir/bitfieldReverse.ir | 41 | ||||
-rw-r--r-- | src/glsl/builtins/ir/findLSB.ir | 41 | ||||
-rw-r--r-- | src/glsl/builtins/ir/findMSB.ir | 41 | ||||
-rw-r--r-- | src/glsl/builtins/profiles/ARB_gpu_shader5.glsl | 56 |
7 files changed, 342 insertions, 0 deletions
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))))) +)) diff --git a/src/glsl/builtins/profiles/ARB_gpu_shader5.glsl b/src/glsl/builtins/profiles/ARB_gpu_shader5.glsl new file mode 100644 index 00000000000..458300f9ba5 --- /dev/null +++ b/src/glsl/builtins/profiles/ARB_gpu_shader5.glsl @@ -0,0 +1,56 @@ +#version 150 +#extension GL_ARB_gpu_shader5 : enable + +int bitfieldExtract(int value, int offset, int bits); +ivec2 bitfieldExtract(ivec2 value, int offset, int bits); +ivec3 bitfieldExtract(ivec3 value, int offset, int bits); +ivec4 bitfieldExtract(ivec4 value, int offset, int bits); +uint bitfieldExtract(uint value, int offset, int bits); +uvec2 bitfieldExtract(uvec2 value, int offset, int bits); +uvec3 bitfieldExtract(uvec3 value, int offset, int bits); +uvec4 bitfieldExtract(uvec4 value, int offset, int bits); + +int bitfieldInsert(int base, int insert, int offset, int bits); +ivec2 bitfieldInsert(ivec2 base, ivec2 insert, int offset, int bits); +ivec3 bitfieldInsert(ivec3 base, ivec3 insert, int offset, int bits); +ivec4 bitfieldInsert(ivec4 base, ivec4 insert, int offset, int bits); +uint bitfieldInsert(uint base, uint insert, int offset, int bits); +uvec2 bitfieldInsert(uvec2 base, uvec2 insert, int offset, int bits); +uvec3 bitfieldInsert(uvec3 base, uvec3 insert, int offset, int bits); +uvec4 bitfieldInsert(uvec4 base, uvec4 insert, int offset, int bits); + +int bitfieldReverse(int value); +ivec2 bitfieldReverse(ivec2 value); +ivec3 bitfieldReverse(ivec3 value); +ivec4 bitfieldReverse(ivec4 value); +uint bitfieldReverse(uint value); +uvec2 bitfieldReverse(uvec2 value); +uvec3 bitfieldReverse(uvec3 value); +uvec4 bitfieldReverse(uvec4 value); + +int bitCount(int value); +ivec2 bitCount(ivec2 value); +ivec3 bitCount(ivec3 value); +ivec4 bitCount(ivec4 value); +int bitCount(uint value); +ivec2 bitCount(uvec2 value); +ivec3 bitCount(uvec3 value); +ivec4 bitCount(uvec4 value); + +int findLSB(int value); +ivec2 findLSB(ivec2 value); +ivec3 findLSB(ivec3 value); +ivec4 findLSB(ivec4 value); +int findLSB(uint value); +ivec2 findLSB(uvec2 value); +ivec3 findLSB(uvec3 value); +ivec4 findLSB(uvec4 value); + +int findMSB(int value); +ivec2 findMSB(ivec2 value); +ivec3 findMSB(ivec3 value); +ivec4 findMSB(ivec4 value); +int findMSB(uint value); +ivec2 findMSB(uvec2 value); +ivec3 findMSB(uvec3 value); +ivec4 findMSB(uvec4 value); |