[Mesa-dev,v2,5/9] glsl: Add const_vec4 IR sexp creation function to test_case_generator.py

Submitted by Iago Toral Quiroga on Oct. 1, 2014, 6:35 a.m.

Details

Message ID 1412145345-3974-6-git-send-email-itoral@igalia.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Iago Toral Quiroga Oct. 1, 2014, 6:35 a.m.
From: Petri Latvala <petri.latvala@intel.com>

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
---
 src/glsl/tests/test_case_generator.py | 4 ++++
 1 file changed, 4 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/glsl/tests/test_case_generator.py b/src/glsl/tests/test_case_generator.py
index 5df8420..6633702 100644
--- a/src/glsl/tests/test_case_generator.py
+++ b/src/glsl/tests/test_case_generator.py
@@ -78,6 +78,10 @@  def const_bool(value):
     """
     return ['constant', 'bool', ['{0}'.format(1 if value else 0)]]
 
+def const_vec4(val1, val2, val3, val4):
+    """Create an expression representing the given values as a vec4."""
+    return ['constant', 'vec4', map(lambda x: '{0:.6f}'.format(x), [val1, val2, val3, val4])]
+
 def gt_zero(var_name):
     """Create Construct the expression var_name > 0"""
     return ['expression', 'bool', '>', ['var_ref', var_name], const_float(0)]