[Mesa-dev] [PATCH (gles3) 02/20] glsl: Add IR lisp for GLSL ES 3.00 pack/unpack functions

Chad Versace chad.versace at linux.intel.com
Mon Jan 21 00:49:14 PST 2013


For each of the following functions, add a declaration to
builtins/profiles/300es.glsl and create new file
builtins/ir/${funcname}.ir:

  packSnorm2x16  unpackSnorm2x16
  packUnorm2x16  unpackUnorm2x16
  packHalf2x16   unpackHalf2x16

Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 src/glsl/builtins/ir/packHalf2x16.ir    |  6 ++++++
 src/glsl/builtins/ir/packSnorm2x16.ir   |  6 ++++++
 src/glsl/builtins/ir/packUnorm2x16.ir   |  6 ++++++
 src/glsl/builtins/ir/unpackHalf2x16.ir  |  6 ++++++
 src/glsl/builtins/ir/unpackSnorm2x16.ir |  6 ++++++
 src/glsl/builtins/ir/unpackUnorm2x16.ir |  6 ++++++
 src/glsl/builtins/profiles/300es.glsl   | 14 +++++++-------
 7 files changed, 43 insertions(+), 7 deletions(-)
 create mode 100644 src/glsl/builtins/ir/packHalf2x16.ir
 create mode 100644 src/glsl/builtins/ir/packSnorm2x16.ir
 create mode 100644 src/glsl/builtins/ir/packUnorm2x16.ir
 create mode 100644 src/glsl/builtins/ir/unpackHalf2x16.ir
 create mode 100644 src/glsl/builtins/ir/unpackSnorm2x16.ir
 create mode 100644 src/glsl/builtins/ir/unpackUnorm2x16.ir

diff --git a/src/glsl/builtins/ir/packHalf2x16.ir b/src/glsl/builtins/ir/packHalf2x16.ir
new file mode 100644
index 0000000..2f85407
--- /dev/null
+++ b/src/glsl/builtins/ir/packHalf2x16.ir
@@ -0,0 +1,6 @@
+((function packHalf2x16
+   (signature uint
+     (parameters
+       (declare (in) vec2 arg0))
+     ((return (expression uint packHalf2x16 (var_ref arg0)))))
+))
diff --git a/src/glsl/builtins/ir/packSnorm2x16.ir b/src/glsl/builtins/ir/packSnorm2x16.ir
new file mode 100644
index 0000000..b4575d2
--- /dev/null
+++ b/src/glsl/builtins/ir/packSnorm2x16.ir
@@ -0,0 +1,6 @@
+((function packSnorm2x16
+   (signature uint
+     (parameters
+       (declare (in) vec2 arg0))
+     ((return (expression uint packSnorm2x16 (var_ref arg0)))))
+))
diff --git a/src/glsl/builtins/ir/packUnorm2x16.ir b/src/glsl/builtins/ir/packUnorm2x16.ir
new file mode 100644
index 0000000..c809f2d
--- /dev/null
+++ b/src/glsl/builtins/ir/packUnorm2x16.ir
@@ -0,0 +1,6 @@
+((function packUnorm2x16
+   (signature uint
+     (parameters
+       (declare (in) vec2 arg0))
+     ((return (expression uint packUnorm2x16 (var_ref arg0)))))
+))
diff --git a/src/glsl/builtins/ir/unpackHalf2x16.ir b/src/glsl/builtins/ir/unpackHalf2x16.ir
new file mode 100644
index 0000000..f5b6fc2
--- /dev/null
+++ b/src/glsl/builtins/ir/unpackHalf2x16.ir
@@ -0,0 +1,6 @@
+((function unpackHalf2x16
+   (signature vec2
+     (parameters
+       (declare (in) uint arg0))
+     ((return (expression vec2 unpackHalf2x16 (var_ref arg0)))))
+))
diff --git a/src/glsl/builtins/ir/unpackSnorm2x16.ir b/src/glsl/builtins/ir/unpackSnorm2x16.ir
new file mode 100644
index 0000000..9092a06
--- /dev/null
+++ b/src/glsl/builtins/ir/unpackSnorm2x16.ir
@@ -0,0 +1,6 @@
+((function unpackSnorm2x16
+   (signature vec2
+     (parameters
+       (declare (in) uint arg0))
+     ((return (expression vec2 unpackSnorm2x16 (var_ref arg0)))))
+))
diff --git a/src/glsl/builtins/ir/unpackUnorm2x16.ir b/src/glsl/builtins/ir/unpackUnorm2x16.ir
new file mode 100644
index 0000000..935dc85
--- /dev/null
+++ b/src/glsl/builtins/ir/unpackUnorm2x16.ir
@@ -0,0 +1,6 @@
+((function unpackUnorm2x16
+   (signature vec2
+     (parameters
+       (declare (in) uint arg0))
+     ((return (expression vec2 unpackUnorm2x16 (var_ref arg0)))))
+))
diff --git a/src/glsl/builtins/profiles/300es.glsl b/src/glsl/builtins/profiles/300es.glsl
index 45212b3..4b7160d 100644
--- a/src/glsl/builtins/profiles/300es.glsl
+++ b/src/glsl/builtins/profiles/300es.glsl
@@ -325,14 +325,14 @@ vec4  uintBitsToFloat(uvec4 value);
 
 /*
  * 8.4 - Floating-Point Pack and Unpack Functions
- * FIXME: implement these
  */
-// uint packSnorm2x16(vec2 v);
-// vec2 unpackSnorm2x16(uint p);
-// uint packUnorm2x16(vec2 v);
-// vec2 unpackUnorm2x16(uint p);
-// uint packHalf2x16(vec2 v);
-// vec2 unpackHalf2x16(uint p);
+highp   uint packSnorm2x16(        vec2 v);
+highp   uint packUnorm2x16(        vec2 v);
+highp   uint packHalf2x16 (mediump vec2 v);
+
+highp   vec2 unpackSnorm2x16(highp uint p);
+highp   vec2 unpackUnorm2x16(highp uint p);
+mediump vec2 unpackHalf2x16 (highp uint p);
 
 /*
  * 8.5 - Geometric Functions
-- 
1.8.1.1



More information about the mesa-dev mailing list