[Mesa-dev] [PATCH 6/9] glsl: Add const_vec4 IR sexp creation function to test_case_generator.py

Petri Latvala petri.latvala at intel.com
Tue Jul 29 02:36:36 PDT 2014


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

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)]
-- 
2.0.1



More information about the mesa-dev mailing list