summaryrefslogtreecommitdiff
path: root/generated_tests
diff options
context:
space:
mode:
Diffstat (limited to 'generated_tests')
-rw-r--r--generated_tests/CMakeLists.txt4
-rw-r--r--generated_tests/builtin_function.py86
-rw-r--r--generated_tests/builtin_function_fp64.py8
-rw-r--r--generated_tests/gen_builtin_packing_tests.py2
-rw-r--r--generated_tests/gen_cl_common_builtins.py3
-rw-r--r--generated_tests/gen_cl_math_builtins.py2
-rw-r--r--generated_tests/gen_cl_vload_tests.py2
-rw-r--r--generated_tests/gen_conversion.py4
-rw-r--r--generated_tests/gen_interface_block_tests.py339
-rw-r--r--generated_tests/gen_variable_index_write_tests.py2
-rw-r--r--generated_tests/gen_vp_tex.py2
-rw-r--r--generated_tests/modules/glsl.py4
-rw-r--r--generated_tests/modules/types.py2
-rw-r--r--generated_tests/random_ubo.py2
-rw-r--r--generated_tests/templates/__init__.py4
-rw-r--r--generated_tests/templates/gen_interface_block_tests/basic.shader_test.mako66
-rw-r--r--generated_tests/templates/gen_variable_index_write_tests/helpers.mako2
17 files changed, 477 insertions, 57 deletions
diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
index 992a9a0fe..8f610c6c3 100644
--- a/generated_tests/CMakeLists.txt
+++ b/generated_tests/CMakeLists.txt
@@ -227,6 +227,9 @@ piglit_make_generated_tests(
piglit_make_generated_tests(
inout_64bit.list
gen_inout_64bit_tests.py)
+piglit_make_generated_tests(
+ interface_block_tests.list
+ gen_interface_block_tests.py)
# OpenCL Test generators
piglit_make_generated_tests(
@@ -297,6 +300,7 @@ add_custom_target(gen-gl-tests
vs_in_fp64.list
gpu_shader4_tests.list
inout_64bit.list
+ interface_block_tests.list
)
# Create a custom target for generating OpenCL tests
diff --git a/generated_tests/builtin_function.py b/generated_tests/builtin_function.py
index 9dedbdf32..ad694dcf2 100644
--- a/generated_tests/builtin_function.py
+++ b/generated_tests/builtin_function.py
@@ -67,6 +67,9 @@ FLOATING_TYPES = (float, np.float64, np.float32)
INT32_TYPES = tuple(set([np.int32, type(np.abs(np.int32(1)))]))
UINT32_TYPES = tuple(set([np.uint32,
type(np.dot(np.uint32(0), np.uint32(0)))]))
+INT64_TYPES = tuple(set([np.int64, type(np.abs(np.int64(1)))]))
+UINT64_TYPES = tuple(set([np.uint64,
+ type(np.dot(np.uint64(0), np.uint64(0)))]))
@functools.total_ordering
@@ -407,21 +410,17 @@ def _lshift(x, y):
base = glsl_type_of(x).base_type
if base in (glsl_int64_t, glsl_uint64_t):
bits = 64
- shift_type = glsl_int if base == glsl_int64_t else glsl_uint
else:
bits = 32
- shift_type = base
if not all(0 <= y_element < bits for y_element in column_major_values(y)):
# Shifts by less than 0 or more than the number of bits in the
# type being shifted are undefined.
return None
- # When the arguments to << don't have the same signedness, numpy
- # likes to promote them to int64. To avoid this, convert y to be
- # the same type as x.
- y_orig = y
- if glsl_type_of(y).base_type != shift_type:
- y = _change_signedness(y)
- result = x << y
+
+ # Once we're sure that y is non-negative and small enough to fit
+ # any integer type, we can convert it to the same type as x, so
+ # the result will always be of the same type.
+ result = x << _change_int_base_type(y, x.dtype)
# Shifting should always produce a result with the same base type
# as the left argument.
@@ -442,13 +441,11 @@ def _rshift(x, y):
# Shifts by less than 0 or more than the number of bits in the
# type being shifted are undefined.
return None
- # When the arguments to >> don't have the same signedness, numpy
- # likes to promote them to int64. To avoid this, convert y to be
- # the same type as x.
- y_orig = y
- if glsl_type_of(y).base_type != shift_type:
- y = _change_signedness(y)
- result = x >> y
+
+ # Once we're sure that y is non-negative and small enough to fit
+ # any integer type, we can convert it to the same type as x, so
+ # the result will always be of the same type.
+ result = x >> _change_int_base_type(y, x.dtype)
# Shifting should always produce a result with the same base type
# as the left argument.
@@ -531,19 +528,14 @@ def _refract(I, N, eta):
return eta*I-(eta*np.dot(N, I)+np.sqrt(k))*N
-def _change_signedness(x):
- """Change signed integer types to unsigned integer types and vice
- versa."""
- if isinstance(x, INT32_TYPES):
- return np.uint32(x)
- elif isinstance(x, UINT32_TYPES):
- return np.int32(x)
- elif isinstance(x, np.ndarray):
- if (x.dtype in INT32_TYPES):
- return np.array(x, dtype=np.uint32)
- elif (x.dtype in UINT32_TYPES):
- return np.array(x, dtype=np.int32)
- raise Exception('Unexpected type passed to _change_signedness')
+def _change_int_base_type(x, new_type):
+ """Change base type of integer scalar or vector
+ to the given one.
+ """
+ if isinstance(x, np.ndarray):
+ return np.array(x, dtype=new_type)
+ else:
+ return x.astype(new_type)
def _argument_types_match(arguments, argument_indices_to_match):
@@ -743,7 +735,7 @@ def _store_test_vector(test_suite_dict, name, glsl_version, extension, test_vect
glsl_version is adjusted if necessary to reflect when the argument
and return types were introduced into GLSL.
- If template is supplied, it is used insted as the template for the
+ If template is supplied, it is used instead as the template for the
Signature objects generated.
"""
if template is None:
@@ -767,7 +759,7 @@ def _store_test_vectors(test_suite_dict, name, glsl_version, extension,
"""Store multiple test vectors in the appropriate places in
test_suite_dict.
- If template is supplied, it is used insted as the template for the
+ If template is supplied, it is used instead as the template for the
Signature objects generated.
"""
for test_vector in test_vectors:
@@ -1067,7 +1059,7 @@ def _make_vector_or_matrix_test_vectors(test_suite_dict):
return lambda *args: _argument_types_match(args, indices)
def match_simple_binop(x, y):
- """Detemine whether the type of the arguments is compatible
+ """Determine whether the type of the arguments is compatible
for a simple binary operator (such as '+').
Arguments are compatible if one is a scalar and the other is a
@@ -1125,7 +1117,7 @@ def _make_vector_or_matrix_test_vectors(test_suite_dict):
y_type = glsl_type_of(y)
if x_type.base_type not in (glsl_int, glsl_uint, glsl_int64_t, glsl_uint64_t):
return False
- if y_type.base_type not in (glsl_int, glsl_uint):
+ if y_type.base_type not in (glsl_int, glsl_uint, glsl_int64_t, glsl_uint64_t):
return False
if y_type.is_scalar:
return True
@@ -1329,6 +1321,24 @@ def _make_vector_or_matrix_test_vectors(test_suite_dict):
3948976685146,
135763469567146206,
11654173250180970009]]
+ small_uint64s = [np.uint64(x) for x in [0, 1, 2, 5, 25, 31, 32, 47, 63]]
+ small_ivec64s = [
+ np.array([13, 63], dtype=np.int64),
+ np.array([-52, 50], dtype=np.int64),
+ np.array([46, -50, 0], dtype=np.int64),
+ np.array([52, 23, -5], dtype=np.int64),
+ np.array([2, -5, 45, -63], dtype=np.int64),
+ np.array([34, 4, -24, 62], dtype=np.int64),
+ ]
+ small_uvec64s = [
+ np.array([13, 63], dtype=np.uint64),
+ np.array([52, 50], dtype=np.uint64),
+ np.array([24, 61], dtype=np.uint64),
+ np.array([46, 50, 0], dtype=np.uint64),
+ np.array([52, 23, 5], dtype=np.uint64),
+ np.array([2, 5, 45, 63], dtype=np.uint64),
+ np.array([34, 4, 24, 62], dtype=np.uint64),
+ ]
int64vecs = [
np.array([-10, -12], dtype=np.int64),
@@ -1382,7 +1392,7 @@ def _make_vector_or_matrix_test_vectors(test_suite_dict):
should be used to compute the tolerance for the test vectors.
Otherwise, _strict_tolerance is used.
- If template is supplied, it is used insted as the template for
+ If template is supplied, it is used instead as the template for
the Signature objects generated.
"""
test_inputs = make_arguments(test_inputs)
@@ -1670,13 +1680,13 @@ def _make_vector_or_matrix_test_vectors(test_suite_dict):
template='({0} ^ {1})',
extension="ARB_gpu_shader_int64")
f('op-lshift', 2, 150, _lshift, match_shift,
- [int64s+uint64s,
- small_uints],
+ [int64s+int64vecs+uint64s+uint64vecs,
+ small_ints+small_ivecs+small_uints+small_uvecs+small_ivec64s+small_uint64s+small_uvec64s],
template='({0} << {1})',
extension="ARB_gpu_shader_int64")
f('op-rshift', 2, 150, _rshift, match_shift,
- [int64s+uint64s,
- small_uints],
+ [int64s+int64vecs+uint64s+uint64vecs,
+ small_ints+small_ivecs+small_uints+small_uvecs+small_ivec64s+small_uint64s+small_uvec64s],
template='({0} >> {1})',
extension="ARB_gpu_shader_int64")
_make_vector_or_matrix_test_vectors(test_suite)
diff --git a/generated_tests/builtin_function_fp64.py b/generated_tests/builtin_function_fp64.py
index 6776c900d..4e9eb31f5 100644
--- a/generated_tests/builtin_function_fp64.py
+++ b/generated_tests/builtin_function_fp64.py
@@ -619,7 +619,7 @@ def _store_test_vector(test_suite_dict, name, glsl_version, extension, test_vect
glsl_version is adjusted if necessary to reflect when the argument
and return types were introduced into GLSL.
- If template is supplied, it is used insted as the template for the
+ If template is supplied, it is used instead as the template for the
Signature objects generated.
"""
if template is None:
@@ -642,7 +642,7 @@ def _store_test_vectors(test_suite_dict, name, glsl_version, extension,
"""Store multiple test vectors in the appropriate places in
test_suite_dict.
- If template is supplied, it is used insted as the template for the
+ If template is supplied, it is used instead as the template for the
Signature objects generated.
"""
for test_vector in test_vectors:
@@ -863,7 +863,7 @@ def _make_vector_or_matrix_test_vectors(test_suite_dict):
return lambda *args: _argument_types_match(args, indices)
def match_simple_binop(x, y):
- """Detemine whether the type of the arguments is compatible
+ """Determine whether the type of the arguments is compatible
for a simple binary operator (such as '+').
Arguments are compatible if one is a scalar and the other is a
@@ -1086,7 +1086,7 @@ def _make_vector_or_matrix_test_vectors(test_suite_dict):
should be used to compute the tolerance for the test vectors.
Otherwise, _strict_tolerance is used.
- If template is supplied, it is used insted as the template for
+ If template is supplied, it is used instead as the template for
the Signature objects generated.
"""
test_inputs = make_arguments(test_inputs)
diff --git a/generated_tests/gen_builtin_packing_tests.py b/generated_tests/gen_builtin_packing_tests.py
index 9715902a5..e78c2d39c 100644
--- a/generated_tests/gen_builtin_packing_tests.py
+++ b/generated_tests/gen_builtin_packing_tests.py
@@ -944,7 +944,7 @@ def func_info(name, requirements):
- vector_type: The type of the GLSL function's parameter or return value.
E.g., vec4 for a 4x8 function and vec2 for a 2x16 function.
- - requirements: A set of API/extension requirments to be listed in the
+ - requirements: A set of API/extension requirements to be listed in the
.shader_test's [requires] section.
- exact: Whether the generated results must be exact (e.g., 0.0 and 1.0
diff --git a/generated_tests/gen_cl_common_builtins.py b/generated_tests/gen_cl_common_builtins.py
index 0a51c8402..33c889078 100644
--- a/generated_tests/gen_cl_common_builtins.py
+++ b/generated_tests/gen_cl_common_builtins.py
@@ -68,7 +68,8 @@ tests = {
'values': [
[degrees(0.5), degrees(-0.5), 180.0, 0.0, 360, 1800.0, 18000, 90], #Result
[0.5, -0.5, pi, 0.0, 2*pi, 10*pi, 100*pi, pi/2] #Arg0
- ]
+ ],
+ 'tolerance' : 2
},
'max' : {
'arg_types': [F, F, F],
diff --git a/generated_tests/gen_cl_math_builtins.py b/generated_tests/gen_cl_math_builtins.py
index c934f9ce3..d0c5220f2 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -549,7 +549,7 @@ tests = {
],
'num_out_args' : 2
},
-# FIXME: kernel names are broken, and we cant really compare nans to see if the
+# FIXME: kernel names are broken, and we can't really compare nans to see if the
# code made it
# 'nan' : {
# 'arg_types': [F, U],
diff --git a/generated_tests/gen_cl_vload_tests.py b/generated_tests/gen_cl_vload_tests.py
index 0555e7bab..ad0e087bb 100644
--- a/generated_tests/gen_cl_vload_tests.py
+++ b/generated_tests/gen_cl_vload_tests.py
@@ -160,7 +160,7 @@ def gen_test_local_private(suffix, t, mem_type, vec_sizes, addr_space, aligned):
f.close()
-# vload_half is special, becuase CLC won't allow us to use half type without
+# vload_half is special, because CLC won't allow us to use half type without
# cl_khr_fp16
def gen_test_local_private_half(suffix, t, vec_sizes, addr_space, aligned):
f = begin_test(suffix, t, 'half', vec_sizes, addr_space, aligned)
diff --git a/generated_tests/gen_conversion.py b/generated_tests/gen_conversion.py
index 4f4348edb..f3ffcfb6a 100644
--- a/generated_tests/gen_conversion.py
+++ b/generated_tests/gen_conversion.py
@@ -61,10 +61,10 @@ DOUBLE_FLOAT_VALUES = ['0xc7efffffefffffff', # Negative maximum normaliz
'0xc170000000000000', # -16777216.0
'0xc014000000000000', # -5.0
'0xbfff25ce60000000', # -1.9467300176620483
- '0xb80fffffe0000000', # Negative minimum normalized
+ '0xb810000000000000', # Negative minimum normalized
'0xb69fffffffffffff', # Negative underflow
'0x369fffffffffffff', # Positive underflow
- '0x380fffffe0000000', # Positive minimum normalized
+ '0x3810000000000000', # Positive minimum normalized
'0x3fff25ce60000000', # +1.9467300176620483
'0x4014000000000000', # +5.0
'0x4170000000000000', # +16777216.0
diff --git a/generated_tests/gen_interface_block_tests.py b/generated_tests/gen_interface_block_tests.py
new file mode 100644
index 000000000..a789d20fc
--- /dev/null
+++ b/generated_tests/gen_interface_block_tests.py
@@ -0,0 +1,339 @@
+#!/usr/bin/env python3
+# coding=utf-8
+
+# Copyright (c) 2020, 2021 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 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 interface block linker tests"""
+
+import os
+import argparse
+from modules import utils
+from textwrap import dedent
+from templates import template_dir
+
+TEMPLATES = template_dir(os.path.basename(os.path.splitext(__file__)[0]))
+
+def get_array_index(size):
+ return "[" + str(size) + "]" if size > 1 else ""
+
+class BasicType(object):
+ def __init__(self, type_name, subtype=None, size=0, array_size=1, qualifiers=''):
+ self.size = size
+ self.subtype = subtype
+ self._qualifiers = qualifiers
+ self.array_size = array_size
+ self.name = type_name
+
+ def __str__(self):
+ return "{}{}".format(self.name, get_array_index(self.array_size))
+
+ def qualifiers(self):
+ all = set()
+ base_type = self
+ while base_type is not None:
+ all.add(base_type._qualifiers)
+ base_type = base_type.subtype
+ result = " ".join(all).strip()
+ return result + " " if len(result) else ""
+
+ def depth(self):
+ count = 0
+ base_type = self
+ while base_type.has_subtype():
+ base_type = base_type.subtype
+ count += 1
+ return count
+
+ def has_subtype(self):
+ return self.subtype is not None
+
+ def is_array(self):
+ return self.array_size > 1
+
+
+def apply_indent(text, prefix):
+ result = ""
+ for line in text.split('\n'):
+ if len(line):
+ result += "{}{}\n".format(prefix, line)
+ return result.strip("\n")
+
+
+def save_shader_text(filepath, shader_text):
+ with open(filepath, 'w') as test_file:
+ test_file.write(shader_text)
+
+
+def get_tests_path(folder):
+ return os.path.join("spec", "arb_enhanced_layouts", folder)
+
+
+def get_index_var_name(dim):
+ return chr(ord('a') + dim)
+
+
+def get_layout(location_idx):
+ return "layout(location = {}) ".format(location_idx) if location_idx else ""
+
+
+def generate_assignment(base_type, dst, src):
+ deref = ""
+ dimension = 0
+ dimension_num = base_type.depth()
+ while base_type.has_subtype():
+ if base_type.is_array():
+ deref += "[a]"
+ deref += "[{}]".format(get_index_var_name(dimension_num - dimension))
+ base_type = base_type.subtype
+ dimension += 1
+ # `convert` is a predefined function in mako file
+ return "{dst} += convert({src}{deref});".format(dst=dst, src=src,
+ deref=deref)
+
+def generate_conversion_func(base_type):
+ gen_text_mask="""\
+ for (int {idx} = {start}; {idx} < {len}; {idx}++) {{
+ {inner_text}
+ }}"""
+
+ root_type = base_type
+ dimension = 0
+ dimension_num = base_type.depth()
+ loop_code = generate_assignment(base_type, "color", "indata")
+ while base_type.has_subtype():
+ idxname = get_index_var_name(dimension_num - dimension)
+ loop_code = dedent(gen_text_mask).format(idx=idxname,
+ start=0,
+ len=base_type.size,
+ inner_text=apply_indent(loop_code, " " * 4))
+ base_type = base_type.subtype
+ dimension += 1
+
+ if root_type.is_array():
+ loop_code = dedent(gen_text_mask).format(idx='a',
+ start=0,
+ len=root_type.array_size,
+ inner_text=apply_indent(loop_code, " " * 4))
+
+ calc_color = dedent("""\
+ vec4 calc_color(in {} indata{}) {{
+ vec4 color = vec4(0.0);
+ {}
+ return color;
+ }}
+ """).format(root_type.name, get_array_index(root_type.array_size), apply_indent(loop_code, " " * 4))
+ return calc_color
+
+
+def create_args_parser():
+ parser = argparse.ArgumentParser(
+ description="Generate interface block linker tests")
+
+ parser.add_argument(
+ '--script',
+ dest='script',
+ action='store_true',
+ default=False,
+ help="Generate script running the tests (for development)")
+
+ parser.add_argument(
+ '--oob-verbose-mode',
+ dest='oob_verbose_mode',
+ action='store_true',
+ default=False,
+ help="Generate a lot of tests checking the out-of-bounds cases (for development)")
+ return parser
+
+
+class TestEnv(object):
+ def __init__(self, extensions = []):
+ self.extensions = extensions
+
+ def generate_matching_test(self, test_types, filename, block_location):
+ declare_var_template = "{qualifiers}{base_type} {prefix}{var_number}{array_size};\n"
+
+ extensions = ["GL_ARB_enhanced_layouts",
+ "GL_ARB_separate_shader_objects",
+ "GL_ARB_arrays_of_arrays"] + self.extensions
+
+ calc_color_func = ""
+ declare_uniform_types = ""
+ declare_vs_output_types = ""
+ assign_vs_output_types = ""
+ calc_output_color = ""
+
+ unique_types=[]
+ var_number=1
+ for base_type in test_types:
+ declare_uniform_types += declare_var_template.format(qualifiers = "uniform ",
+ base_type = base_type.name,
+ prefix="vs_uniform_",
+ var_number = var_number,
+ array_size = get_array_index(base_type.array_size))
+ declare_vs_output_types += declare_var_template.format(qualifiers = base_type.qualifiers(),
+ base_type = base_type.name,
+ prefix="var_",
+ var_number = var_number,
+ array_size = get_array_index(base_type.array_size))
+ assign_vs_output_types += ("vs_output.var_{var_number} = vs_uniform_{var_number};\n").format(var_number = var_number)
+ calc_output_color += ("fs_output += calc_color(vs_output.var_{var_number});\n").format(var_number = var_number)
+ if str(base_type) not in unique_types:
+ unique_types.append(str(base_type))
+ calc_color_func += generate_conversion_func(base_type)
+ var_number+=1
+
+ templ = TEMPLATES.get_template('basic.shader_test.mako')
+ shadertext = templ.render_unicode(declare_uniform_types=declare_uniform_types,
+ declare_vs_output_types=apply_indent(declare_vs_output_types, " " * 4),
+ assign_vs_output_types=apply_indent(assign_vs_output_types, " " * 4),
+ calc_output_color=apply_indent(calc_output_color, " " * 4),
+ calc_color=calc_color_func,
+ extensions=extensions,
+ layout=get_layout(block_location))
+ save_shader_text(filename, shadertext)
+ print(filename)
+
+ def test_matching(self, test_types, filename):
+ for block_location in [None, 1]:
+ location_name = "_loc_{}".format(block_location) if block_location else ""
+ fullname=get_tests_path("") + filename + location_name + ".shader_test"
+ self.generate_matching_test(test_types, fullname, block_location)
+ return self
+
+
+def main():
+ """Main function."""
+
+ parser = create_args_parser()
+ args = parser.parse_args()
+
+ if args.script:
+ print("#!/bin/bash")
+ print("SHADER_RUNNER=bin/shader_runner")
+
+ utils.safe_makedirs(get_tests_path(""))
+
+ flat_qualifier="flat"
+ ALL_ATTR_TYPES = [
+ BasicType("float"),
+ BasicType("vec2", BasicType("float"), 2),
+ BasicType("vec3", BasicType("float"), 3),
+ BasicType("vec4", BasicType("float"), 4),
+
+ BasicType("int" , qualifiers=flat_qualifier),
+ BasicType("ivec2", BasicType("int"), 2, qualifiers=flat_qualifier),
+ BasicType("ivec3", BasicType("int"), 3, qualifiers=flat_qualifier),
+ BasicType("ivec4", BasicType("int"), 4, qualifiers=flat_qualifier),
+
+ BasicType("uint" , qualifiers=flat_qualifier),
+ BasicType("uvec2", BasicType("uint"), 2, qualifiers=flat_qualifier),
+ BasicType("uvec3", BasicType("uint"), 3, qualifiers=flat_qualifier),
+ BasicType("uvec4", BasicType("uint"), 4, qualifiers=flat_qualifier),
+
+ BasicType("mat2" , BasicType("vec2", BasicType("float"), 2), 2),
+ BasicType("mat3x2", BasicType("vec2", BasicType("float"), 2), 3),
+ BasicType("mat4x2", BasicType("vec2", BasicType("float"), 2), 4),
+
+ BasicType("mat2x3", BasicType("vec3", BasicType("float"), 3), 2),
+ BasicType("mat3" , BasicType("vec3", BasicType("float"), 3), 3),
+ BasicType("mat4x3", BasicType("vec3", BasicType("float"), 3), 4),
+
+ BasicType("mat2x4", BasicType("vec4", BasicType("float"), 4), 2),
+ BasicType("mat3x4", BasicType("vec4", BasicType("float"), 4), 3),
+ BasicType("mat4" , BasicType("vec4", BasicType("float"), 4), 4),
+ ]
+
+ ALL_ATTR_TYPES_FP64 = [
+ BasicType("double", qualifiers=flat_qualifier),
+ BasicType("dvec2", BasicType("double"), 2, qualifiers=flat_qualifier),
+ BasicType("dvec3", BasicType("double"), 3, qualifiers=flat_qualifier),
+ BasicType("dvec4", BasicType("double"), 4, qualifiers=flat_qualifier),
+
+ BasicType("dmat2" , BasicType("dvec2", BasicType("double"), 2), 2, qualifiers=flat_qualifier),
+ BasicType("dmat3x2", BasicType("dvec2", BasicType("double"), 2), 3, qualifiers=flat_qualifier),
+ BasicType("dmat4x2", BasicType("dvec2", BasicType("double"), 2), 4, qualifiers=flat_qualifier),
+
+ BasicType("dmat2x3", BasicType("dvec3", BasicType("double"), 3), 2, qualifiers=flat_qualifier),
+ BasicType("dmat3" , BasicType("dvec3", BasicType("double"), 3), 3, qualifiers=flat_qualifier),
+ BasicType("dmat4x3", BasicType("dvec3", BasicType("double"), 3), 4, qualifiers=flat_qualifier),
+
+ BasicType("dmat2x4", BasicType("dvec4", BasicType("double"), 4), 2, qualifiers=flat_qualifier),
+ BasicType("dmat3x4", BasicType("dvec4", BasicType("double"), 4), 3, qualifiers=flat_qualifier),
+ BasicType("dmat4" , BasicType("dvec4", BasicType("double"), 4), 4, qualifiers=flat_qualifier),
+ ]
+
+ ALL_ATTR_TYPES_64BIT = [
+ BasicType("int64_t", qualifiers=flat_qualifier),
+ BasicType("i64vec2", BasicType("int64_t"), 2, qualifiers=flat_qualifier),
+ BasicType("i64vec3", BasicType("int64_t"), 3, qualifiers=flat_qualifier),
+ BasicType("i64vec4", BasicType("int64_t"), 4, qualifiers=flat_qualifier),
+
+ BasicType("uint64_t", qualifiers=flat_qualifier),
+ BasicType("u64vec2", BasicType("uint64_t"), 2, qualifiers=flat_qualifier),
+ BasicType("u64vec3", BasicType("uint64_t"), 3, qualifiers=flat_qualifier),
+ BasicType("u64vec4", BasicType("uint64_t"), 4, qualifiers=flat_qualifier),
+ ]
+
+
+ for i in range(0, 3, 1):
+ ATTR_TYPES = []
+ for j in range(0 + i, 21 + i, 3):
+ ATTR_TYPES.append(ALL_ATTR_TYPES[j])
+ TestEnv().test_matching(ATTR_TYPES, ("matching_basic_types_{}").format(i + 1))
+
+
+ for i in range(0, 2, 1):
+ ATTR_TYPES = []
+ for j in range(0, 4, 1):
+ ATTR_TYPES.append(ALL_ATTR_TYPES_64BIT[i + 2 * j])
+ TestEnv(["GL_ARB_gpu_shader_int64"]).test_matching(ATTR_TYPES, ("matching_64bit_types_{}").format(i + 1))
+
+ for i in range(0, 3, 1):
+ ATTR_TYPES = [ALL_ATTR_TYPES_FP64[0],
+ ALL_ATTR_TYPES_FP64[1],
+ ALL_ATTR_TYPES_FP64[2],
+ ALL_ATTR_TYPES_FP64[3]]
+
+ ATTR_TYPES.append(ALL_ATTR_TYPES_FP64[4 + i])
+ ATTR_TYPES.append(ALL_ATTR_TYPES_FP64[7 + i])
+ ATTR_TYPES.append(ALL_ATTR_TYPES_FP64[10 + i])
+ TestEnv(["GL_ARB_gpu_shader_fp64"]).test_matching(ATTR_TYPES, ("matching_fp64_types_{}").format(i + 1))
+
+
+ #test https://gitlab.freedesktop.org/mesa/mesa/-/issues/3320
+ ATTR_TYPES = [
+ BasicType("vec2", BasicType("float"), 2),
+ BasicType("vec3", BasicType("float"), 3),
+ BasicType("float" , qualifiers=flat_qualifier),
+ BasicType("vec3", BasicType("float"), 3, array_size=3),
+ BasicType("vec4", BasicType("float"), 4),
+ BasicType("vec3", BasicType("float"), 3),
+ BasicType("vec3", BasicType("float"), 3),
+ ]
+ TestEnv().test_matching(ATTR_TYPES, ("matching_basic_types_custom"))
+
+ #TestEnv(args, ATTR_TYPES, get_tests_path("execution/io-block-oob/basic-types"), [], True).test_oob()
+ #TestEnv(args, ATTR_TYPES_FP64, get_tests_path("execution/io-block-oob/fp64-types"), ["GL_ARB_gpu_shader_fp64"], True).test_oob()
+ #TestEnv(args, ATTR_TYPES_64BIT, get_tests_path("execution/io-block-oob/64bit-types"), ["GL_ARB_gpu_shader_int64"], True).test_oob()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/generated_tests/gen_variable_index_write_tests.py b/generated_tests/gen_variable_index_write_tests.py
index 8b422730b..b0182c4bd 100644
--- a/generated_tests/gen_variable_index_write_tests.py
+++ b/generated_tests/gen_variable_index_write_tests.py
@@ -186,7 +186,7 @@ class TestParams(object):
"""Generate the matrix used in a test section.
This will take the matrix used by the test, and replace specific values
- with sentinal values, and return the matrix as a string.
+ with sentinel values, and return the matrix as a string.
"""
bad = ['666.0', '777.0', '888.0', '999.0']
diff --git a/generated_tests/gen_vp_tex.py b/generated_tests/gen_vp_tex.py
index 7312e6f5c..fa7539ebd 100644
--- a/generated_tests/gen_vp_tex.py
+++ b/generated_tests/gen_vp_tex.py
@@ -41,7 +41,7 @@ def main():
targets_1 = ["1D", "2D", "3D", "CUBE", "RECT", "SHADOW1D", "SHADOW2D"]
- # The ordering in this loop is wierd, it's an artifact of the growth of the
+ # The ordering in this loop is weird, it's an artifact of the growth of the
# original script and is required to ensure that the names of the tests
# don't change
for inst in ["TEX", "TXB", "TXD", "TXF", "TXL", "TXP", "TXQ"]:
diff --git a/generated_tests/modules/glsl.py b/generated_tests/modules/glsl.py
index ca52987f9..37cb14abb 100644
--- a/generated_tests/modules/glsl.py
+++ b/generated_tests/modules/glsl.py
@@ -220,7 +220,7 @@ class _MinVersion(object):
'tese': Version('400'),
'comp': Version('430'),
}
- # Only versions that actaly change are here, the function will return the
+ # Only versions that actually change are here, the function will return the
# values from __gl_stage_min if they're not here
__gl_stage_min_ext = {
# geometry_shader4 is not included here intentionally. It is
@@ -237,7 +237,7 @@ class _MinVersion(object):
'tesc': Version('320 es'),
'tese': Version('320 es'),
}
- # Only versions that actaly change are here, the function will return the
+ # Only versions that actually change are here, the function will return the
# values from __gles_stage_min if they're not here
__gles_stage_min_ext = {
'geom': (Version('310 es'), 'GL_OES_geometry_shader'),
diff --git a/generated_tests/modules/types.py b/generated_tests/modules/types.py
index 0486c2fd3..73c21de68 100644
--- a/generated_tests/modules/types.py
+++ b/generated_tests/modules/types.py
@@ -114,7 +114,7 @@ class Type(object):
signed -- True if the type is a signed type
float -- True if the type is a floating point type
size -- The integer size of the type (8, 16, 32, 64, 128, etc)
- name -- A formated string name of the type. (float, double, int64, ...)
+ name -- A formatted string name of the type. (float, double, int64, ...)
"""
def __init__(self, name, integer=False, signed=False, floating=False,
diff --git a/generated_tests/random_ubo.py b/generated_tests/random_ubo.py
index 90e9cea8b..f36b8b310 100644
--- a/generated_tests/random_ubo.py
+++ b/generated_tests/random_ubo.py
@@ -895,7 +895,7 @@ def fudge_type_for_setter(type):
def bit_exact_data(raw_data, type):
"""Several places in the test want bit-exact data for all types.
For integer types, this is just the raw data. For floating point (both
- single and double precission) types, the bit-exact data is the hex
+ single and double precision) types, the bit-exact data is the hex
representation of the IEEE 754 encoding.
"""
if type in ["float", "vec2", "vec3", "vec4",
diff --git a/generated_tests/templates/__init__.py b/generated_tests/templates/__init__.py
index cdc108815..251ab22b0 100644
--- a/generated_tests/templates/__init__.py
+++ b/generated_tests/templates/__init__.py
@@ -56,7 +56,7 @@ def template_file(generator, template):
If the generator uses more than one template use template_dir instead.
Arguments:
- generator -- the name of the generator, which coresponds to the subdir of
+ generator -- the name of the generator, which corresponds to the subdir of
the templates folder.
template -- the name of the template to get. If getting a single template
it's probably template.*.mako, where * is shader_test,
@@ -80,7 +80,7 @@ def template_dir(generator):
This is useful if a generator uses more than one template.
Arguments:
- generator -- the name of the generator, which coresponds to the subdir of
+ generator -- the name of the generator, which corresponds to the subdir of
the templates folder.
"""
diff --git a/generated_tests/templates/gen_interface_block_tests/basic.shader_test.mako b/generated_tests/templates/gen_interface_block_tests/basic.shader_test.mako
new file mode 100644
index 000000000..221a38a3e
--- /dev/null
+++ b/generated_tests/templates/gen_interface_block_tests/basic.shader_test.mako
@@ -0,0 +1,66 @@
+[require]
+GLSL >= 1.50
+% for ext in extensions:
+${ext}
+% endfor
+
+[vertex shader]
+#version 150
+% for ext in extensions:
+#extension ${ext}: require
+% endfor
+
+${declare_uniform_types}
+
+${layout}out VS_OUTPUT {
+${declare_vs_output_types}
+} vs_output;
+
+void main()
+{
+${assign_vs_output_types}
+}
+
+[fragment shader]
+#version 150
+% for ext in extensions:
+#extension ${ext}: require
+% endfor
+
+${layout}in VS_OUTPUT {
+${declare_vs_output_types}
+} vs_output;
+
+out vec4 fs_output;
+
+% if 'GL_ARB_gpu_shader_fp64' in extensions:
+vec4 convert(in double val)
+{
+ return vec4(val);
+}
+% endif
+% if 'GL_ARB_gpu_shader_int64' in extensions:
+vec4 convert(in int64_t val)
+{
+ return vec4(val);
+}
+vec4 convert(in uint64_t val)
+{
+ return vec4(val);
+}
+% endif
+vec4 convert(in float val)
+{
+ return vec4(val);
+}
+
+${calc_color}
+void main()
+{
+ fs_output = vec4(0);
+${calc_output_color}
+}
+
+[test]
+link success
+draw rect -1 -1 2 2
diff --git a/generated_tests/templates/gen_variable_index_write_tests/helpers.mako b/generated_tests/templates/gen_variable_index_write_tests/helpers.mako
index f4236acfc..fc549a65a 100644
--- a/generated_tests/templates/gen_variable_index_write_tests/helpers.mako
+++ b/generated_tests/templates/gen_variable_index_write_tests/helpers.mako
@@ -127,7 +127,7 @@
% if params.array_dim != 0:
*
* NOTE: This test assumes that reads of arrays using non-constant
- * indicies works correctly. If reads and writes happen to fail in an
+ * indices works correctly. If reads and writes happen to fail in an
* identical manner, this test may give false positives.
% endif
*/