[Piglit] [PATCH 2/5] gen_conversion: explicitly enumerate conversion target types

Nicolai Hähnle nhaehnle at gmail.com
Thu Jan 26 20:13:11 UTC 2017


On 26.01.2017 20:27, Dylan Baker wrote:
> Quoting Nicolai Hähnle (2017-01-26 10:59:23)
>> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>>
>> Currently only 'd' for double, but will be extended for 64-bit integer
>> types.
>> ---
>>  generated_tests/gen_conversion.py | 21 +++++++++++++--------
>>  1 file changed, 13 insertions(+), 8 deletions(-)
>>
>> diff --git a/generated_tests/gen_conversion.py b/generated_tests/gen_conversion.py
>> index fca3b17..456998b 100644
>> --- a/generated_tests/gen_conversion.py
>> +++ b/generated_tests/gen_conversion.py
>> @@ -258,29 +258,30 @@ class TestTuple(object):
>>          """Returns the inverted float32 hexadecimal representation from a
>>             float64 hexadecimal representation.
>>          """
>>          assert isinstance(hstr, str)
>>          temp = np.divide(1.0, TestTuple.hex_to_double(hstr))
>>          float_double = np.float32(temp)
>>          return TestTuple.float_to_hex(float_double)
>>
>>      def __init__(self, ver, stage,
>>                   first_dimension, second_dimension,
>> -                 basic_type, names_only):
>> +                 basic_type, target_type, names_only):
>>          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._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:
>> @@ -343,47 +344,51 @@ class RegularTestTuple(TestTuple):
>>      """
>>
>>      @staticmethod
>>      def all_tests(names_only):
>>          """Returns all the possible contained conversion test instances."""
>>
>>          assert isinstance(names_only, bool)
>>          stages = ['vert', 'geom', 'frag']
>>          dimensions = ['1', '2', '3', '4']
>>          basic_types = ['b', 'u', 'i', 'f']
>> +        target_types = ['d']
>>          glsl_ver = ['GL_ARB_gpu_shader_fp64', '400']
>>
>>          if not names_only:
>>              test_types = ['compiler', 'execution']
>>              for ver, test_type in itertools.product(glsl_ver, test_types):
>>                  utils.safe_makedirs(get_dir_name(ver, test_type))
>>
>> -        for ver, stage, first_dimension, second_dimension, basic_type in itertools.product(
>> +        for ver, stage, first_dimension, second_dimension, basic_type, target_type in itertools.product(
>>                  glsl_ver,
>>                  stages,
>>                  dimensions,
>>                  dimensions,
>> -                basic_types):
>> -            if not (first_dimension != '1' and (second_dimension == '1' or basic_type != 'f')):
>> +                basic_types,
>> +                target_types):
>> +            if (not (first_dimension != '1' and (second_dimension == '1' or basic_type != 'f')) and
>
> You've added an unnecessary set of parens here.

Isn't it needed for the multi-line if-expression?


>
>> +                (basic_type not in target_types or basic_type < target_type)):
>>                  yield RegularTestTuple(ver, stage,
>>                                         first_dimension, second_dimension,
>> -                                       basic_type, names_only)
>> +                                       basic_type, target_type, names_only)
>>
>>      def __init__(self, ver, stage,
>>                   first_dimension, second_dimension,
>> -                 basic_type, names_only):
>> +                 basic_type, target_type, names_only):
>>          assert ver in ('GL_ARB_gpu_shader_fp64', '400')
>>          assert basic_type in ('b', 'u', 'i', 'f')
>> +        assert target_type in ('d')
>
> why is this not "assert target_type == 'd'"?

Because I moved this around a bit, and the last patch changes it to in 
('d', 'i64', 'u64').

Nicolai

>
>>          assert not (first_dimension != '1' and (second_dimension == '1' or basic_type != 'f'))
>>          super(RegularTestTuple, self).__init__(ver, stage,
>>                                                 first_dimension, second_dimension,
>> -                                               basic_type, names_only)
>> +                                               basic_type, target_type, names_only)
>>
>>      def _gen_comp_test(self, from_type, to_type, converted_from):
>>          filename = os.path.join(
>>              get_dir_name(self._ver, 'compiler'),
>>              '{}-conversion-implicit-{}-{}-bad.{}'.format(self._stage, from_type, to_type,
>>                                                           self._stage))
>>
>>          self._filenames.append(filename)
>>
>>          if not self._names_only:
>> @@ -512,21 +517,21 @@ class ZeroSignTestTuple(TestTuple):
>>                                          basic_type, names_only)
>>
>>      def __init__(self, ver, stage,
>>                   first_dimension, second_dimension,
>>                   basic_type, names_only):
>>          assert ver in ('410', '420')
>>          assert basic_type == 'f'
>>          assert not (first_dimension != '1' and second_dimension == '1')
>>          super(ZeroSignTestTuple, self).__init__(ver, stage,
>>                                                  first_dimension, second_dimension,
>> -                                                basic_type, names_only)
>> +                                                basic_type, 'd', names_only)
>>
>>      def __gen_zero_sign_exec_test(self, from_type, to_type,
>>                                    uniform_from_type, uniform_to_type,
>>                                    explicit, converted_from, conversions):
>>          filename = os.path.join(
>>              get_dir_name(self._ver, 'execution'),
>>              '{}-conversion-{}-{}-{}-zero-sign.shader_test'.format(self._stage, explicit,
>>                                                                    from_type, to_type))
>>
>>          self._filenames.append(filename)
>> --
>> 2.7.4
>>
>> _______________________________________________
>> Piglit mailing list
>> Piglit at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/piglit



More information about the Piglit mailing list