[Piglit] [PATCH 3/5] gen_conversion: rename _gen_from/to_double and _double_type
Nicolai Hähnle
nhaehnle at gmail.com
Thu Jan 26 18:59:24 UTC 2017
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
Use generic names to reflect the upcoming dual use for 64-bit int types.
---
generated_tests/gen_conversion.py | 44 +++++++++++++++++++--------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/generated_tests/gen_conversion.py b/generated_tests/gen_conversion.py
index 456998b..aa76d48 100644
--- a/generated_tests/gen_conversion.py
+++ b/generated_tests/gen_conversion.py
@@ -269,21 +269,21 @@ class TestTuple(object):
assert stage in ('vert', 'geom', 'frag')
assert first_dimension in ('1', '2', '3', '4')
assert second_dimension in ('1', '2', '3', '4')
assert isinstance(names_only, bool)
self._ver = ver
self._stage = stage
self._basic_type = basic_type
self._target_type = target_type
self._names_only = names_only
- self._double_type = ''
+ self._target_full_type = ''
self._conversion_type = ''
self._uniform_type = ''
self._amount = int(first_dimension) * int(second_dimension)
self._filenames = []
if first_dimension != '1':
dimensional_type = 'mat' + first_dimension
if first_dimension != second_dimension:
dimensional_type += 'x' + second_dimension
elif second_dimension != '1':
@@ -294,55 +294,55 @@ class TestTuple(object):
if dimensional_type == '':
if basic_type == 'b':
self._conversion_type = 'bool'
self._uniform_type = 'int'
elif basic_type == 'i':
self._conversion_type = 'int'
elif basic_type == 'u':
self._conversion_type = 'uint'
elif basic_type == 'f':
self._conversion_type = 'float'
- self._double_type = 'double'
+ self._target_full_type = 'double'
if self._uniform_type == '':
self._uniform_type = self._conversion_type
else:
self._conversion_type = (basic_type if basic_type != 'f' else '') + dimensional_type
if basic_type == 'b':
self._uniform_type = 'i' + dimensional_type
else:
self._uniform_type = self._conversion_type
- self._double_type = 'd' + dimensional_type
+ self._target_full_type = 'd' + dimensional_type
@abc.abstractmethod
- def _gen_to_double(self):
+ def _gen_to_target(self):
"""Generates the test files for conversions to float64."""
@abc.abstractmethod
- def _gen_from_double(self):
+ def _gen_from_target(self):
"""Generates the test files for conversions from float64."""
@property
def filenames(self):
"""Returns the test file names this tuple will generate."""
if self._filenames == []:
tmp = self._names_only
self._names_only = True
self.generate_test_files()
self._names_only = tmp
return self._filenames
def generate_test_files(self):
"""Generate the GLSL parser tests."""
self._filenames = []
- self._gen_to_double()
- self._gen_from_double()
+ self._gen_to_target()
+ self._gen_from_target()
class RegularTestTuple(TestTuple):
"""Derived class for conversion tests using regular values within the
edges of the used types.
"""
@staticmethod
def all_tests(names_only):
"""Returns all the possible contained conversion test instances."""
@@ -416,54 +416,54 @@ class RegularTestTuple(TestTuple):
'execution.{}.shader_test.mako'.format(self._stage)).render_unicode(
ver=self._ver,
amount=self._amount,
from_type=from_type,
to_type=to_type,
converted_from=converted_from,
uniform_from_type=uniform_from_type,
uniform_to_type=uniform_to_type,
conversions=conversions))
- def _gen_to_double(self):
+ def _gen_to_target(self):
converted_from = 'from'
explicit = 'implicit'
if self._basic_type == 'b':
explicit = 'explicit'
- self._gen_comp_test(self._conversion_type, self._double_type,
+ self._gen_comp_test(self._conversion_type, self._target_full_type,
converted_from)
- converted_from = self._double_type + '(from)'
+ converted_from = self._target_full_type + '(from)'
conversion_values = BOOL_VALUES
conversion_function = TestTuple.int_str_to_double_str
elif self._basic_type == 'i':
conversion_values = INT_VALUES
conversion_function = TestTuple.int_str_to_double_str
elif self._basic_type == 'u':
conversion_values = UINT_VALUES
conversion_function = TestTuple.int_str_to_double_str
elif self._basic_type == 'f':
conversion_values = FLOAT_INFS + FLOAT_NEG_ZERO + FLOAT_POS_ZERO + FLOAT_VALUES
conversion_function = TestTuple.float_hex_to_double_hex
conversions = []
for value in conversion_values:
to_value = conversion_function(value)
item = {'from': value, 'to': to_value}
conversions.append(item)
- self._gen_exec_test(self._conversion_type, self._double_type,
- self._uniform_type, self._double_type,
+ self._gen_exec_test(self._conversion_type, self._target_full_type,
+ self._uniform_type, self._target_full_type,
explicit, converted_from, conversions)
- def _gen_from_double(self):
+ def _gen_from_target(self):
converted_from = 'from'
- self._gen_comp_test(self._double_type, self._conversion_type,
+ self._gen_comp_test(self._target_full_type, self._conversion_type,
converted_from)
converted_from = self._conversion_type + '(from)'
explicit = 'explicit'
if self._basic_type == 'b':
conversion_values = DOUBLE_INFS + DOUBLE_NORMAL_VALUES + DOUBLE_BOOL_VALUES
conversion_function = TestTuple.double_hex_to_bool_str
elif self._basic_type == 'i':
conversion_values = DOUBLE_DENORMAL_VALUES + DOUBLE_NORMAL_VALUES + DOUBLE_INT_VALUES
@@ -474,22 +474,22 @@ class RegularTestTuple(TestTuple):
elif self._basic_type == 'f':
conversion_values = DOUBLE_INFS + DOUBLE_FLOAT_INFS + DOUBLE_FLOAT_VALUES
conversion_function = TestTuple.double_hex_to_float_hex
conversions = []
for value in DOUBLE_NEG_ZERO + DOUBLE_POS_ZERO + conversion_values:
to_value = conversion_function(value)
item = {'from': value, 'to': to_value}
conversions.append(item)
- self._gen_exec_test(self._double_type, self._conversion_type,
- self._double_type, self._uniform_type,
+ self._gen_exec_test(self._target_full_type, self._conversion_type,
+ self._target_full_type, self._uniform_type,
explicit, converted_from, conversions)
class ZeroSignTestTuple(TestTuple):
"""Derived class for conversion tests using the float32 and float64
+/-0.0 values.
"""
@staticmethod
def all_tests(names_only):
@@ -543,50 +543,50 @@ class ZeroSignTestTuple(TestTuple):
self._stage)).render_unicode(
ver=self._ver,
amount=self._amount,
from_type=from_type,
to_type=to_type,
converted_from=converted_from,
uniform_from_type=uniform_from_type,
uniform_to_type=uniform_to_type,
conversions=conversions))
- def _gen_to_double(self):
+ def _gen_to_target(self):
if self._ver == '410':
conversion_values = FLOAT_POS_ZERO
elif self._ver == '420':
conversion_values = FLOAT_NEG_ZERO
conversions = []
for value in conversion_values:
to_value = TestTuple.float_hex_to_inv_double_hex(value)
item = {'from': value, 'to': to_value}
conversions.append(item)
- self.__gen_zero_sign_exec_test(self._conversion_type, self._double_type,
- self._uniform_type, self._double_type,
+ self.__gen_zero_sign_exec_test(self._conversion_type, self._target_full_type,
+ self._uniform_type, self._target_full_type,
'implicit', 'from', conversions)
- def _gen_from_double(self):
+ def _gen_from_target(self):
if self._ver == '410':
conversion_values = DOUBLE_POS_ZERO
elif self._ver == '420':
conversion_values = DOUBLE_NEG_ZERO
conversions = []
for value in conversion_values:
to_value = TestTuple.double_hex_to_inv_float_hex(value)
item = {'from': value, 'to': to_value}
conversions.append(item)
- self.__gen_zero_sign_exec_test(self._double_type, self._conversion_type,
- self._double_type, self._uniform_type,
+ self.__gen_zero_sign_exec_test(self._target_full_type, self._conversion_type,
+ self._target_full_type, self._uniform_type,
'explicit', self._conversion_type + '(from)', conversions)
def main():
"""Main function."""
parser = argparse.ArgumentParser(
description="Generate shader tests that check the conversions from and "
"to fp64")
parser.add_argument(
--
2.7.4
More information about the Piglit
mailing list