[Piglit] [PATCH 1/5] Rename gen_conversion_fp64 to gen_conversion
Dylan Baker
dylan at pnwbakers.com
Wed Feb 1 18:30:33 UTC 2017
Can you modify 'unittests/generators/test_generators.py' to know about the
rename, and run the tests? 'pytest unittest/generators' or "tox -e
'py{27,35}-generators'" will run the tests, depending on what you have
installed.
If that passes, for the series:
Acked-by: Dylan Baker <dylan at pnwbakers.com>
Quoting Nicolai Hähnle (2017-01-26 10:59:22)
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> We will extend it with int64 types.
> ---
> generated_tests/CMakeLists.txt | 44 +-
> generated_tests/gen_conversion.py | 605 +++++++++++++++++++++
> generated_tests/gen_conversion_fp64.py | 605 ---------------------
> generated_tests/templates/gen_conversion/base.mako | 12 +
> .../templates/gen_conversion/compiler.frag.mako | 3 +
> .../templates/gen_conversion/compiler.geom.mako | 3 +
> .../templates/gen_conversion/compiler.vert.mako | 3 +
> .../templates/gen_conversion/compiler_base.mako | 25 +
> .../execution-zero-sign.frag.shader_test.mako | 8 +
> .../execution-zero-sign.geom.shader_test.mako | 27 +
> .../execution-zero-sign.vert.shader_test.mako | 16 +
> .../gen_conversion/execution.frag.shader_test.mako | 7 +
> .../gen_conversion/execution.geom.shader_test.mako | 27 +
> .../gen_conversion/execution.vert.shader_test.mako | 16 +
> .../templates/gen_conversion/execution_base.mako | 31 ++
> .../gen_conversion/shader-zero-sign.frag.mako | 18 +
> .../gen_conversion/shader-zero-sign.geom.mako | 27 +
> .../gen_conversion/shader-zero-sign.vert.mako | 20 +
> .../templates/gen_conversion/shader.frag.mako | 16 +
> .../templates/gen_conversion/shader.geom.mako | 25 +
> .../templates/gen_conversion/shader.vert.mako | 18 +
> .../templates/gen_conversion/shader_base.mako | 11 +
> .../templates/gen_conversion_fp64/base.mako | 12 -
> .../gen_conversion_fp64/compiler.frag.mako | 3 -
> .../gen_conversion_fp64/compiler.geom.mako | 3 -
> .../gen_conversion_fp64/compiler.vert.mako | 3 -
> .../gen_conversion_fp64/compiler_base.mako | 25 -
> .../execution-zero-sign.frag.shader_test.mako | 8 -
> .../execution-zero-sign.geom.shader_test.mako | 27 -
> .../execution-zero-sign.vert.shader_test.mako | 16 -
> .../execution.frag.shader_test.mako | 7 -
> .../execution.geom.shader_test.mako | 27 -
> .../execution.vert.shader_test.mako | 16 -
> .../gen_conversion_fp64/execution_base.mako | 31 --
> .../gen_conversion_fp64/shader-zero-sign.frag.mako | 18 -
> .../gen_conversion_fp64/shader-zero-sign.geom.mako | 27 -
> .../gen_conversion_fp64/shader-zero-sign.vert.mako | 20 -
> .../templates/gen_conversion_fp64/shader.frag.mako | 16 -
> .../templates/gen_conversion_fp64/shader.geom.mako | 25 -
> .../templates/gen_conversion_fp64/shader.vert.mako | 18 -
> .../templates/gen_conversion_fp64/shader_base.mako | 11 -
> 41 files changed, 940 insertions(+), 940 deletions(-)
> create mode 100644 generated_tests/gen_conversion.py
> delete mode 100644 generated_tests/gen_conversion_fp64.py
> create mode 100644 generated_tests/templates/gen_conversion/base.mako
> create mode 100644 generated_tests/templates/gen_conversion/compiler.frag.mako
> create mode 100644 generated_tests/templates/gen_conversion/compiler.geom.mako
> create mode 100644 generated_tests/templates/gen_conversion/compiler.vert.mako
> create mode 100644 generated_tests/templates/gen_conversion/compiler_base.mako
> create mode 100644 generated_tests/templates/gen_conversion/execution-zero-sign.frag.shader_test.mako
> create mode 100644 generated_tests/templates/gen_conversion/execution-zero-sign.geom.shader_test.mako
> create mode 100644 generated_tests/templates/gen_conversion/execution-zero-sign.vert.shader_test.mako
> create mode 100644 generated_tests/templates/gen_conversion/execution.frag.shader_test.mako
> create mode 100644 generated_tests/templates/gen_conversion/execution.geom.shader_test.mako
> create mode 100644 generated_tests/templates/gen_conversion/execution.vert.shader_test.mako
> create mode 100644 generated_tests/templates/gen_conversion/execution_base.mako
> create mode 100644 generated_tests/templates/gen_conversion/shader-zero-sign.frag.mako
> create mode 100644 generated_tests/templates/gen_conversion/shader-zero-sign.geom.mako
> create mode 100644 generated_tests/templates/gen_conversion/shader-zero-sign.vert.mako
> create mode 100644 generated_tests/templates/gen_conversion/shader.frag.mako
> create mode 100644 generated_tests/templates/gen_conversion/shader.geom.mako
> create mode 100644 generated_tests/templates/gen_conversion/shader.vert.mako
> create mode 100644 generated_tests/templates/gen_conversion/shader_base.mako
> delete mode 100644 generated_tests/templates/gen_conversion_fp64/base.mako
> delete mode 100644 generated_tests/templates/gen_conversion_fp64/compiler.frag.mako
> delete mode 100644 generated_tests/templates/gen_conversion_fp64/compiler.geom.mako
> delete mode 100644 generated_tests/templates/gen_conversion_fp64/compiler.vert.mako
> delete mode 100644 generated_tests/templates/gen_conversion_fp64/compiler_base.mako
> delete mode 100644 generated_tests/templates/gen_conversion_fp64/execution-zero-sign.frag.shader_test.mako
> delete mode 100644 generated_tests/templates/gen_conversion_fp64/execution-zero-sign.geom.shader_test.mako
> delete mode 100644 generated_tests/templates/gen_conversion_fp64/execution-zero-sign.vert.shader_test.mako
> delete mode 100644 generated_tests/templates/gen_conversion_fp64/execution.frag.shader_test.mako
> delete mode 100644 generated_tests/templates/gen_conversion_fp64/execution.geom.shader_test.mako
> delete mode 100644 generated_tests/templates/gen_conversion_fp64/execution.vert.shader_test.mako
> delete mode 100644 generated_tests/templates/gen_conversion_fp64/execution_base.mako
> delete mode 100644 generated_tests/templates/gen_conversion_fp64/shader-zero-sign.frag.mako
> delete mode 100644 generated_tests/templates/gen_conversion_fp64/shader-zero-sign.geom.mako
> delete mode 100644 generated_tests/templates/gen_conversion_fp64/shader-zero-sign.vert.mako
> delete mode 100644 generated_tests/templates/gen_conversion_fp64/shader.frag.mako
> delete mode 100644 generated_tests/templates/gen_conversion_fp64/shader.geom.mako
> delete mode 100644 generated_tests/templates/gen_conversion_fp64/shader.vert.mako
> delete mode 100644 generated_tests/templates/gen_conversion_fp64/shader_base.mako
>
> diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
> index 7aee214..44572bd 100644
> --- a/generated_tests/CMakeLists.txt
> +++ b/generated_tests/CMakeLists.txt
> @@ -123,41 +123,41 @@ piglit_make_generated_tests(
> templates/gen_inout_fp64/template.vert.mako
> templates/gen_inout_fp64/template.shader_test.mako
> )
> piglit_make_generated_tests(
> flat_interpolation_qualifier.list
> gen_flat_interpolation_qualifier.py
> templates/gen_flat_interpolation_qualifier/compiler.mako
> templates/gen_flat_interpolation_qualifier/template.frag.mako
> )
> piglit_make_generated_tests(
> - conversion_fp64.list
> - gen_conversion_fp64.py
> - templates/gen_conversion_fp64/base.mako
> - templates/gen_conversion_fp64/compiler.frag.mako
> - templates/gen_conversion_fp64/compiler.geom.mako
> - templates/gen_conversion_fp64/compiler.vert.mako
> - templates/gen_conversion_fp64/compiler_base.mako
> - templates/gen_conversion_fp64/execution-zero-sign.frag.shader_test.mako
> - templates/gen_conversion_fp64/execution-zero-sign.geom.shader_test.mako
> - templates/gen_conversion_fp64/execution-zero-sign.vert.shader_test.mako
> - templates/gen_conversion_fp64/execution.frag.shader_test.mako
> - templates/gen_conversion_fp64/execution.geom.shader_test.mako
> - templates/gen_conversion_fp64/execution.vert.shader_test.mako
> - templates/gen_conversion_fp64/execution_base.mako
> - templates/gen_conversion_fp64/shader-zero-sign.frag.mako
> - templates/gen_conversion_fp64/shader-zero-sign.geom.mako
> - templates/gen_conversion_fp64/shader-zero-sign.vert.mako
> - templates/gen_conversion_fp64/shader.frag.mako
> - templates/gen_conversion_fp64/shader.geom.mako
> - templates/gen_conversion_fp64/shader.vert.mako
> - templates/gen_conversion_fp64/shader_base.mako
> + conversion.list
> + gen_conversion.py
> + templates/gen_conversion/base.mako
> + templates/gen_conversion/compiler.frag.mako
> + templates/gen_conversion/compiler.geom.mako
> + templates/gen_conversion/compiler.vert.mako
> + templates/gen_conversion/compiler_base.mako
> + templates/gen_conversion/execution-zero-sign.frag.shader_test.mako
> + templates/gen_conversion/execution-zero-sign.geom.shader_test.mako
> + templates/gen_conversion/execution-zero-sign.vert.shader_test.mako
> + templates/gen_conversion/execution.frag.shader_test.mako
> + templates/gen_conversion/execution.geom.shader_test.mako
> + templates/gen_conversion/execution.vert.shader_test.mako
> + templates/gen_conversion/execution_base.mako
> + templates/gen_conversion/shader-zero-sign.frag.mako
> + templates/gen_conversion/shader-zero-sign.geom.mako
> + templates/gen_conversion/shader-zero-sign.vert.mako
> + templates/gen_conversion/shader.frag.mako
> + templates/gen_conversion/shader.geom.mako
> + templates/gen_conversion/shader.vert.mako
> + templates/gen_conversion/shader_base.mako
> )
> piglit_make_generated_tests(
> shader_intel_conservative_rasterization.list
> gen_shader_intel_conservative_rasterization.py)
> piglit_make_generated_tests(
> shader_precision_tests.list
> gen_shader_precision_tests.py
> builtin_function.py
> templates/gen_shader_precision_tests/vs.mako
> templates/gen_shader_precision_tests/fs.mako
> @@ -241,21 +241,21 @@ add_custom_target(gen-gl-tests
> non-lvalue_tests.list
> texture_query_lod_tests.list
> texture_lod_tests.list
> shader_bit_encoding_tests.list
> uniform-initializer_tests.list
> interpolation-qualifier-built-in-variable.list
> builtin_uniform_tests_fp64.list
> constant_array_size_tests_fp64.list
> inout_fp64.list
> flat_interpolation_qualifier.list
> - conversion_fp64.list
> + conversion.list
> shader_precision_tests.list
> shader_framebuffer_fetch_tests.list
> shader_image_load_store_tests.list
> shader_image_nv_image_formats_tests.list
> shader_intel_conservative_rasterization.list
> variable_index_read_tests.list
> gen_extensions_defined.list
> vp-tex.list
> variable_index_write_tests.list
> vs_in_fp64.list
> diff --git a/generated_tests/gen_conversion.py b/generated_tests/gen_conversion.py
> new file mode 100644
> index 0000000..fca3b17
> --- /dev/null
> +++ b/generated_tests/gen_conversion.py
> @@ -0,0 +1,605 @@
> +# coding=utf-8
> +#
> +# Copyright © 2016 Intel Corporation
> +#
> +# Permission is hereby granted, free of charge, to any person obtaining a
> +# copy of this software and associated documentation files (the "Software"),
> +# to deal in the Software without restriction, including without limitation
> +# the rights to use, copy, modify, merge, publish, distribute, sublicense,
> +# and/or sell copies of the Software, and to permit persons to whom the
> +# Software is furnished to do so, subject to the following conditions:
> +#
> +# The above copyright notice and this permission notice (including the next
> +# paragraph) shall be included in all copies or substantial portions of the
> +# Software.
> +#
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> +# DEALINGS IN THE SOFTWARE.
> +
> +"""Generate fp64 types conversion tests."""
> +
> +from __future__ import print_function, division, absolute_import
> +import abc
> +import argparse
> +import itertools
> +import os
> +import struct
> +
> +import numpy as np
> +
> +from templates import template_dir
> +from modules import utils
> +
> +TEMPLATES = template_dir(os.path.basename(os.path.splitext(__file__)[0]))
> +
> +# pylint: disable=bad-whitespace,line-too-long,bad-continuation
> +DOUBLE_INFS = ['0xfff0000000000000', # -inf
> + '0x7ff0000000000000'] # +inf
> +
> +DOUBLE_NEG_ZERO = ['0x8000000000000000'] # Negative underflow (-0.0)
> +
> +DOUBLE_POS_ZERO = ['0x0000000000000000'] # Positive underflow (+0.0)
> +
> +# Double values causing an underflow to zero in any other type
> +DOUBLE_DENORMAL_VALUES = ['0x800fffffffffffff', # Negative maximum denormalized -- Denormalized may be flushed to 0
> + '0x8000000000000001', # Negative minimum denormalized -- Denormalized may be flushed to 0
> + '0x0000000000000001', # Positive minimum denormalized -- Denormalized may be flushed to 0
> + '0x000fffffffffffff'] # Positive maximum denormalized -- Denormalized may be flushed to 0
> +
> +DOUBLE_NORMAL_VALUES = ['0x8010000000000000', # Negative minimum normalized
> + '0x0010000000000000'] # Positive minimum normalized
> +
> +# Double +/-inf
> +DOUBLE_FLOAT_INFS = ['0xc7effffff0000000', # Negative overflow (-inf)
> + '0x47effffff0000000'] # Positive overflow (+inf)
> +
> +DOUBLE_FLOAT_VALUES = ['0xc7efffffefffffff', # Negative maximum normalized
> + '0xc170000000000000', # -16777216.0
> + '0xc014000000000000', # -5.0
> + '0xbfff25ce60000000', # -1.9467300176620483
> + '0xb80fffffe0000000', # Negative minimum normalized
> + '0xb69fffffffffffff', # Negative underflow
> + '0x369fffffffffffff', # Positive underflow
> + '0x380fffffe0000000', # Positive minimum normalized
> + '0x3fff25ce60000000', # +1.9467300176620483
> + '0x4014000000000000', # +5.0
> + '0x4170000000000000', # +16777216.0
> + '0x47efffffefffffff'] # Positive maximum normalized
> +
> +DOUBLE_UINT_VALUES = ['0xbfeccccccccccccd', # -0.9
> + #'0x8010000000000000', # Negative minimum normalized -- Already checked
> + #'0x800fffffffffffff', # Negative maximum denormalized -- Already checked
> + #'0x8000000000000001', # Negative minimum denormalized -- Already checked
> + #'0x8000000000000000', # Negative minimum (-0) -- Already checked
> + #'0x0000000000000000', # Positive minimum (+0) -- Already checked
> + '0x3fff25ce60000000', # +1.9467300176620483
> + '0x4014000000000000', # +5.0
> + '0x4170000000000000', # +16777216.0
> + '0x41dfffffffc00000', # Signed int low frontier (+2147483647)
> + '0x41e0000000000000', # Signed int up frontier (+2147483648)
> + '0x41efffffffe00000'] # Maximum (+4294967295)
> +
> +DOUBLE_INT_VALUES = ['0xc1e0000000000000', # Minimum (-2147483648)
> + '0xc170000000000000', # -16777216.0
> + '0xc014000000000000', # -5.0
> + '0xbfff25ce60000000', # -1.9467300176620483
> + #'0x8000000000000000', # Negative minimum (-0) -- Already checked
> + #'0x0000000000000000', # Minimum (+0) -- Already checked
> + '0x3fff25ce60000000', # +1.9467300176620483
> + '0x4014000000000000', # +5.0
> + '0x4170000000000000', # +16777216.0
> + '0x41dfffffffc00000'] # Maximum (+2147483647)
> +
> +DOUBLE_BOOL_VALUES = [#'0x8010000000000000', # Minimum negative True value -- Already checked
> + #'0x0000000000000000', # False -- Already checked
> + #'0x0010000000000000', # Minimum positive True value -- Already checked
> + ]
> +
> +FLOAT_INFS = ['0xff800000', # -inf
> + '0x7f800000'] # +inf
> +
> +FLOAT_NEG_ZERO = ['0x80000000'] # Negative underflow (-0.0)
> +
> +FLOAT_POS_ZERO = ['0x00000000'] # Positive underflow (+0.0)
> +
> +FLOAT_VALUES = ['0xff7fffff', # Negative maximum normalized
> + '0xcb800000', # -16777216.0
> + '0xc0a00000', # -5.0
> + '0xbff92e73', # -1.9467300176620483
> + '0x80800000', # Negative minimum normalized
> + #'0x807fffff', # Negative maximum denormalized -- Denormalized may be flushed to 0
> + #'0x80000001', # Negative minimum denormalized -- Denormalized may be flushed to 0
> + #'0x00000001', # Positive minimum denormalized -- Denormalized may be flushed to 0
> + #'0x007fffff', # Positive maximum denormalized -- Denormalized may be flushed to 0
> + '0x00800000', # Positive minimum normalized
> + '0x3ff92e73', # +1.9467300176620483
> + '0x40a00000', # +5.0
> + '0x4b800000', # +16777216.0
> + '0x7f7fffff'] # Positive maximum normalized
> +
> +UINT_VALUES = ['0', # Minimum
> + '5',
> + '2147483647', # Signed int low frontier
> + '2147483648', # Signed int up frontier
> + '4294967295'] # Maximum
> +
> +INT_VALUES = ['-2147483648', # Minimum
> + '-5',
> + '-1',
> + '0',
> + '1',
> + '5',
> + '2147483647'] # Maximum
> +
> +BOOL_VALUES = ['0', # False
> + '1'] # True
> +# pylint: enable=bad-whitespace,line-too-long,bad-continuation
> +
> +def get_dir_name(ver, test_type):
> + """Returns the directory name to save tests given a GLSL version and a
> + test type.
> + """
> +
> + assert isinstance(ver, str)
> + assert isinstance(test_type, str)
> + if ver.startswith('GL_'):
> + feature_dir = ver[3:].lower()
> + else:
> + feature_dir = 'glsl-{}.{}'.format(ver[0], ver[1:])
> +
> + return os.path.join('spec', feature_dir, test_type,
> + 'conversion')
> +
> +
> +class TestTuple(object):
> + """A float64 derived and other type derived tuple to generate the
> + needed conversion tests.
> + """
> +
> + @staticmethod
> + def float_to_hex(fvalue):
> + """Returns the hexadecimal representation from a float32 value."""
> + assert isinstance(fvalue, np.float32)
> + return hex(struct.unpack('<I', struct.pack('<f', fvalue))[0])
> +
> + @staticmethod
> + def double_to_hex(fvalue):
> + """Returns the hexadecimal representation from a float64 value."""
> + assert isinstance(fvalue, float)
> + return hex(struct.unpack('<Q', struct.pack('<d', fvalue))[0]).rstrip("L")
> +
> + @staticmethod
> + def hex_to_float(hstr):
> + """Returns a float32 value from its hexadecimal representation."""
> + assert isinstance(hstr, str)
> + return struct.unpack('<f', struct.pack('<I', int(hstr, 16)))[0]
> +
> + @staticmethod
> + def hex_to_double(hstr):
> + """Returns a float64 value from its hexadecimal representation."""
> +
> + assert isinstance(hstr, str)
> + return struct.unpack('<d', struct.pack('<Q', int(hstr, 16)))[0]
> +
> + @staticmethod
> + def float_hex_to_double_hex(hstr):
> + """Returns the float64 hexadecimal representation from a float32
> + hexadecimal representation.
> + """
> + assert isinstance(hstr, str)
> + double_value = TestTuple.hex_to_float(hstr)
> + return TestTuple.double_to_hex(double_value)
> +
> + @staticmethod
> + def float_hex_to_inv_double_hex(hstr):
> + """Returns the inverted float64 hexadecimal representation from a
> + float32 hexadecimal representation.
> + """
> + assert isinstance(hstr, str)
> + temp = TestTuple.hex_to_float(hstr)
> + double_value = np.divide(1.0, temp)
> + return TestTuple.double_to_hex(double_value)
> +
> + @staticmethod
> + def int_str_to_double_str(istr):
> + """Returns a float64 string from an int32 string."""
> + assert isinstance(istr, str)
> + return str(float(istr))
> +
> + @staticmethod
> + def double_hex_to_bool_str(hstr):
> + """Returns a bool string from a float64 hexadecimal representation."""
> + assert isinstance(hstr, str)
> + bool_double = TestTuple.hex_to_double(hstr)
> + return '1' if bool_double != 0.0 else '0'
> +
> + @staticmethod
> + def double_hex_to_int_str(hstr):
> + """Returns an int32 string from a float64 hexadecimal
> + representation.
> + """
> + assert isinstance(hstr, str)
> + int_double = TestTuple.hex_to_double(hstr)
> + if int_double > np.iinfo(np.dtype('int32')).max:
> + return str(np.iinfo(np.dtype('int32')).max)
> + if int_double < np.iinfo(np.dtype('int32')).min:
> + return str(np.iinfo(np.dtype('int32')).min)
> + return str(int(int_double))
> +
> + @staticmethod
> + def double_hex_to_uint_str(hstr):
> + """Returns an uint32 string from a float64 hexadecimal
> + representation.
> + """
> + assert isinstance(hstr, str)
> + uint_double = TestTuple.hex_to_double(hstr)
> + if uint_double > np.iinfo(np.dtype('uint32')).max:
> + return str(np.iinfo(np.dtype('uint32')).max)
> + if uint_double < np.iinfo(np.dtype('uint32')).min:
> + return str(np.iinfo(np.dtype('uint32')).min)
> + return str(int(uint_double))
> +
> + @staticmethod
> + def double_hex_to_float_hex(hstr):
> + """Returns the float32 hexadecimal representation from a float64
> + hexadecimal representation.
> + """
> + assert isinstance(hstr, str)
> + float_double = np.float32(TestTuple.hex_to_double(hstr))
> + return TestTuple.float_to_hex(float_double)
> +
> + @staticmethod
> + def double_hex_to_inv_float_hex(hstr):
> + """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):
> + 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._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:
> + dimensional_type += 'x' + second_dimension
> + elif second_dimension != '1':
> + dimensional_type = 'vec' + second_dimension
> + else:
> + dimensional_type = ''
> +
> + 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'
> + 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
> +
> + @abc.abstractmethod
> + def _gen_to_double(self):
> + """Generates the test files for conversions to float64."""
> +
> + @abc.abstractmethod
> + def _gen_from_double(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()
> +
> +
> +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."""
> +
> + assert isinstance(names_only, bool)
> + stages = ['vert', 'geom', 'frag']
> + dimensions = ['1', '2', '3', '4']
> + basic_types = ['b', 'u', 'i', 'f']
> + 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(
> + glsl_ver,
> + stages,
> + dimensions,
> + dimensions,
> + basic_types):
> + if not (first_dimension != '1' and (second_dimension == '1' or basic_type != 'f')):
> + yield RegularTestTuple(ver, stage,
> + first_dimension, second_dimension,
> + basic_type, names_only)
> +
> + def __init__(self, ver, stage,
> + first_dimension, second_dimension,
> + basic_type, names_only):
> + assert ver in ('GL_ARB_gpu_shader_fp64', '400')
> + assert basic_type in ('b', 'u', 'i', 'f')
> + 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)
> +
> + 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:
> + with open(filename, 'w') as test_file:
> + test_file.write(TEMPLATES.get_template(
> + 'compiler.{}.mako'.format(self._stage)).render_unicode(
> + ver=self._ver,
> + from_type=from_type,
> + to_type=to_type,
> + converted_from=converted_from))
> +
> + def _gen_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-{}-{}-{}.shader_test'.format(self._stage, explicit,
> + from_type, to_type))
> +
> + self._filenames.append(filename)
> +
> + if not self._names_only:
> + with open(filename, 'w') as test_file:
> + test_file.write(TEMPLATES.get_template(
> + '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):
> + converted_from = 'from'
> + explicit = 'implicit'
> +
> + if self._basic_type == 'b':
> + explicit = 'explicit'
> + self._gen_comp_test(self._conversion_type, self._double_type,
> + converted_from)
> + converted_from = self._double_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,
> + explicit, converted_from, conversions)
> +
> + def _gen_from_double(self):
> + converted_from = 'from'
> + self._gen_comp_test(self._double_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
> + conversion_function = TestTuple.double_hex_to_int_str
> + elif self._basic_type == 'u':
> + conversion_values = DOUBLE_DENORMAL_VALUES + DOUBLE_NORMAL_VALUES + DOUBLE_UINT_VALUES
> + conversion_function = TestTuple.double_hex_to_uint_str
> + 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,
> + 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):
> + """Returns all the possible zero sign conversion test instances."""
> +
> + assert isinstance(names_only, bool)
> + stages = ['vert', 'geom', 'frag']
> + dimensions = ['1', '2', '3', '4']
> + basic_types = ['f']
> + glsl_ver = ['410', '420']
> +
> + if not names_only:
> + for ver in glsl_ver:
> + utils.safe_makedirs(get_dir_name(ver, 'execution'))
> +
> + for ver, stage, first_dimension, second_dimension, basic_type in itertools.product(
> + glsl_ver,
> + stages,
> + dimensions,
> + dimensions,
> + basic_types):
> + if not (first_dimension != '1' and second_dimension == '1'):
> + yield ZeroSignTestTuple(ver, stage,
> + first_dimension, second_dimension,
> + 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)
> +
> + 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)
> +
> + if not self._names_only:
> + with open(filename, 'w') as test_file:
> + test_file.write(TEMPLATES.get_template(
> + 'execution-zero-sign.{}.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):
> + 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,
> + 'implicit', 'from', conversions)
> +
> + def _gen_from_double(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,
> + '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(
> + '--names-only',
> + dest='names_only',
> + action='store_true',
> + default=False,
> + help="Don't output files, just generate a list of filenames to stdout")
> + args = parser.parse_args()
> +
> + np.seterr(divide='ignore')
> +
> + for test in (list(RegularTestTuple.all_tests(args.names_only)) +
> + list(ZeroSignTestTuple.all_tests(args.names_only))):
> + test.generate_test_files()
> + for filename in test.filenames:
> + print(filename)
> +
> +
> +if __name__ == '__main__':
> + main()
> diff --git a/generated_tests/gen_conversion_fp64.py b/generated_tests/gen_conversion_fp64.py
> deleted file mode 100644
> index fca3b17..0000000
> --- a/generated_tests/gen_conversion_fp64.py
> +++ /dev/null
> @@ -1,605 +0,0 @@
> -# coding=utf-8
> -#
> -# Copyright © 2016 Intel Corporation
> -#
> -# Permission is hereby granted, free of charge, to any person obtaining a
> -# copy of this software and associated documentation files (the "Software"),
> -# to deal in the Software without restriction, including without limitation
> -# the rights to use, copy, modify, merge, publish, distribute, sublicense,
> -# and/or sell copies of the Software, and to permit persons to whom the
> -# Software is furnished to do so, subject to the following conditions:
> -#
> -# The above copyright notice and this permission notice (including the next
> -# paragraph) shall be included in all copies or substantial portions of the
> -# Software.
> -#
> -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> -# DEALINGS IN THE SOFTWARE.
> -
> -"""Generate fp64 types conversion tests."""
> -
> -from __future__ import print_function, division, absolute_import
> -import abc
> -import argparse
> -import itertools
> -import os
> -import struct
> -
> -import numpy as np
> -
> -from templates import template_dir
> -from modules import utils
> -
> -TEMPLATES = template_dir(os.path.basename(os.path.splitext(__file__)[0]))
> -
> -# pylint: disable=bad-whitespace,line-too-long,bad-continuation
> -DOUBLE_INFS = ['0xfff0000000000000', # -inf
> - '0x7ff0000000000000'] # +inf
> -
> -DOUBLE_NEG_ZERO = ['0x8000000000000000'] # Negative underflow (-0.0)
> -
> -DOUBLE_POS_ZERO = ['0x0000000000000000'] # Positive underflow (+0.0)
> -
> -# Double values causing an underflow to zero in any other type
> -DOUBLE_DENORMAL_VALUES = ['0x800fffffffffffff', # Negative maximum denormalized -- Denormalized may be flushed to 0
> - '0x8000000000000001', # Negative minimum denormalized -- Denormalized may be flushed to 0
> - '0x0000000000000001', # Positive minimum denormalized -- Denormalized may be flushed to 0
> - '0x000fffffffffffff'] # Positive maximum denormalized -- Denormalized may be flushed to 0
> -
> -DOUBLE_NORMAL_VALUES = ['0x8010000000000000', # Negative minimum normalized
> - '0x0010000000000000'] # Positive minimum normalized
> -
> -# Double +/-inf
> -DOUBLE_FLOAT_INFS = ['0xc7effffff0000000', # Negative overflow (-inf)
> - '0x47effffff0000000'] # Positive overflow (+inf)
> -
> -DOUBLE_FLOAT_VALUES = ['0xc7efffffefffffff', # Negative maximum normalized
> - '0xc170000000000000', # -16777216.0
> - '0xc014000000000000', # -5.0
> - '0xbfff25ce60000000', # -1.9467300176620483
> - '0xb80fffffe0000000', # Negative minimum normalized
> - '0xb69fffffffffffff', # Negative underflow
> - '0x369fffffffffffff', # Positive underflow
> - '0x380fffffe0000000', # Positive minimum normalized
> - '0x3fff25ce60000000', # +1.9467300176620483
> - '0x4014000000000000', # +5.0
> - '0x4170000000000000', # +16777216.0
> - '0x47efffffefffffff'] # Positive maximum normalized
> -
> -DOUBLE_UINT_VALUES = ['0xbfeccccccccccccd', # -0.9
> - #'0x8010000000000000', # Negative minimum normalized -- Already checked
> - #'0x800fffffffffffff', # Negative maximum denormalized -- Already checked
> - #'0x8000000000000001', # Negative minimum denormalized -- Already checked
> - #'0x8000000000000000', # Negative minimum (-0) -- Already checked
> - #'0x0000000000000000', # Positive minimum (+0) -- Already checked
> - '0x3fff25ce60000000', # +1.9467300176620483
> - '0x4014000000000000', # +5.0
> - '0x4170000000000000', # +16777216.0
> - '0x41dfffffffc00000', # Signed int low frontier (+2147483647)
> - '0x41e0000000000000', # Signed int up frontier (+2147483648)
> - '0x41efffffffe00000'] # Maximum (+4294967295)
> -
> -DOUBLE_INT_VALUES = ['0xc1e0000000000000', # Minimum (-2147483648)
> - '0xc170000000000000', # -16777216.0
> - '0xc014000000000000', # -5.0
> - '0xbfff25ce60000000', # -1.9467300176620483
> - #'0x8000000000000000', # Negative minimum (-0) -- Already checked
> - #'0x0000000000000000', # Minimum (+0) -- Already checked
> - '0x3fff25ce60000000', # +1.9467300176620483
> - '0x4014000000000000', # +5.0
> - '0x4170000000000000', # +16777216.0
> - '0x41dfffffffc00000'] # Maximum (+2147483647)
> -
> -DOUBLE_BOOL_VALUES = [#'0x8010000000000000', # Minimum negative True value -- Already checked
> - #'0x0000000000000000', # False -- Already checked
> - #'0x0010000000000000', # Minimum positive True value -- Already checked
> - ]
> -
> -FLOAT_INFS = ['0xff800000', # -inf
> - '0x7f800000'] # +inf
> -
> -FLOAT_NEG_ZERO = ['0x80000000'] # Negative underflow (-0.0)
> -
> -FLOAT_POS_ZERO = ['0x00000000'] # Positive underflow (+0.0)
> -
> -FLOAT_VALUES = ['0xff7fffff', # Negative maximum normalized
> - '0xcb800000', # -16777216.0
> - '0xc0a00000', # -5.0
> - '0xbff92e73', # -1.9467300176620483
> - '0x80800000', # Negative minimum normalized
> - #'0x807fffff', # Negative maximum denormalized -- Denormalized may be flushed to 0
> - #'0x80000001', # Negative minimum denormalized -- Denormalized may be flushed to 0
> - #'0x00000001', # Positive minimum denormalized -- Denormalized may be flushed to 0
> - #'0x007fffff', # Positive maximum denormalized -- Denormalized may be flushed to 0
> - '0x00800000', # Positive minimum normalized
> - '0x3ff92e73', # +1.9467300176620483
> - '0x40a00000', # +5.0
> - '0x4b800000', # +16777216.0
> - '0x7f7fffff'] # Positive maximum normalized
> -
> -UINT_VALUES = ['0', # Minimum
> - '5',
> - '2147483647', # Signed int low frontier
> - '2147483648', # Signed int up frontier
> - '4294967295'] # Maximum
> -
> -INT_VALUES = ['-2147483648', # Minimum
> - '-5',
> - '-1',
> - '0',
> - '1',
> - '5',
> - '2147483647'] # Maximum
> -
> -BOOL_VALUES = ['0', # False
> - '1'] # True
> -# pylint: enable=bad-whitespace,line-too-long,bad-continuation
> -
> -def get_dir_name(ver, test_type):
> - """Returns the directory name to save tests given a GLSL version and a
> - test type.
> - """
> -
> - assert isinstance(ver, str)
> - assert isinstance(test_type, str)
> - if ver.startswith('GL_'):
> - feature_dir = ver[3:].lower()
> - else:
> - feature_dir = 'glsl-{}.{}'.format(ver[0], ver[1:])
> -
> - return os.path.join('spec', feature_dir, test_type,
> - 'conversion')
> -
> -
> -class TestTuple(object):
> - """A float64 derived and other type derived tuple to generate the
> - needed conversion tests.
> - """
> -
> - @staticmethod
> - def float_to_hex(fvalue):
> - """Returns the hexadecimal representation from a float32 value."""
> - assert isinstance(fvalue, np.float32)
> - return hex(struct.unpack('<I', struct.pack('<f', fvalue))[0])
> -
> - @staticmethod
> - def double_to_hex(fvalue):
> - """Returns the hexadecimal representation from a float64 value."""
> - assert isinstance(fvalue, float)
> - return hex(struct.unpack('<Q', struct.pack('<d', fvalue))[0]).rstrip("L")
> -
> - @staticmethod
> - def hex_to_float(hstr):
> - """Returns a float32 value from its hexadecimal representation."""
> - assert isinstance(hstr, str)
> - return struct.unpack('<f', struct.pack('<I', int(hstr, 16)))[0]
> -
> - @staticmethod
> - def hex_to_double(hstr):
> - """Returns a float64 value from its hexadecimal representation."""
> -
> - assert isinstance(hstr, str)
> - return struct.unpack('<d', struct.pack('<Q', int(hstr, 16)))[0]
> -
> - @staticmethod
> - def float_hex_to_double_hex(hstr):
> - """Returns the float64 hexadecimal representation from a float32
> - hexadecimal representation.
> - """
> - assert isinstance(hstr, str)
> - double_value = TestTuple.hex_to_float(hstr)
> - return TestTuple.double_to_hex(double_value)
> -
> - @staticmethod
> - def float_hex_to_inv_double_hex(hstr):
> - """Returns the inverted float64 hexadecimal representation from a
> - float32 hexadecimal representation.
> - """
> - assert isinstance(hstr, str)
> - temp = TestTuple.hex_to_float(hstr)
> - double_value = np.divide(1.0, temp)
> - return TestTuple.double_to_hex(double_value)
> -
> - @staticmethod
> - def int_str_to_double_str(istr):
> - """Returns a float64 string from an int32 string."""
> - assert isinstance(istr, str)
> - return str(float(istr))
> -
> - @staticmethod
> - def double_hex_to_bool_str(hstr):
> - """Returns a bool string from a float64 hexadecimal representation."""
> - assert isinstance(hstr, str)
> - bool_double = TestTuple.hex_to_double(hstr)
> - return '1' if bool_double != 0.0 else '0'
> -
> - @staticmethod
> - def double_hex_to_int_str(hstr):
> - """Returns an int32 string from a float64 hexadecimal
> - representation.
> - """
> - assert isinstance(hstr, str)
> - int_double = TestTuple.hex_to_double(hstr)
> - if int_double > np.iinfo(np.dtype('int32')).max:
> - return str(np.iinfo(np.dtype('int32')).max)
> - if int_double < np.iinfo(np.dtype('int32')).min:
> - return str(np.iinfo(np.dtype('int32')).min)
> - return str(int(int_double))
> -
> - @staticmethod
> - def double_hex_to_uint_str(hstr):
> - """Returns an uint32 string from a float64 hexadecimal
> - representation.
> - """
> - assert isinstance(hstr, str)
> - uint_double = TestTuple.hex_to_double(hstr)
> - if uint_double > np.iinfo(np.dtype('uint32')).max:
> - return str(np.iinfo(np.dtype('uint32')).max)
> - if uint_double < np.iinfo(np.dtype('uint32')).min:
> - return str(np.iinfo(np.dtype('uint32')).min)
> - return str(int(uint_double))
> -
> - @staticmethod
> - def double_hex_to_float_hex(hstr):
> - """Returns the float32 hexadecimal representation from a float64
> - hexadecimal representation.
> - """
> - assert isinstance(hstr, str)
> - float_double = np.float32(TestTuple.hex_to_double(hstr))
> - return TestTuple.float_to_hex(float_double)
> -
> - @staticmethod
> - def double_hex_to_inv_float_hex(hstr):
> - """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):
> - 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._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:
> - dimensional_type += 'x' + second_dimension
> - elif second_dimension != '1':
> - dimensional_type = 'vec' + second_dimension
> - else:
> - dimensional_type = ''
> -
> - 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'
> - 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
> -
> - @abc.abstractmethod
> - def _gen_to_double(self):
> - """Generates the test files for conversions to float64."""
> -
> - @abc.abstractmethod
> - def _gen_from_double(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()
> -
> -
> -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."""
> -
> - assert isinstance(names_only, bool)
> - stages = ['vert', 'geom', 'frag']
> - dimensions = ['1', '2', '3', '4']
> - basic_types = ['b', 'u', 'i', 'f']
> - 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(
> - glsl_ver,
> - stages,
> - dimensions,
> - dimensions,
> - basic_types):
> - if not (first_dimension != '1' and (second_dimension == '1' or basic_type != 'f')):
> - yield RegularTestTuple(ver, stage,
> - first_dimension, second_dimension,
> - basic_type, names_only)
> -
> - def __init__(self, ver, stage,
> - first_dimension, second_dimension,
> - basic_type, names_only):
> - assert ver in ('GL_ARB_gpu_shader_fp64', '400')
> - assert basic_type in ('b', 'u', 'i', 'f')
> - 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)
> -
> - 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:
> - with open(filename, 'w') as test_file:
> - test_file.write(TEMPLATES.get_template(
> - 'compiler.{}.mako'.format(self._stage)).render_unicode(
> - ver=self._ver,
> - from_type=from_type,
> - to_type=to_type,
> - converted_from=converted_from))
> -
> - def _gen_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-{}-{}-{}.shader_test'.format(self._stage, explicit,
> - from_type, to_type))
> -
> - self._filenames.append(filename)
> -
> - if not self._names_only:
> - with open(filename, 'w') as test_file:
> - test_file.write(TEMPLATES.get_template(
> - '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):
> - converted_from = 'from'
> - explicit = 'implicit'
> -
> - if self._basic_type == 'b':
> - explicit = 'explicit'
> - self._gen_comp_test(self._conversion_type, self._double_type,
> - converted_from)
> - converted_from = self._double_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,
> - explicit, converted_from, conversions)
> -
> - def _gen_from_double(self):
> - converted_from = 'from'
> - self._gen_comp_test(self._double_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
> - conversion_function = TestTuple.double_hex_to_int_str
> - elif self._basic_type == 'u':
> - conversion_values = DOUBLE_DENORMAL_VALUES + DOUBLE_NORMAL_VALUES + DOUBLE_UINT_VALUES
> - conversion_function = TestTuple.double_hex_to_uint_str
> - 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,
> - 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):
> - """Returns all the possible zero sign conversion test instances."""
> -
> - assert isinstance(names_only, bool)
> - stages = ['vert', 'geom', 'frag']
> - dimensions = ['1', '2', '3', '4']
> - basic_types = ['f']
> - glsl_ver = ['410', '420']
> -
> - if not names_only:
> - for ver in glsl_ver:
> - utils.safe_makedirs(get_dir_name(ver, 'execution'))
> -
> - for ver, stage, first_dimension, second_dimension, basic_type in itertools.product(
> - glsl_ver,
> - stages,
> - dimensions,
> - dimensions,
> - basic_types):
> - if not (first_dimension != '1' and second_dimension == '1'):
> - yield ZeroSignTestTuple(ver, stage,
> - first_dimension, second_dimension,
> - 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)
> -
> - 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)
> -
> - if not self._names_only:
> - with open(filename, 'w') as test_file:
> - test_file.write(TEMPLATES.get_template(
> - 'execution-zero-sign.{}.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):
> - 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,
> - 'implicit', 'from', conversions)
> -
> - def _gen_from_double(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,
> - '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(
> - '--names-only',
> - dest='names_only',
> - action='store_true',
> - default=False,
> - help="Don't output files, just generate a list of filenames to stdout")
> - args = parser.parse_args()
> -
> - np.seterr(divide='ignore')
> -
> - for test in (list(RegularTestTuple.all_tests(args.names_only)) +
> - list(ZeroSignTestTuple.all_tests(args.names_only))):
> - test.generate_test_files()
> - for filename in test.filenames:
> - print(filename)
> -
> -
> -if __name__ == '__main__':
> - main()
> diff --git a/generated_tests/templates/gen_conversion/base.mako b/generated_tests/templates/gen_conversion/base.mako
> new file mode 100644
> index 0000000..bcb479f
> --- /dev/null
> +++ b/generated_tests/templates/gen_conversion/base.mako
> @@ -0,0 +1,12 @@
> +## coding=utf-8
> +<%def name="versioning()"><%
> + if ver == 'GL_ARB_gpu_shader_fp64':
> + glsl_version_int = '150'
> + else:
> + glsl_version_int = ver
> +
> + glsl_version = '{}.{}'.format(glsl_version_int[0], glsl_version_int[1:3])
> +
> + return (glsl_version, glsl_version_int)
> +%></%def>\
> +${next.body()}\
> diff --git a/generated_tests/templates/gen_conversion/compiler.frag.mako b/generated_tests/templates/gen_conversion/compiler.frag.mako
> new file mode 100644
> index 0000000..2ae22df
> --- /dev/null
> +++ b/generated_tests/templates/gen_conversion/compiler.frag.mako
> @@ -0,0 +1,3 @@
> +## coding=utf-8
> +<%inherit file="compiler_base.mako"/>\
> +<%include file="shader.frag.mako"/>\
> diff --git a/generated_tests/templates/gen_conversion/compiler.geom.mako b/generated_tests/templates/gen_conversion/compiler.geom.mako
> new file mode 100644
> index 0000000..1e2e340
> --- /dev/null
> +++ b/generated_tests/templates/gen_conversion/compiler.geom.mako
> @@ -0,0 +1,3 @@
> +## coding=utf-8
> +<%inherit file="compiler_base.mako"/>\
> +<%include file="shader.geom.mako"/>\
> diff --git a/generated_tests/templates/gen_conversion/compiler.vert.mako b/generated_tests/templates/gen_conversion/compiler.vert.mako
> new file mode 100644
> index 0000000..d9148f1
> --- /dev/null
> +++ b/generated_tests/templates/gen_conversion/compiler.vert.mako
> @@ -0,0 +1,3 @@
> +## coding=utf-8
> +<%inherit file="compiler_base.mako"/>\
> +<%include file="shader.vert.mako"/>\
> diff --git a/generated_tests/templates/gen_conversion/compiler_base.mako b/generated_tests/templates/gen_conversion/compiler_base.mako
> new file mode 100644
> index 0000000..96ecc36
> --- /dev/null
> +++ b/generated_tests/templates/gen_conversion/compiler_base.mako
> @@ -0,0 +1,25 @@
> +## coding=utf-8
> +<%inherit file="base.mako"/>\
> +<%
> + (glsl_version, glsl_version_int) = self.versioning()
> +%>\
> +/* [config]
> + * expect_result: fail
> + * glsl_version: ${glsl_version}
> +% if ver == 'GL_ARB_gpu_shader_fp64':
> + * require_extensions: ${ver}
> + * [end config]
> + *
> + * ${ver} spec states:
> + *
> + * "No implicit conversions are
> + * provided to convert from unsigned to signed integer types, from
> + * floating-point to integer types, or from higher-precision to
> + * lower-precision types. There are no implicit array or structure
> + * conversions."
> +% else:
> + * [end config]
> +% endif
> + */
> +
> +${next.body()}\
> diff --git a/generated_tests/templates/gen_conversion/execution-zero-sign.frag.shader_test.mako b/generated_tests/templates/gen_conversion/execution-zero-sign.frag.shader_test.mako
> new file mode 100644
> index 0000000..2d0123b
> --- /dev/null
> +++ b/generated_tests/templates/gen_conversion/execution-zero-sign.frag.shader_test.mako
> @@ -0,0 +1,8 @@
> +## coding=utf-8
> +<%inherit file="execution_base.mako"/>\
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +<%include file="shader-zero-sign.frag.mako"/>
> +
> diff --git a/generated_tests/templates/gen_conversion/execution-zero-sign.geom.shader_test.mako b/generated_tests/templates/gen_conversion/execution-zero-sign.geom.shader_test.mako
> new file mode 100644
> index 0000000..4ea9980
> --- /dev/null
> +++ b/generated_tests/templates/gen_conversion/execution-zero-sign.geom.shader_test.mako
> @@ -0,0 +1,27 @@
> +## coding=utf-8
> +<%inherit file="execution_base.mako"/>\
> +
> +[vertex shader]
> +#version 150
> +
> +in vec4 piglit_vertex;
> +out vec4 vertex_to_gs;
> +
> +void main()
> +{
> + vertex_to_gs = piglit_vertex;
> +}
> +
> +[geometry shader]
> +<%include file="shader-zero-sign.geom.mako"/>
> +[fragment shader]
> +#version 150
> +
> +in vec4 fs_color;
> +out vec4 color;
> +
> +void main()
> +{
> + color = fs_color;
> +}
> +
> diff --git a/generated_tests/templates/gen_conversion/execution-zero-sign.vert.shader_test.mako b/generated_tests/templates/gen_conversion/execution-zero-sign.vert.shader_test.mako
> new file mode 100644
> index 0000000..bb0fbff
> --- /dev/null
> +++ b/generated_tests/templates/gen_conversion/execution-zero-sign.vert.shader_test.mako
> @@ -0,0 +1,16 @@
> +## coding=utf-8
> +<%inherit file="execution_base.mako"/>\
> +
> +[vertex shader]
> +<%include file="shader-zero-sign.vert.mako"/>
> +[fragment shader]
> +#version 150
> +
> +in vec4 fs_color;
> +out vec4 color;
> +
> +void main()
> +{
> + color = fs_color;
> +}
> +
> diff --git a/generated_tests/templates/gen_conversion/execution.frag.shader_test.mako b/generated_tests/templates/gen_conversion/execution.frag.shader_test.mako
> new file mode 100644
> index 0000000..60507ee
> --- /dev/null
> +++ b/generated_tests/templates/gen_conversion/execution.frag.shader_test.mako
> @@ -0,0 +1,7 @@
> +## coding=utf-8
> +<%inherit file="execution_base.mako"/>\
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +<%include file="shader.frag.mako"/>
> diff --git a/generated_tests/templates/gen_conversion/execution.geom.shader_test.mako b/generated_tests/templates/gen_conversion/execution.geom.shader_test.mako
> new file mode 100644
> index 0000000..0b53ed3
> --- /dev/null
> +++ b/generated_tests/templates/gen_conversion/execution.geom.shader_test.mako
> @@ -0,0 +1,27 @@
> +## coding=utf-8
> +<%inherit file="execution_base.mako"/>\
> +
> +[vertex shader]
> +#version 150
> +
> +in vec4 piglit_vertex;
> +out vec4 vertex_to_gs;
> +
> +void main()
> +{
> + vertex_to_gs = piglit_vertex;
> +}
> +
> +[geometry shader]
> +<%include file="shader.geom.mako"/>
> +[fragment shader]
> +#version 150
> +
> +in vec4 fs_color;
> +out vec4 color;
> +
> +void main()
> +{
> + color = fs_color;
> +}
> +
> diff --git a/generated_tests/templates/gen_conversion/execution.vert.shader_test.mako b/generated_tests/templates/gen_conversion/execution.vert.shader_test.mako
> new file mode 100644
> index 0000000..96a8037
> --- /dev/null
> +++ b/generated_tests/templates/gen_conversion/execution.vert.shader_test.mako
> @@ -0,0 +1,16 @@
> +## coding=utf-8
> +<%inherit file="execution_base.mako"/>\
> +
> +[vertex shader]
> +<%include file="shader.vert.mako"/>
> +[fragment shader]
> +#version 150
> +
> +in vec4 fs_color;
> +out vec4 color;
> +
> +void main()
> +{
> + color = fs_color;
> +}
> +
> diff --git a/generated_tests/templates/gen_conversion/execution_base.mako b/generated_tests/templates/gen_conversion/execution_base.mako
> new file mode 100644
> index 0000000..2a3e065
> --- /dev/null
> +++ b/generated_tests/templates/gen_conversion/execution_base.mako
> @@ -0,0 +1,31 @@
> +## coding=utf-8
> +<%inherit file="base.mako"/>\
> +<%
> + (glsl_version, glsl_version_int) = self.versioning()
> +%>\
> +<%! from six.moves import range %>\
> +[require]
> +GLSL >= ${glsl_version}
> +% if ver == 'GL_ARB_gpu_shader_fp64':
> +${ver}
> +% endif
> +${next.body()}\
> +[test]
> +clear color 0.0 0.0 0.0 0.0
> +
> +% for conversion in conversions:
> +clear
> +uniform ${uniform_from_type} from \
> +% for i in range(amount):
> +${conversion['from']} \
> +% endfor
> +
> +uniform ${uniform_to_type} to \
> +% for i in range(amount):
> +${conversion['to']} \
> +% endfor
> +
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0
> +
> +% endfor
> diff --git a/generated_tests/templates/gen_conversion/shader-zero-sign.frag.mako b/generated_tests/templates/gen_conversion/shader-zero-sign.frag.mako
> new file mode 100644
> index 0000000..f6c61df
> --- /dev/null
> +++ b/generated_tests/templates/gen_conversion/shader-zero-sign.frag.mako
> @@ -0,0 +1,18 @@
> +## coding=utf-8
> +<%inherit file="shader_base.mako"/>\
> +uniform ${from_type} from;
> +uniform ${to_type} to;
> +
> +out vec4 color;
> +
> +#define ONE 1.0
> +#define RED vec4(1.0, 0.0, 0.0, 1.0)
> +#define GREEN vec4(0.0, 1.0, 0.0, 1.0)
> +
> +void main()
> +{
> + ${to_type} pre_converted = ${converted_from};
> + ${to_type} converted = ONE / pre_converted;
> + bool match = converted == to;
> + color = match ? GREEN : RED;
> +}
> diff --git a/generated_tests/templates/gen_conversion/shader-zero-sign.geom.mako b/generated_tests/templates/gen_conversion/shader-zero-sign.geom.mako
> new file mode 100644
> index 0000000..05a4cbb
> --- /dev/null
> +++ b/generated_tests/templates/gen_conversion/shader-zero-sign.geom.mako
> @@ -0,0 +1,27 @@
> +## coding=utf-8
> +<%inherit file="shader_base.mako"/>\
> +layout(triangles) in;
> +layout(triangle_strip, max_vertices = 3) out;
> +
> +uniform ${from_type} from;
> +uniform ${to_type} to;
> +
> +in vec4 vertex_to_gs[3];
> +out vec4 fs_color;
> +
> +#define ONE 1.0
> +#define RED vec4(1.0, 0.0, 0.0, 1.0)
> +#define GREEN vec4(0.0, 1.0, 0.0, 1.0)
> +
> +void main()
> +{
> + ${to_type} pre_converted = ${converted_from};
> + ${to_type} converted = ONE / pre_converted;
> + bool match = converted == to;
> +
> + for (int i = 0; i < 3; i++) {
> + fs_color = match ? GREEN : RED;
> + gl_Position = vertex_to_gs[i];
> + EmitVertex();
> + }
> +}
> diff --git a/generated_tests/templates/gen_conversion/shader-zero-sign.vert.mako b/generated_tests/templates/gen_conversion/shader-zero-sign.vert.mako
> new file mode 100644
> index 0000000..a0c6a13
> --- /dev/null
> +++ b/generated_tests/templates/gen_conversion/shader-zero-sign.vert.mako
> @@ -0,0 +1,20 @@
> +## coding=utf-8
> +<%inherit file="shader_base.mako"/>\
> +uniform ${from_type} from;
> +uniform ${to_type} to;
> +
> +in vec4 piglit_vertex;
> +out vec4 fs_color;
> +
> +#define ONE 1.0
> +#define RED vec4(1.0, 0.0, 0.0, 1.0)
> +#define GREEN vec4(0.0, 1.0, 0.0, 1.0)
> +
> +void main()
> +{
> + gl_Position = piglit_vertex;
> + ${to_type} pre_converted = ${converted_from};
> + ${to_type} converted = ONE / pre_converted;
> + bool match = converted == to;
> + fs_color = match ? GREEN : RED;
> +}
> diff --git a/generated_tests/templates/gen_conversion/shader.frag.mako b/generated_tests/templates/gen_conversion/shader.frag.mako
> new file mode 100644
> index 0000000..7a8b07c
> --- /dev/null
> +++ b/generated_tests/templates/gen_conversion/shader.frag.mako
> @@ -0,0 +1,16 @@
> +## coding=utf-8
> +<%inherit file="shader_base.mako"/>\
> +uniform ${from_type} from;
> +uniform ${to_type} to;
> +
> +out vec4 color;
> +
> +#define RED vec4(1.0, 0.0, 0.0, 1.0)
> +#define GREEN vec4(0.0, 1.0, 0.0, 1.0)
> +
> +void main()
> +{
> + ${to_type} converted = ${converted_from};
> + bool match = converted == to;
> + color = match ? GREEN : RED;
> +}
> diff --git a/generated_tests/templates/gen_conversion/shader.geom.mako b/generated_tests/templates/gen_conversion/shader.geom.mako
> new file mode 100644
> index 0000000..4e19579
> --- /dev/null
> +++ b/generated_tests/templates/gen_conversion/shader.geom.mako
> @@ -0,0 +1,25 @@
> +## coding=utf-8
> +<%inherit file="shader_base.mako"/>\
> +layout(triangles) in;
> +layout(triangle_strip, max_vertices = 3) out;
> +
> +uniform ${from_type} from;
> +uniform ${to_type} to;
> +
> +in vec4 vertex_to_gs[3];
> +out vec4 fs_color;
> +
> +#define RED vec4(1.0, 0.0, 0.0, 1.0)
> +#define GREEN vec4(0.0, 1.0, 0.0, 1.0)
> +
> +void main()
> +{
> + ${to_type} converted = ${converted_from};
> + bool match = converted == to;
> +
> + for (int i = 0; i < 3; i++) {
> + fs_color = match ? GREEN : RED;
> + gl_Position = vertex_to_gs[i];
> + EmitVertex();
> + }
> +}
> diff --git a/generated_tests/templates/gen_conversion/shader.vert.mako b/generated_tests/templates/gen_conversion/shader.vert.mako
> new file mode 100644
> index 0000000..2f3553d
> --- /dev/null
> +++ b/generated_tests/templates/gen_conversion/shader.vert.mako
> @@ -0,0 +1,18 @@
> +## coding=utf-8
> +<%inherit file="shader_base.mako"/>\
> +uniform ${from_type} from;
> +uniform ${to_type} to;
> +
> +in vec4 piglit_vertex;
> +out vec4 fs_color;
> +
> +#define RED vec4(1.0, 0.0, 0.0, 1.0)
> +#define GREEN vec4(0.0, 1.0, 0.0, 1.0)
> +
> +void main()
> +{
> + gl_Position = piglit_vertex;
> + ${to_type} converted = ${converted_from};
> + bool match = converted == to;
> + fs_color = match ? GREEN : RED;
> +}
> diff --git a/generated_tests/templates/gen_conversion/shader_base.mako b/generated_tests/templates/gen_conversion/shader_base.mako
> new file mode 100644
> index 0000000..33d88b8
> --- /dev/null
> +++ b/generated_tests/templates/gen_conversion/shader_base.mako
> @@ -0,0 +1,11 @@
> +## coding=utf-8
> +<%inherit file="base.mako"/>\
> +<%
> + (glsl_version, glsl_version_int) = self.versioning()
> +%>\
> +#version ${glsl_version_int}
> +% if ver == 'GL_ARB_gpu_shader_fp64':
> +#extension GL_ARB_gpu_shader_fp64 : require
> +% endif
> +
> +${next.body()}\
> diff --git a/generated_tests/templates/gen_conversion_fp64/base.mako b/generated_tests/templates/gen_conversion_fp64/base.mako
> deleted file mode 100644
> index bcb479f..0000000
> --- a/generated_tests/templates/gen_conversion_fp64/base.mako
> +++ /dev/null
> @@ -1,12 +0,0 @@
> -## coding=utf-8
> -<%def name="versioning()"><%
> - if ver == 'GL_ARB_gpu_shader_fp64':
> - glsl_version_int = '150'
> - else:
> - glsl_version_int = ver
> -
> - glsl_version = '{}.{}'.format(glsl_version_int[0], glsl_version_int[1:3])
> -
> - return (glsl_version, glsl_version_int)
> -%></%def>\
> -${next.body()}\
> diff --git a/generated_tests/templates/gen_conversion_fp64/compiler.frag.mako b/generated_tests/templates/gen_conversion_fp64/compiler.frag.mako
> deleted file mode 100644
> index 2ae22df..0000000
> --- a/generated_tests/templates/gen_conversion_fp64/compiler.frag.mako
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -## coding=utf-8
> -<%inherit file="compiler_base.mako"/>\
> -<%include file="shader.frag.mako"/>\
> diff --git a/generated_tests/templates/gen_conversion_fp64/compiler.geom.mako b/generated_tests/templates/gen_conversion_fp64/compiler.geom.mako
> deleted file mode 100644
> index 1e2e340..0000000
> --- a/generated_tests/templates/gen_conversion_fp64/compiler.geom.mako
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -## coding=utf-8
> -<%inherit file="compiler_base.mako"/>\
> -<%include file="shader.geom.mako"/>\
> diff --git a/generated_tests/templates/gen_conversion_fp64/compiler.vert.mako b/generated_tests/templates/gen_conversion_fp64/compiler.vert.mako
> deleted file mode 100644
> index d9148f1..0000000
> --- a/generated_tests/templates/gen_conversion_fp64/compiler.vert.mako
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -## coding=utf-8
> -<%inherit file="compiler_base.mako"/>\
> -<%include file="shader.vert.mako"/>\
> diff --git a/generated_tests/templates/gen_conversion_fp64/compiler_base.mako b/generated_tests/templates/gen_conversion_fp64/compiler_base.mako
> deleted file mode 100644
> index 96ecc36..0000000
> --- a/generated_tests/templates/gen_conversion_fp64/compiler_base.mako
> +++ /dev/null
> @@ -1,25 +0,0 @@
> -## coding=utf-8
> -<%inherit file="base.mako"/>\
> -<%
> - (glsl_version, glsl_version_int) = self.versioning()
> -%>\
> -/* [config]
> - * expect_result: fail
> - * glsl_version: ${glsl_version}
> -% if ver == 'GL_ARB_gpu_shader_fp64':
> - * require_extensions: ${ver}
> - * [end config]
> - *
> - * ${ver} spec states:
> - *
> - * "No implicit conversions are
> - * provided to convert from unsigned to signed integer types, from
> - * floating-point to integer types, or from higher-precision to
> - * lower-precision types. There are no implicit array or structure
> - * conversions."
> -% else:
> - * [end config]
> -% endif
> - */
> -
> -${next.body()}\
> diff --git a/generated_tests/templates/gen_conversion_fp64/execution-zero-sign.frag.shader_test.mako b/generated_tests/templates/gen_conversion_fp64/execution-zero-sign.frag.shader_test.mako
> deleted file mode 100644
> index 2d0123b..0000000
> --- a/generated_tests/templates/gen_conversion_fp64/execution-zero-sign.frag.shader_test.mako
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -## coding=utf-8
> -<%inherit file="execution_base.mako"/>\
> -
> -[vertex shader passthrough]
> -
> -[fragment shader]
> -<%include file="shader-zero-sign.frag.mako"/>
> -
> diff --git a/generated_tests/templates/gen_conversion_fp64/execution-zero-sign.geom.shader_test.mako b/generated_tests/templates/gen_conversion_fp64/execution-zero-sign.geom.shader_test.mako
> deleted file mode 100644
> index 4ea9980..0000000
> --- a/generated_tests/templates/gen_conversion_fp64/execution-zero-sign.geom.shader_test.mako
> +++ /dev/null
> @@ -1,27 +0,0 @@
> -## coding=utf-8
> -<%inherit file="execution_base.mako"/>\
> -
> -[vertex shader]
> -#version 150
> -
> -in vec4 piglit_vertex;
> -out vec4 vertex_to_gs;
> -
> -void main()
> -{
> - vertex_to_gs = piglit_vertex;
> -}
> -
> -[geometry shader]
> -<%include file="shader-zero-sign.geom.mako"/>
> -[fragment shader]
> -#version 150
> -
> -in vec4 fs_color;
> -out vec4 color;
> -
> -void main()
> -{
> - color = fs_color;
> -}
> -
> diff --git a/generated_tests/templates/gen_conversion_fp64/execution-zero-sign.vert.shader_test.mako b/generated_tests/templates/gen_conversion_fp64/execution-zero-sign.vert.shader_test.mako
> deleted file mode 100644
> index bb0fbff..0000000
> --- a/generated_tests/templates/gen_conversion_fp64/execution-zero-sign.vert.shader_test.mako
> +++ /dev/null
> @@ -1,16 +0,0 @@
> -## coding=utf-8
> -<%inherit file="execution_base.mako"/>\
> -
> -[vertex shader]
> -<%include file="shader-zero-sign.vert.mako"/>
> -[fragment shader]
> -#version 150
> -
> -in vec4 fs_color;
> -out vec4 color;
> -
> -void main()
> -{
> - color = fs_color;
> -}
> -
> diff --git a/generated_tests/templates/gen_conversion_fp64/execution.frag.shader_test.mako b/generated_tests/templates/gen_conversion_fp64/execution.frag.shader_test.mako
> deleted file mode 100644
> index 60507ee..0000000
> --- a/generated_tests/templates/gen_conversion_fp64/execution.frag.shader_test.mako
> +++ /dev/null
> @@ -1,7 +0,0 @@
> -## coding=utf-8
> -<%inherit file="execution_base.mako"/>\
> -
> -[vertex shader passthrough]
> -
> -[fragment shader]
> -<%include file="shader.frag.mako"/>
> diff --git a/generated_tests/templates/gen_conversion_fp64/execution.geom.shader_test.mako b/generated_tests/templates/gen_conversion_fp64/execution.geom.shader_test.mako
> deleted file mode 100644
> index 0b53ed3..0000000
> --- a/generated_tests/templates/gen_conversion_fp64/execution.geom.shader_test.mako
> +++ /dev/null
> @@ -1,27 +0,0 @@
> -## coding=utf-8
> -<%inherit file="execution_base.mako"/>\
> -
> -[vertex shader]
> -#version 150
> -
> -in vec4 piglit_vertex;
> -out vec4 vertex_to_gs;
> -
> -void main()
> -{
> - vertex_to_gs = piglit_vertex;
> -}
> -
> -[geometry shader]
> -<%include file="shader.geom.mako"/>
> -[fragment shader]
> -#version 150
> -
> -in vec4 fs_color;
> -out vec4 color;
> -
> -void main()
> -{
> - color = fs_color;
> -}
> -
> diff --git a/generated_tests/templates/gen_conversion_fp64/execution.vert.shader_test.mako b/generated_tests/templates/gen_conversion_fp64/execution.vert.shader_test.mako
> deleted file mode 100644
> index 96a8037..0000000
> --- a/generated_tests/templates/gen_conversion_fp64/execution.vert.shader_test.mako
> +++ /dev/null
> @@ -1,16 +0,0 @@
> -## coding=utf-8
> -<%inherit file="execution_base.mako"/>\
> -
> -[vertex shader]
> -<%include file="shader.vert.mako"/>
> -[fragment shader]
> -#version 150
> -
> -in vec4 fs_color;
> -out vec4 color;
> -
> -void main()
> -{
> - color = fs_color;
> -}
> -
> diff --git a/generated_tests/templates/gen_conversion_fp64/execution_base.mako b/generated_tests/templates/gen_conversion_fp64/execution_base.mako
> deleted file mode 100644
> index 2a3e065..0000000
> --- a/generated_tests/templates/gen_conversion_fp64/execution_base.mako
> +++ /dev/null
> @@ -1,31 +0,0 @@
> -## coding=utf-8
> -<%inherit file="base.mako"/>\
> -<%
> - (glsl_version, glsl_version_int) = self.versioning()
> -%>\
> -<%! from six.moves import range %>\
> -[require]
> -GLSL >= ${glsl_version}
> -% if ver == 'GL_ARB_gpu_shader_fp64':
> -${ver}
> -% endif
> -${next.body()}\
> -[test]
> -clear color 0.0 0.0 0.0 0.0
> -
> -% for conversion in conversions:
> -clear
> -uniform ${uniform_from_type} from \
> -% for i in range(amount):
> -${conversion['from']} \
> -% endfor
> -
> -uniform ${uniform_to_type} to \
> -% for i in range(amount):
> -${conversion['to']} \
> -% endfor
> -
> -draw rect -1 -1 2 2
> -probe all rgba 0.0 1.0 0.0 1.0
> -
> -% endfor
> diff --git a/generated_tests/templates/gen_conversion_fp64/shader-zero-sign.frag.mako b/generated_tests/templates/gen_conversion_fp64/shader-zero-sign.frag.mako
> deleted file mode 100644
> index f6c61df..0000000
> --- a/generated_tests/templates/gen_conversion_fp64/shader-zero-sign.frag.mako
> +++ /dev/null
> @@ -1,18 +0,0 @@
> -## coding=utf-8
> -<%inherit file="shader_base.mako"/>\
> -uniform ${from_type} from;
> -uniform ${to_type} to;
> -
> -out vec4 color;
> -
> -#define ONE 1.0
> -#define RED vec4(1.0, 0.0, 0.0, 1.0)
> -#define GREEN vec4(0.0, 1.0, 0.0, 1.0)
> -
> -void main()
> -{
> - ${to_type} pre_converted = ${converted_from};
> - ${to_type} converted = ONE / pre_converted;
> - bool match = converted == to;
> - color = match ? GREEN : RED;
> -}
> diff --git a/generated_tests/templates/gen_conversion_fp64/shader-zero-sign.geom.mako b/generated_tests/templates/gen_conversion_fp64/shader-zero-sign.geom.mako
> deleted file mode 100644
> index 05a4cbb..0000000
> --- a/generated_tests/templates/gen_conversion_fp64/shader-zero-sign.geom.mako
> +++ /dev/null
> @@ -1,27 +0,0 @@
> -## coding=utf-8
> -<%inherit file="shader_base.mako"/>\
> -layout(triangles) in;
> -layout(triangle_strip, max_vertices = 3) out;
> -
> -uniform ${from_type} from;
> -uniform ${to_type} to;
> -
> -in vec4 vertex_to_gs[3];
> -out vec4 fs_color;
> -
> -#define ONE 1.0
> -#define RED vec4(1.0, 0.0, 0.0, 1.0)
> -#define GREEN vec4(0.0, 1.0, 0.0, 1.0)
> -
> -void main()
> -{
> - ${to_type} pre_converted = ${converted_from};
> - ${to_type} converted = ONE / pre_converted;
> - bool match = converted == to;
> -
> - for (int i = 0; i < 3; i++) {
> - fs_color = match ? GREEN : RED;
> - gl_Position = vertex_to_gs[i];
> - EmitVertex();
> - }
> -}
> diff --git a/generated_tests/templates/gen_conversion_fp64/shader-zero-sign.vert.mako b/generated_tests/templates/gen_conversion_fp64/shader-zero-sign.vert.mako
> deleted file mode 100644
> index a0c6a13..0000000
> --- a/generated_tests/templates/gen_conversion_fp64/shader-zero-sign.vert.mako
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -## coding=utf-8
> -<%inherit file="shader_base.mako"/>\
> -uniform ${from_type} from;
> -uniform ${to_type} to;
> -
> -in vec4 piglit_vertex;
> -out vec4 fs_color;
> -
> -#define ONE 1.0
> -#define RED vec4(1.0, 0.0, 0.0, 1.0)
> -#define GREEN vec4(0.0, 1.0, 0.0, 1.0)
> -
> -void main()
> -{
> - gl_Position = piglit_vertex;
> - ${to_type} pre_converted = ${converted_from};
> - ${to_type} converted = ONE / pre_converted;
> - bool match = converted == to;
> - fs_color = match ? GREEN : RED;
> -}
> diff --git a/generated_tests/templates/gen_conversion_fp64/shader.frag.mako b/generated_tests/templates/gen_conversion_fp64/shader.frag.mako
> deleted file mode 100644
> index 7a8b07c..0000000
> --- a/generated_tests/templates/gen_conversion_fp64/shader.frag.mako
> +++ /dev/null
> @@ -1,16 +0,0 @@
> -## coding=utf-8
> -<%inherit file="shader_base.mako"/>\
> -uniform ${from_type} from;
> -uniform ${to_type} to;
> -
> -out vec4 color;
> -
> -#define RED vec4(1.0, 0.0, 0.0, 1.0)
> -#define GREEN vec4(0.0, 1.0, 0.0, 1.0)
> -
> -void main()
> -{
> - ${to_type} converted = ${converted_from};
> - bool match = converted == to;
> - color = match ? GREEN : RED;
> -}
> diff --git a/generated_tests/templates/gen_conversion_fp64/shader.geom.mako b/generated_tests/templates/gen_conversion_fp64/shader.geom.mako
> deleted file mode 100644
> index 4e19579..0000000
> --- a/generated_tests/templates/gen_conversion_fp64/shader.geom.mako
> +++ /dev/null
> @@ -1,25 +0,0 @@
> -## coding=utf-8
> -<%inherit file="shader_base.mako"/>\
> -layout(triangles) in;
> -layout(triangle_strip, max_vertices = 3) out;
> -
> -uniform ${from_type} from;
> -uniform ${to_type} to;
> -
> -in vec4 vertex_to_gs[3];
> -out vec4 fs_color;
> -
> -#define RED vec4(1.0, 0.0, 0.0, 1.0)
> -#define GREEN vec4(0.0, 1.0, 0.0, 1.0)
> -
> -void main()
> -{
> - ${to_type} converted = ${converted_from};
> - bool match = converted == to;
> -
> - for (int i = 0; i < 3; i++) {
> - fs_color = match ? GREEN : RED;
> - gl_Position = vertex_to_gs[i];
> - EmitVertex();
> - }
> -}
> diff --git a/generated_tests/templates/gen_conversion_fp64/shader.vert.mako b/generated_tests/templates/gen_conversion_fp64/shader.vert.mako
> deleted file mode 100644
> index 2f3553d..0000000
> --- a/generated_tests/templates/gen_conversion_fp64/shader.vert.mako
> +++ /dev/null
> @@ -1,18 +0,0 @@
> -## coding=utf-8
> -<%inherit file="shader_base.mako"/>\
> -uniform ${from_type} from;
> -uniform ${to_type} to;
> -
> -in vec4 piglit_vertex;
> -out vec4 fs_color;
> -
> -#define RED vec4(1.0, 0.0, 0.0, 1.0)
> -#define GREEN vec4(0.0, 1.0, 0.0, 1.0)
> -
> -void main()
> -{
> - gl_Position = piglit_vertex;
> - ${to_type} converted = ${converted_from};
> - bool match = converted == to;
> - fs_color = match ? GREEN : RED;
> -}
> diff --git a/generated_tests/templates/gen_conversion_fp64/shader_base.mako b/generated_tests/templates/gen_conversion_fp64/shader_base.mako
> deleted file mode 100644
> index 33d88b8..0000000
> --- a/generated_tests/templates/gen_conversion_fp64/shader_base.mako
> +++ /dev/null
> @@ -1,11 +0,0 @@
> -## coding=utf-8
> -<%inherit file="base.mako"/>\
> -<%
> - (glsl_version, glsl_version_int) = self.versioning()
> -%>\
> -#version ${glsl_version_int}
> -% if ver == 'GL_ARB_gpu_shader_fp64':
> -#extension GL_ARB_gpu_shader_fp64 : require
> -% endif
> -
> -${next.body()}\
> --
> 2.7.4
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20170201/d25e3c31/attachment-0001.sig>
More information about the Piglit
mailing list