summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--generated_tests/CMakeLists.txt8
-rw-r--r--generated_tests/gen_inout_64bit_tests.py536
-rw-r--r--generated_tests/gen_inout_fp64.py43
-rw-r--r--generated_tests/random_ubo.py78
-rw-r--r--generated_tests/templates/gen_inout_fp64/template.shader_test.mako60
-rw-r--r--tests/egl/egl-ext_egl_image_storage.c16
-rw-r--r--tests/opengl.py2
-rw-r--r--tests/shaders/glsl-fs-loop-unroll-ishl-int64.shader_test46
-rw-r--r--tests/shaders/glsl-fs-loop-unroll-ishl.shader_test44
-rw-r--r--tests/shaders/glsl-fs-loop-unroll-mul-fp64.shader_test40
-rw-r--r--tests/shaders/glsl-fs-loop-unroll-mul-int64.shader_test54
-rw-r--r--tests/shaders/glsl-fs-loop-unroll-mul.shader_test67
-rw-r--r--tests/shaders/useprogram-refcount-1.c109
-rw-r--r--tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-simple-different-formats.shader_test68
-rw-r--r--tests/spec/arb_separate_shader_objects/mix-and-match-tcs-tes.c19
-rw-r--r--tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt1
-rw-r--r--tests/spec/arb_shader_storage_buffer_object/issue1258.c164
-rw-r--r--tests/spec/arb_shading_language_include/compile/path_not_in_directive.frag14
-rw-r--r--tests/spec/ext_texture_norm16/render.c36
-rw-r--r--tests/spec/glsl-1.10/compiler/arithmetic-on-non-existing-variable.vert11
-rw-r--r--tests/spec/glsl-1.10/compiler/literals/invalid-string.vert10
-rw-r--r--tests/spec/glsl-1.10/execution/cmod-cmp-to-add-e.shader_test30
-rw-r--r--tests/spec/glsl-1.10/execution/cmod-cmp-to-add-g.shader_test30
-rw-r--r--tests/spec/glsl-1.10/execution/cmod-cmp-to-add-ge.shader_test30
-rw-r--r--tests/spec/glsl-1.10/execution/cmod-cmp-to-add-l.shader_test30
-rw-r--r--tests/spec/glsl-1.10/execution/cmod-cmp-to-add-le.shader_test30
-rw-r--r--tests/spec/glsl-1.10/execution/cmod-cmp-to-add-ne.shader_test30
-rw-r--r--tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-mat4-out-of-bounds-const-1.vert18
-rw-r--r--tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-mat4-out-of-bounds-const-2.vert18
-rw-r--r--tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-mat4-out-of-bounds-const-3.vert19
-rw-r--r--tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-vec4-out-of-bounds-const-1.vert19
-rw-r--r--tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-vec4-out-of-bounds-const-2.vert19
-rw-r--r--tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-vec4-out-of-bounds-const-3.vert20
-rw-r--r--tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-1.shader_test29
-rw-r--r--tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-2.shader_test31
-rw-r--r--tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-3.shader_test31
-rw-r--r--tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-4.shader_test31
-rw-r--r--tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-5.shader_test31
-rw-r--r--tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-6.shader_test29
-rw-r--r--tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-7.shader_test33
-rw-r--r--tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-1.shader_test29
-rw-r--r--tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-2.shader_test31
-rw-r--r--tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-3.shader_test31
-rw-r--r--tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-4.shader_test31
-rw-r--r--tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-5.shader_test31
-rw-r--r--tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-6.shader_test29
-rw-r--r--tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-7.shader_test33
48 files changed, 1964 insertions, 187 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d8e68fd1e..7a78ca281 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,6 +21,8 @@ endif()
project (piglit)
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
# Require MinGW
if (MSVC)
message (FATAL_ERROR "Windows builds require MinGW")
diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
index 87ce9ee5c..dcee62a3a 100644
--- a/generated_tests/CMakeLists.txt
+++ b/generated_tests/CMakeLists.txt
@@ -133,7 +133,6 @@ piglit_make_generated_tests(
gen_inout_fp64.py
templates/gen_inout_fp64/template.frag.mako
templates/gen_inout_fp64/template.vert.mako
- templates/gen_inout_fp64/template.shader_test.mako
)
piglit_make_generated_tests(
flat_interpolation_qualifier.list
@@ -221,8 +220,10 @@ piglit_make_generated_tests(
templates/gen_intel_shader_integer_functions2_tests/addSaturate.shader_test.mako
templates/gen_intel_shader_integer_functions2_tests/countLeadingZeros.shader_test.mako
templates/gen_intel_shader_integer_functions2_tests/multiply32x16.shader_test.mako
- templates/gen_intel_shader_integer_functions2_tests/subtractSaturate.shader_test.mako
- )
+ templates/gen_intel_shader_integer_functions2_tests/subtractSaturate.shader_test.mako)
+piglit_make_generated_tests(
+ inout_64bit.list
+ gen_inout_64bit_tests.py)
# OpenCL Test generators
piglit_make_generated_tests(
@@ -291,6 +292,7 @@ add_custom_target(gen-gl-tests
variable_index_write_tests.list
vs_in_fp64.list
gpu_shader4_tests.list
+ inout_64bit.list
)
# Create a custom target for generating OpenCL tests
diff --git a/generated_tests/gen_inout_64bit_tests.py b/generated_tests/gen_inout_64bit_tests.py
new file mode 100644
index 000000000..5677eb27e
--- /dev/null
+++ b/generated_tests/gen_inout_64bit_tests.py
@@ -0,0 +1,536 @@
+#!/usr/bin/env python3
+# coding=utf-8
+
+# Copyright (c) 2019 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 in/out tests for 64 bit types. """
+
+import os
+import errno
+import collections
+import copy
+import random_ubo
+
+from textwrap import dedent
+from mako.template import Template
+
+
+class VaryingType(object):
+ __slots__ = ['type', 'members', 'name']
+
+ def __init__(self, type, members=None):
+ self.type = type
+ self.members = members
+ self.name = None
+
+
+VaryingInstance = collections.namedtuple(
+ 'VaryingInstance', ['varying_type', 'setters', 'checkers', 'full_name'])
+
+
+def scalar_assignment(type, name, data):
+ """Return a GLSL code string to assign a scalar to its expected value."""
+ if type == "bool":
+ if int(data) == 0:
+ return "{} = {};".format(name,
+ 'false' if int(data) == 0 else 'true')
+ elif type == "uint":
+ return "{} = {}u;".format(name, data)
+ elif type == "int":
+ return "{} = {};".format(name, data)
+ elif type == "uint64_t":
+ return "{} = {}ul;".format(name, data)
+ elif type == "int64_t":
+ return "{} = {}l;".format(name, data)
+ elif type == "float":
+ # Not all implementations support the bit-cast operators that are used
+ # to do bit-exact comparisons. For this reason float_match needs the
+ # float data and the bit-exact data.
+
+ bits = random_ubo.bit_exact_data(data, "float")
+ return "{} = float_get({}, {}u);".format(name, data, bits)
+ elif type == "double":
+ bits = random_ubo.bit_exact_data(data, "double")
+
+ # 0xHHHHHHHHLLLLLLLL
+ # 012345678901234567
+
+ hi = "0x" + bits[2:10]
+ lo = "0x" + bits[10:18]
+
+ return "{} = double_get(uvec2({}, {}));".format(name, lo, hi)
+ else:
+ raise Exception("Unknown scalar type {}".format(type))
+
+
+def vector_assignment(type, name, data):
+ """Return a list of GLSL code strings that assign each field of a vector
+ to its expected value.
+ """
+ scalar = random_ubo.vector_base_type(type)
+ components = ["x", "y", "z", "w"]
+
+ return [scalar_assignment(scalar,
+ "{}.{}".format(name, "xyzw"[i]),
+ data[i])
+ for i in range(random_ubo.vector_size(type))]
+
+
+def matrix_assignment(type, name, data):
+ """Return a list of GLSL code strings that assign each field of a matrix
+ its expected value.
+ """
+ c, r = random_ubo.matrix_dimensions(type)
+
+ if type[0] == 'd':
+ column_type = "dvec{}".format(r)
+ else:
+ column_type = "vec{}".format(r)
+
+ data_pairs = []
+
+ for i in range(c):
+ data_pairs.extend(vector_assignment(
+ column_type,
+ "{}[{}]".format(name, i),
+ data[(i * r):(i * r) + r]))
+
+ return data_pairs
+
+
+def create_array(base_type, size):
+ return "{}[{}]".format(base_type, size)
+
+
+def array_base_type(varying_type):
+ t = copy.copy(varying_type)
+ t.type = random_ubo.array_base_type(t.type)
+ t.name = None
+ return t
+
+
+def create_getters_and_setters(varying_type, full_name, instances):
+ if not full_name:
+ full_name = varying_type.name
+ elif varying_type.name is not None:
+ full_name += '.' + varying_type.name
+
+ if random_ubo.isarray(varying_type.type):
+ base_type = array_base_type(varying_type)
+ for i in range(random_ubo.array_elements(varying_type.type)):
+ indexed_name = full_name + '[' + str(i) + ']'
+ create_getters_and_setters(base_type, indexed_name, instances)
+
+ elif random_ubo.isstructure(varying_type.type):
+ for m in varying_type.members:
+ create_getters_and_setters(m, full_name, instances)
+
+ else:
+ v = VaryingInstance(varying_type, [], [], full_name)
+
+ raw_data = random_ubo.random_data(varying_type.type, full_name, 0)
+ data = raw_data.split(" ")
+
+ if random_ubo.isscalar(varying_type.type):
+ v.checkers.append(random_ubo.scalar_derp(varying_type.type,
+ full_name,
+ data[0]))
+ v.setters.append(
+ scalar_assignment(varying_type.type, full_name, data[0]))
+ elif random_ubo.isvector(varying_type.type):
+ v.checkers.extend(random_ubo.vector_derp(varying_type.type,
+ full_name,
+ data))
+ v.setters.extend(
+ vector_assignment(varying_type.type, full_name, data))
+ elif random_ubo.ismatrix(varying_type.type):
+ v.checkers.extend(random_ubo.matrix_derp(varying_type.type,
+ full_name,
+ data))
+ v.setters.extend(
+ matrix_assignment(varying_type.type, full_name, data))
+
+ instances.append(v)
+
+
+def assign_names(varying_type, names):
+ if random_ubo.isarray(varying_type.type):
+ varying_type.name = names.get_name(
+ random_ubo.without_array(varying_type.type))
+ else:
+ varying_type.name = names.get_name(varying_type.type)
+
+ if varying_type.members:
+ for m in varying_type.members:
+ assign_names(m, names)
+
+
+def gather_structs(varying_type, structs):
+ if random_ubo.isarray(varying_type.type):
+ base_type = array_base_type(varying_type)
+ gather_structs(base_type, structs)
+ elif random_ubo.isstructure(varying_type.type):
+ for m in varying_type.members:
+ gather_structs(m, structs)
+
+ structs.append(varying_type)
+
+
+def stringify_array_dimensions(type):
+ s = ""
+ base_type = type
+ while random_ubo.isarray(base_type):
+ s += "@{}".format(random_ubo.array_elements(base_type))
+ base_type = random_ubo.array_base_type(base_type)
+ return s
+
+
+def stringify_varying_type(varying_type):
+ if random_ubo.isarray(varying_type.type):
+ name = "{}{}".format(random_ubo.without_array(varying_type.type),
+ stringify_array_dimensions(varying_type.type))
+ else:
+ name = varying_type.type
+
+ if varying_type.members:
+ for m in varying_type.members:
+ name += "-" + stringify_varying_type(m)
+
+ return name
+
+
+def generate_file_name(root_types, explicit_locations):
+ name = "vs-out-fs-in-"
+ name += "-and-".join(
+ [stringify_varying_type(t) for t in root_types])
+ if explicit_locations:
+ name += "-location-0"
+ return name + ".shader_test"
+
+
+def do_test(root_types, explicit_locations, glsl_version, extensions,
+ tests_path):
+ if explicit_locations and len(root_types) > 1:
+ return
+
+ basename = generate_file_name(root_types, explicit_locations)
+ fullname = os.path.join(tests_path, basename)
+
+ print(fullname)
+
+ shader_file = open(fullname, "w", buffering=1)
+
+ names = random_ubo.unique_name_dict()
+
+ instances = []
+ structs = []
+
+ for type in root_types:
+ assign_names(type, names)
+ create_getters_and_setters(type, None, instances)
+ gather_structs(type, structs)
+
+ t = Template(dedent("""\
+ [require]
+ GLSL >= ${glsl_version // 100}.${glsl_version % 100}
+ % for ext in extensions:
+ ${ext}
+ % endfor
+
+ % if explicit_locations:
+ GL_ARB_explicit_attrib_location
+ % endif
+
+ [vertex shader]
+ % for ext in extensions:
+ #extension ${ext}: require
+ % endfor
+ #extension GL_ARB_shader_bit_encoding: enable
+ #extension GL_ARB_gpu_shader5: enable
+
+ % if explicit_locations:
+ #extension GL_ARB_explicit_attrib_location : require
+ % endif
+
+ precision highp float;
+ % for s in structures:
+
+ struct ${s.type} {
+ % for m in s.members:
+ ${"{:<15}".format(m.type)} ${m.name};
+ % endfor
+ };
+ % endfor
+
+ % for r in root_types:
+ % if explicit_locations:
+ layout(location = 0)
+ % endif
+ flat out ${"{:<10}".format(r.type)} ${r.name};
+ % endfor
+
+ in vec4 piglit_vertex;
+
+ #if defined(GL_ARB_shader_bit_encoding) || defined(GL_ARB_gpu_shader5) || __VERSION__ >= 430
+ float float_get(float f, uint bits) { return uintBitsToFloat(bits); }
+ #else
+ float float_get(float f, uint bits) { return f; }
+ #endif
+ % if glsl_version >= 400 or "GL_ARB_gpu_shader_fp64" in extensions:
+ double double_get(uvec2 bits) { return packDouble2x32(bits); }
+ %endif
+
+ void main()
+ {
+ % for inst in instances:
+ % for s in inst.setters:
+ ${s}
+ % endfor
+ % endfor
+
+ gl_Position = piglit_vertex;
+ }
+
+ [fragment shader]
+ % for ext in extensions:
+ #extension ${ext}: require
+ % endfor
+ #extension GL_ARB_shader_bit_encoding: enable
+ #extension GL_ARB_gpu_shader5: enable
+
+ % if explicit_locations:
+ #extension GL_ARB_explicit_attrib_location : require
+ % endif
+
+ precision highp float;
+
+ % for s in structures:
+ struct ${s.type} {
+ % for m in s.members:
+ ${"{:<15}".format(m.type)} ${m.name};
+ % endfor
+ };
+ % endfor
+
+ % for r in root_types:
+ % if explicit_locations:
+ layout(location = 0)
+ % endif
+ flat in ${"{:<11}".format(r.type)} ${r.name};
+ % endfor
+
+ out vec4 piglit_fragcolor;
+
+ #if defined(GL_ARB_shader_bit_encoding) || defined(GL_ARB_gpu_shader5) || __VERSION__ >= 430
+ bool float_match(float u, float f, uint bits) { return floatBitsToUint(u) == bits; }
+ #else
+ bool float_match(float u, float f, uint bits) { return u == f; }
+ #endif
+ % if glsl_version >= 400 or "GL_ARB_gpu_shader_fp64" in extensions:
+ bool double_match(double u, uvec2 bits) { return unpackDouble2x32(u) == bits; }
+ %endif
+
+ void main()
+ {
+ bool pass = true;
+
+ % for inst in instances:
+ % for s in inst.checkers:
+ if (${s})
+ pass = false;
+ % endfor
+ % endfor
+
+ piglit_fragcolor = pass ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1);
+ }
+
+ [test]
+ link success
+
+ draw rect -1 -1 2 2
+ probe all rgba 0.0 1.0 0.0 1.0"""))
+
+ shader = t.render(glsl_version=glsl_version,
+ root_types=root_types,
+ explicit_locations=explicit_locations,
+ structures=structs,
+ extensions=extensions,
+ instances=instances)
+
+ shader_file.write(shader)
+ shader_file.close()
+
+
+def do_test_permutations(root_types, glsl_version, extensions, tests_path):
+ without_outer_struct = []
+ for type in root_types:
+ if random_ubo.isstructure(type.type):
+ without_outer_struct.extend(m for m in type.members)
+ else:
+ without_outer_struct.append(type)
+
+ do_test(root_types, False, glsl_version, extensions, tests_path)
+ do_test(root_types, True, glsl_version,
+ extensions + ["GL_ARB_separate_shader_objects"], tests_path)
+ do_test(without_outer_struct, False, glsl_version, extensions, tests_path)
+
+
+fp64_ext_path = os.path.join("spec", "arb_gpu_shader_fp64", "execution",
+ "inout")
+fp64_core_path = os.path.join("spec", "glsl-4.00", "execution",
+ "inout")
+int64_path = os.path.join("spec", "arb_gpu_shader_int64", "execution",
+ "inout")
+
+for path in [fp64_ext_path, fp64_core_path, int64_path]:
+ try:
+ os.makedirs(path)
+ except OSError as exc:
+ if exc.errno != errno.EEXIST or not os.path.isdir(path):
+ raise
+
+INT64_VEC_TYPES = [None, "int64_t", "i64vec2", "i64vec3", "i64vec4"]
+UINT64_VEC_TYPES = [None, "uint64_t", "u64vec2", "u64vec3", "u64vec4"]
+FLOAT_VEC_TYPES = [None, "float", "vec2", "vec3", "vec4"]
+DOUBLE_VEC_TYPES = [None, "double", "dvec2", "dvec3", "dvec4"]
+
+DOUBLE_MAT_TYPES = ["dmat2x2", "dmat2x3", "dmat2x4", "dmat3x2", "dmat3x3",
+ "dmat3x4", "dmat4x2", "dmat4x3", "dmat4x4"]
+
+VT = VaryingType
+
+
+def do_common_64bit_tests(glsl_version, extensions, name_arr, tests_path):
+ tests = []
+ for i in range(1, 4):
+ tests.append([VT("S1", [VT(name_arr[i])])])
+
+ tests.append([VT("S1", [VT(name_arr[i] + "[4]")])])
+
+ for j in range(1, 4):
+ tests.append([VT("S1", [VT(FLOAT_VEC_TYPES[j]), VT(name_arr[i])])])
+
+ tests.append([VaryingType("S1",
+ [VT("float"), VT("float"), VT("float"),
+ VT(name_arr[i])])])
+
+ for j in range(2, 5):
+ tests.append([VT("S1",
+ [VT("float[{}]".format(j)),
+ VT(name_arr[i])])])
+
+ tests.append([VT("S1", [VT(name_arr[i] + "[3]")])])
+
+ tests.append([VT("S1",
+ [VT("S2[3]", [VT(name_arr[i]), VT("float")])])])
+
+ tests.append([VT("S1",
+ [VT("S2", [VT(name_arr[i])])])])
+
+ for i in range(1, 2):
+ tests.append([VT("S1",
+ [VT("S2[2]",
+ [VT("S3[2]", [
+ VT("float"),
+ VT(name_arr[i])])])])])
+
+ tests.append([VT("S1",
+ [VT("S2[2]",
+ [VT("S3[2]", [
+ VT("vec3"),
+ VT(name_arr[i])])])])])
+
+ tests.append([VT("S1[2]",
+ [VT("S2[2]",
+ [VT("S3[2]", [
+ VT(name_arr[i])])])])])
+
+ for t in tests:
+ do_test_permutations(t, glsl_version, extensions, tests_path)
+
+ tests = []
+
+ for i in range(1, 2):
+ tests.append([VT("S1",
+ [VT(name_arr[i] + "[3][2]")])])
+ for i in range(1, 2):
+ for j in range(1, 4):
+ tests.append([VT("S1",
+ [VT(FLOAT_VEC_TYPES[j]),
+ VT(name_arr[i] + "[3][2]")])])
+
+ for i in range(1, 2):
+ for j in range(1, 4):
+ tests.append([VT("S1", [VT("S2[2][2]",
+ [VT(FLOAT_VEC_TYPES[j]),
+ VT(name_arr[i])])])])
+
+ for i in range(3, 4):
+ tests.append([VT("S1", [VT(name_arr[i] + "[2][2]")])])
+
+ for t in tests:
+ do_test_permutations(t, glsl_version,
+ extensions + ["GL_ARB_arrays_of_arrays"],
+ tests_path)
+
+
+def do_fp64_specific_tests():
+ tests = []
+
+ for t in DOUBLE_MAT_TYPES:
+ tests.append([VT("S1", [VT(t)])])
+
+ for t in ["dmat2x2", "dmat2x3", "dmat2x4", "dmat3x2", "dmat3x3"]:
+ for j in range(1, 4):
+ tests.append([VT("S1", [VT(FLOAT_VEC_TYPES[j]), VT(t)])])
+
+ for j in range(1, 7):
+ tests.append([VT("S1",
+ [VT("float[{}]".format(j)), VT(t)])])
+
+ for j in range(1, 4):
+ tests.append([VT("S1", [VT("S2[2]",
+ [VT(FLOAT_VEC_TYPES[j]),
+ VT("dmat2x2")])])])
+
+ tests.append([VT("S1",
+ [VT("double"), VT("float"), VT("double[2]"),
+ VT("float[3]"), VT("dmat2x2")])])
+
+ tests.append([VT("S1",
+ [VT("S2", [VT("double")]),
+ VT("S3", [VT("float")]),
+ VT("S4", [VT("dmat3x3")])])])
+
+ for t in tests:
+ do_test_permutations(t, 150, ["GL_ARB_gpu_shader_fp64"], fp64_ext_path)
+ do_test_permutations(t, 400, [], fp64_core_path)
+
+
+do_common_64bit_tests(400, [], DOUBLE_VEC_TYPES, fp64_core_path)
+do_common_64bit_tests(150, ["GL_ARB_gpu_shader_fp64"], DOUBLE_VEC_TYPES,
+ fp64_ext_path)
+do_common_64bit_tests(150, ["GL_ARB_gpu_shader_int64"], INT64_VEC_TYPES,
+ int64_path)
+do_common_64bit_tests(150, ["GL_ARB_gpu_shader_int64"], UINT64_VEC_TYPES,
+ int64_path)
+
+do_fp64_specific_tests()
diff --git a/generated_tests/gen_inout_fp64.py b/generated_tests/gen_inout_fp64.py
index c22bb33d1..d36a9a1d6 100644
--- a/generated_tests/gen_inout_fp64.py
+++ b/generated_tests/gen_inout_fp64.py
@@ -21,7 +21,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
-"""Generate in/out fp64 tests."""
+"""Generate in/out fp64 compilation tests."""
import argparse
import os
@@ -72,28 +72,6 @@ def generate_compilation_tests(type_name, shader, ver, names_only):
extra_params=',0.0' if type_name in ['dvec2', 'dvec3'] else ''))
-def generate_execution_tests(type_name, ver, names_only):
- """Generate in/out shader runner tests."""
-
- assert isinstance(type_name, str)
- assert isinstance(ver, str)
- assert isinstance(names_only, bool)
-
- filename = os.path.join(
- get_dir_name(ver, 'execution'),
- 'vs-out-fs-in-{0}.shader_test'.format(type_name))
-
- print(filename)
-
- if not names_only:
- with open(filename, 'w') as test_file:
- test_file.write(TEMPLATES.get_template(
- 'template.shader_test.mako').render_unicode(
- glsl_version='{}.{}'.format(ver[0], ver[1:]),
- glsl_version_int=ver,
- type_name=type_name))
-
-
def all_compilation_tests(names_only):
"""Creates all the combinations for in/out compilation tests."""
@@ -112,25 +90,11 @@ def all_compilation_tests(names_only):
yield t_name, shader, ver, names_only
-def all_execution_tests(names_only):
- """Creates all the combinations for in/out shader runner tests."""
-
- assert isinstance(names_only, bool)
- type_names = ['double', 'dvec2', 'dvec3', 'dvec4']
- glsl_ver = ['150', '400']
- if not names_only:
- for ver in glsl_ver:
- utils.safe_makedirs(get_dir_name(ver, 'execution'))
-
- for t_name, ver in itertools.product(type_names, glsl_ver):
- yield t_name, ver, names_only
-
-
def main():
"""Main function."""
parser = argparse.ArgumentParser(
- description="Generate in/out tests for fp64")
+ description="Generate in/out compilation tests for fp64")
parser.add_argument(
'--names-only',
dest='names_only',
@@ -142,9 +106,6 @@ def main():
for test_args in all_compilation_tests(args.names_only):
generate_compilation_tests(*test_args)
- for test_args in all_execution_tests(args.names_only):
- generate_execution_tests(*test_args)
-
if __name__ == '__main__':
main()
diff --git a/generated_tests/random_ubo.py b/generated_tests/random_ubo.py
index 8886b10cc..b3b3bd1c3 100644
--- a/generated_tests/random_ubo.py
+++ b/generated_tests/random_ubo.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# coding=utf-8
# Copyright (c) 2014 Intel Corporation
@@ -26,6 +26,7 @@ import abc
import collections
import struct
import sys
+
from textwrap import dedent
from mako.template import Template
@@ -52,11 +53,17 @@ DOUBLE_TYPES = [
"dmat4x2", "dmat4x3", "dmat4"
]
+INT64_TYPES = [
+ "int64_t", "uint64_t",
+ "i64vec2", "i64vec3", "i64vec4",
+ "u64vec2", "u64vec3", "u64vec4"
+]
+
ALL400_TYPES = ALL130_TYPES + DOUBLE_TYPES
# All known types, including the redundant NxN matrix types.
ALL_TYPES = [ "mat2x2", "mat3x3", "mat4x4",
- "dmat2x2", "dmat3x3", "dmat4x4"] + ALL400_TYPES
+ "dmat2x2", "dmat3x3", "dmat4x4"] + ALL400_TYPES + INT64_TYPES
def align(offset, alignment):
return ((offset + alignment - 1) / alignment) * alignment
@@ -64,7 +71,8 @@ def align(offset, alignment):
def isscalar(type):
"""Return true if the type is a known scalar type from any GLSL version."""
- return type in ["float", "bool", "int", "uint", "double"]
+ return type in ["float", "bool", "int", "uint", "double", "int64_t",
+ "uint64_t"]
def isvector(type):
@@ -73,7 +81,9 @@ def isvector(type):
"ivec2", "ivec3", "ivec4",
"uvec2", "uvec3", "uvec4",
"bvec2", "bvec3", "bvec4",
- "dvec2", "dvec3", "dvec4"]
+ "dvec2", "dvec3", "dvec4",
+ "i64vec2", "i64vec3", "i64vec4",
+ "u64vec2", "u64vec3", "u64vec4"]
def ismatrix(type):
@@ -146,7 +156,7 @@ def basic_machine_units(type):
if type in ["float", "bool", "int", "uint"]:
return 4
- if type == "double":
+ if type in ["double", "int64_t", "uint64_t"]:
return 8
raise Exception("Non-scalar type {}".format(type))
@@ -184,7 +194,11 @@ def vector_base_type(type):
if not isvector(type):
raise Exception("Non-vector type {}".format(type))
- if type[0] == 'v':
+ if type[0:1] == "i6":
+ return "int64_t"
+ elif type[0:1] == "u6":
+ return "uint64_t"
+ elif type[0] == 'v':
return "float"
elif type[0] == 'i':
return "int"
@@ -236,7 +250,7 @@ def select_basic_type(types, names):
def generate_struct_of_basic_types(types, names):
"""Return a sequence of random types with unique field names."""
return [select_basic_type(types, names)
- for i in xrange(0, random.randint(1,12))]
+ for i in range(0, random.randint(1,12))]
def generate_member_from_description(description, builtin_types, names):
@@ -438,7 +452,7 @@ def iterate_struct_array_recursive(field_type,
element_t = array_base_type(field_type)
- for i in xrange(array_elements(field_type)):
+ for i in range(array_elements(field_type)):
name_from_API_with_index = "{}[{}]".format(name_from_API, i)
name_from_shader_with_index = "{}[{}]".format(name_from_shader, i)
@@ -712,9 +726,9 @@ def random_data(type, name, offset):
if isscalar(type):
h = hash_string("{}@{}".format(offset, name))
- if type == "int":
+ if type == "int" or type == "int64_t":
return str(h - 0x7fffffff)
- elif type == "uint":
+ elif type == "uint" or type == "uint64_t":
return str(h)
elif type == "bool":
return str(int((h & 8) == 0))
@@ -727,14 +741,14 @@ def random_data(type, name, offset):
scalar = vector_base_type(type)
x = [random_data(scalar, name, offset + (i * 3))
- for i in xrange(vector_size(type))]
+ for i in range(vector_size(type))]
return " ".join(x)
if ismatrix(type):
r, c = matrix_dimensions(type)
x = [random_data("float", name, offset + (i * 7))
- for i in xrange(r * c)]
+ for i in range(r * c)]
return " ".join(x)
@@ -802,6 +816,10 @@ def scalar_derp(type, name, data):
return "{} != {}u".format(name, data)
elif type == "int":
return "{} != {}".format(name, data)
+ elif type == "uint64_t":
+ return "{} != {}ul".format(name, data)
+ elif type == "int64_t":
+ return "{} != {}l".format(name, data)
elif type == "float":
# Not all implementations support the bit-cast operators that are used
# to do bit-exact comparisons. For this reason float_match needs the
@@ -833,7 +851,7 @@ def vector_derp(type, name, data):
return [scalar_derp(scalar,
"{}.{}".format(name, "xyzw"[i]),
data[i])
- for i in xrange(vector_size(type))]
+ for i in range(vector_size(type))]
def matrix_derp(type, name, data):
@@ -849,7 +867,7 @@ def matrix_derp(type, name, data):
data_pairs = []
- for i in xrange(c):
+ for i in range(c):
data_pairs.extend(vector_derp(
column_type,
"{}[{}]".format(name, i),
@@ -917,7 +935,7 @@ def generate_array_data_pairs(name, api_name, element_type, row_major, offset, p
astride = packing.array_stride(element_type, row_major)
- for i in xrange(array_elements(element_type)):
+ for i in range(array_elements(element_type)):
name_with_index = "{}[{}]".format(name, i)
api_name_with_index = "{}[{}]".format(api_name, i)
@@ -1207,7 +1225,7 @@ def emit_shader_test(blocks, packing, glsl_version, extensions):
t = Template(dedent("""\
[require]
- GLSL >= ${glsl_version / 100}.${glsl_version % 100}
+ GLSL >= ${glsl_version // 100}.${glsl_version % 100}
% for ext in extensions:
${ext}
% endfor
@@ -1279,7 +1297,7 @@ def emit_shader_test(blocks, packing, glsl_version, extensions):
*/
bool pass = true;
- % for i in xrange(len(checkers)):
+ % for i in range(len(checkers)):
% if i % 5 == 0:
if (${checkers[i]})
pass = false;
@@ -1393,25 +1411,25 @@ class packing_rules(object):
if type in ["float", "bool", "int", "uint"]:
return 4
- if type == "double":
+ if type in ["double", "int64_t", "uint64_t"]:
return 8
if type in ["vec2", "bvec2", "ivec2", "uvec2"]:
return 2 * 4
- if type == "dvec2":
+ if type in ["dvec2", "i64vec2", "u64vec2"]:
return 2 * 8
if type in ["vec3", "bvec3", "ivec3", "uvec3"]:
return 3 * 4
- if type == "dvec3":
+ if type in ["dvec3", "i64vec3", "u64vec3"]:
return 3 * 8
if type in ["vec4", "bvec4", "ivec4", "uvec4"]:
return 4 * 4
- if type == "dvec4":
+ if type in ["dvec4", "i64vec4", "u64vec4"]:
return 4 * 8
if "mat" in type:
@@ -1682,10 +1700,20 @@ class block_member(object):
'ivec3': "GL_INT_VEC3",
'ivec4': "GL_INT_VEC4",
- 'uint': "GL_UNSIGNED_INT",
- 'uvec2': "GL_UNSIGNED_INT_VEC2",
- 'uvec3': "GL_UNSIGNED_INT_VEC3",
- 'uvec4': "GL_UNSIGNED_INT_VEC4",
+ 'int64_t': "GL_INT64_ARB",
+ 'i64vec2': "GL_INT64_VEC2_ARB",
+ 'i64vec3': "GL_INT64_VEC3_ARB",
+ 'i64vec4': "GL_INT64_VEC4_ARB",
+
+ 'uint': "GL_UNSIGNED_INT64_ARB",
+ 'uvec2': "GL_UNSIGNED_INT64_VEC2_ARB",
+ 'uvec3': "GL_UNSIGNED_INT64_VEC3_ARB",
+ 'uvec4': "GL_UNSIGNED_INT64_VEC4_ARB",
+
+ 'uint64_t': "GL_UNSIGNED_INT64_ARB",
+ 'u64vec2': "GL_UNSIGNED_INT64_VEC2_ARB",
+ 'u64vec3': "GL_UNSIGNED_INT64_VEC3_ARB",
+ 'u64vec4': "GL_UNSIGNED_INT64_VEC4_ARB",
'bool': "GL_BOOL",
'bvec2': "GL_BOOL_VEC2",
diff --git a/generated_tests/templates/gen_inout_fp64/template.shader_test.mako b/generated_tests/templates/gen_inout_fp64/template.shader_test.mako
deleted file mode 100644
index aba9f6a7b..000000000
--- a/generated_tests/templates/gen_inout_fp64/template.shader_test.mako
+++ /dev/null
@@ -1,60 +0,0 @@
-# test emitting a ${type_name} from vs->fs works
-# when originally written this failed in varying lowering
-
-[require]
-GLSL >= ${glsl_version}
-% if glsl_version == '1.50':
-GL_ARB_gpu_shader_fp64
-% endif
-
-[vertex shader]
-#version ${glsl_version_int}
-% if glsl_version == '1.50':
-#extension GL_ARB_gpu_shader_fp64 : require
-% endif
-
-uniform double arg0;
-
-in vec4 vertex;
-flat out ${type_name} dout1;
-
-void main()
-{
- gl_Position = vertex;
- dout1 = ${type_name}(arg0);
-}
-
-[fragment shader]
-#version ${glsl_version_int}
-% if glsl_version == '1.50':
-#extension GL_ARB_gpu_shader_fp64 : require
-% endif
-
-flat in ${type_name} dout1;
-uniform double tolerance;
-uniform double expected;
-out vec4 color;
-
-void main()
-{
- ${type_name} result = trunc(dout1);
- color = distance(result, ${type_name}(expected)) <= tolerance
- ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
-}
-
-[vertex data]
-vertex/float/2
--1.0 -1.0
- 1.0 -1.0
- 1.0 1.0
--1.0 1.0
-
-[test]
-clear color 0.0 0.0 0.0 0.0
-
-clear
-uniform double arg0 1.7976931348623157E+308
-uniform double expected 1.7976931348623157E+308
-uniform double tolerance 2.0000000000000002e-05
-draw arrays GL_TRIANGLE_FAN 0 4
-probe rgba 0 0 0.0 1.0 0.0 1.0
diff --git a/tests/egl/egl-ext_egl_image_storage.c b/tests/egl/egl-ext_egl_image_storage.c
index a2daac8c9..4a052fb86 100644
--- a/tests/egl/egl-ext_egl_image_storage.c
+++ b/tests/egl/egl-ext_egl_image_storage.c
@@ -59,18 +59,16 @@ verify_rgbw_texture()
float *b = expect + 2 * box;
float *w = b + color_stride;
+ bool pass = true;
+
/* Verify texture contents by probing each color box. */
- if (!piglit_probe_texel_rect_rgba(GL_TEXTURE_2D, 0, 0, 0, hf, hf, r))
- return false;
- if (!piglit_probe_texel_rect_rgba(GL_TEXTURE_2D, 0, hf, 0, hf, hf, g))
- return false;
- if (!piglit_probe_texel_rect_rgba(GL_TEXTURE_2D, 0, 0, hf, hf, hf, b))
- return false;
- if (!piglit_probe_texel_rect_rgba(GL_TEXTURE_2D, 0, hf, hf, hf, hf, w))
- return false;
+ pass = piglit_probe_texel_rect_rgba(GL_TEXTURE_2D, 0, 0, 0, hf, hf, r) && pass;
+ pass = piglit_probe_texel_rect_rgba(GL_TEXTURE_2D, 0, hf, 0, hf, hf, g) && pass;
+ pass = piglit_probe_texel_rect_rgba(GL_TEXTURE_2D, 0, 0, hf, hf, hf, b) && pass;
+ pass = piglit_probe_texel_rect_rgba(GL_TEXTURE_2D, 0, hf, hf, hf, hf, w) && pass;
free(expect);
- return true;
+ return pass;
}
void
diff --git a/tests/opengl.py b/tests/opengl.py
index a6f7501c3..7b4fcb4a1 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -326,6 +326,7 @@ with profile.test_list.group_manager(PiglitGLTest, 'shaders') as g:
g(['useprogram-flushverts-2'])
g(['useprogram-inside-begin'])
g(['useprogram-refcount-1'])
+ g(['useprogram-refcount-1', 'delete_dup'])
g(['useshaderprogram-bad-type'])
g(['useshaderprogram-bad-program'])
g(['useshaderprogram-flushverts-1'])
@@ -4368,6 +4369,7 @@ with profile.test_list.group_manager(
grouptools.join('spec', 'arb_shader_storage_buffer_object')) as g:
g(['arb_shader_storage_buffer_object-minmax'], 'minmax')
g(['arb_shader_storage_buffer_object-rendering'], 'rendering')
+ g(['arb_shader_storage_buffer_object-issue1258'], 'issue1258')
g(['arb_shader_storage_buffer_object-getintegeri_v'], 'getintegeri_v')
g(['arb_shader_storage_buffer_object-deletebuffers'], 'deletebuffers')
g(['arb_shader_storage_buffer_object-maxblocks'], 'maxblocks')
diff --git a/tests/shaders/glsl-fs-loop-unroll-ishl-int64.shader_test b/tests/shaders/glsl-fs-loop-unroll-ishl-int64.shader_test
new file mode 100644
index 000000000..b6a37ca1b
--- /dev/null
+++ b/tests/shaders/glsl-fs-loop-unroll-ishl-int64.shader_test
@@ -0,0 +1,46 @@
+[require]
+GLSL >= 4.00
+GL_ARB_gpu_shader_int64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_ARB_gpu_shader_int64: require
+
+void main()
+{
+ int64_t li = 7L;
+ while (li < 481036337152L)
+ li <<= 4;
+ /* li should be 481036337152 */
+
+ while (li <= 1970324836974592L)
+ li <<= 4;
+ /* li should be 31525197391593472 */
+
+ while (li != 504403158265495552L)
+ li <<= 4;
+ /* li should be 504403158265495552 */
+
+ uint64_t uli = 7UL;
+ while (uli < 1970324836974592UL)
+ uli <<= 6;
+ /* uli should be 1970324836974592 */
+
+ while (uli <= 126100789566373888UL)
+ uli <<= 6;
+ /* uli should be 8070450532247928832 */
+
+ if (li == 504403158265495552L &&
+ uli == 8070450532247928832UL)
+ gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+ else
+ gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+clear color 0.3 0.3 0.3 0.0
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/shaders/glsl-fs-loop-unroll-ishl.shader_test b/tests/shaders/glsl-fs-loop-unroll-ishl.shader_test
new file mode 100644
index 000000000..6593ff8b9
--- /dev/null
+++ b/tests/shaders/glsl-fs-loop-unroll-ishl.shader_test
@@ -0,0 +1,44 @@
+[require]
+GLSL >= 1.30
+
+[vertex shader passthrough]
+
+[fragment shader]
+
+void main()
+{
+ int i = 3;
+ while (i < 48) /* nir_op_ige */
+ i <<= 2;
+ /* i should be 48 */
+
+ while (i <= 192) /* nir_op_ilt */
+ i <<= 2;
+ /* i should be 768 */
+
+ while (i != 3072) /* nir_op_ieq */
+ i <<= 1;
+ /* i should be 3072 */
+
+ uint j = 3u;
+ while (j < 48u) /* nir_op_uge */
+ j <<= 2;
+ /* j should be 48 */
+
+ while (j <= 192u) /* nir_op_ult */
+ j <<= 1;
+ /* j should be 384 */
+
+ if (i == 3072 &&
+ j == 384u)
+ gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+ else
+ gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+clear color 0.3 0.3 0.3 0.0
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/shaders/glsl-fs-loop-unroll-mul-fp64.shader_test b/tests/shaders/glsl-fs-loop-unroll-mul-fp64.shader_test
new file mode 100644
index 000000000..ce1f6deca
--- /dev/null
+++ b/tests/shaders/glsl-fs-loop-unroll-mul-fp64.shader_test
@@ -0,0 +1,40 @@
+[require]
+GLSL >= 4.00
+GL_ARB_gpu_shader_fp64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_ARB_gpu_shader_fp64: require
+
+void main()
+{
+ double lk = 1.0LF;
+ while (lk < 62748517.0LF) /* 13^7 */
+ lk *= 13.0LF;
+ /* lk should be 815730721 */
+
+ while (lk <= 815730721.0LF)
+ lk *= 13.0LF;
+ /* lk should be 10604499373 */
+
+ while (lk != 4826809.0LF)
+ lk /= 13.0LF;
+ /* lk should be 4826809 */
+
+ while (lk == 4826809.0LF)
+ lk /= 13.0LF;
+ /* lk should be 371293 */
+
+ if (lk == 371293.0LF)
+ gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+ else
+ gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+clear color 0.3 0.3 0.3 0.0
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/shaders/glsl-fs-loop-unroll-mul-int64.shader_test b/tests/shaders/glsl-fs-loop-unroll-mul-int64.shader_test
new file mode 100644
index 000000000..e21c8cf07
--- /dev/null
+++ b/tests/shaders/glsl-fs-loop-unroll-mul-int64.shader_test
@@ -0,0 +1,54 @@
+[require]
+GLSL >= 4.00
+GL_ARB_gpu_shader_int64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_ARB_gpu_shader_int64: require
+
+void main()
+{
+ int64_t li = 17L;
+ while (li < 1431211525754907897L) { // (17^15 + 1) / 2
+ li *= 17L;
+ }
+ /* li should be 17^15 (2862423051509815793)*/
+
+ while (li < 8587269154529447379L)
+ li *= 3L;
+ /* li should be 3 * 17^15 (8587269154529447379) */
+
+ int64_t li_2 = 17L;
+ while (li_2 != 27103491L)
+ li_2 *= 1594323L;
+ /* li_2 should be 27103491 */
+
+ while (li_2 == 27103491L)
+ li_2 *= 1594323L;
+ /* li_2 should be 43211719081593 */
+ float z = 1.0;
+ uint64_t uli = 1L;
+ while (uli < 8650415919381337933L) { /* 13^17 */
+ uli *= 13L;
+ z -= 0.01;
+ }
+ /* uli should be 8650415919381337933 */
+
+ while (z < 1.0)
+ z += 1.0;
+
+ if (li == 8587269154529447379L &&
+ li_2 == 43211719081593L &&
+ uli == 8650415919381337933L)
+ gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+ else
+ gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+clear color 0.3 0.3 0.3 0.0
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/shaders/glsl-fs-loop-unroll-mul.shader_test b/tests/shaders/glsl-fs-loop-unroll-mul.shader_test
new file mode 100644
index 000000000..cb55eb8e5
--- /dev/null
+++ b/tests/shaders/glsl-fs-loop-unroll-mul.shader_test
@@ -0,0 +1,67 @@
+[require]
+GLSL >= 1.30
+
+[vertex shader passthrough]
+
+[fragment shader]
+
+void main()
+{
+ int i = 3;
+ while (i < 75) /* nir_op_ige */
+ i *= 5;
+ /* i should be 75 */
+
+ while (i <= 375) /* nir_op_ilt */
+ i *= 5;
+ /* i should be 1875 */
+
+ while (i != 46875) /* nir_op_ieq */
+ i *= 5;
+ /* i should be 46875 */
+
+ while (i == 46875) /* nir_op_ine */
+ i *= 5;
+ /* i should be 234375 */
+
+ uint j = 3u;
+ while (j < 75u) /* nir_op_uge */
+ j *= 5u;
+ /* j should be 75 */
+
+ while (j <= 375u) /* nir_op_ult */
+ j *= 5u;
+ /* j should be 1875 */
+
+ float k = -3.0;
+ while (k > -75.0) /* nir_op_fge */
+ k *= 5.0;
+ /* k should be -75 */
+
+ while (k >= -375.0) /* nir_op_flt */
+ k *= 5;
+ /* k should be -1875 */
+
+ k = -k;
+ while (k == 1875)
+ k /= 5.0;
+ /* k should be 375 */
+
+ while (k != 15.0) /* nir_op_feq */
+ k /= 5.0;
+ /* k should be 75 */
+
+ if (i <= 234375 &&
+ j <= 1875u &&
+ k <= 15.0)
+ gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+ else
+ gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+clear color 0.3 0.3 0.3 0.0
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/shaders/useprogram-refcount-1.c b/tests/shaders/useprogram-refcount-1.c
index 73746599a..2fa73a8c6 100644
--- a/tests/shaders/useprogram-refcount-1.c
+++ b/tests/shaders/useprogram-refcount-1.c
@@ -28,10 +28,12 @@
/** @file useprogram-refcount-1.c
*
- * Tests that a metaops call (glDrawPixels()) doesn't lose the last
- * reference on an active, deleted shader prorgam.
+ * test_delete_active: tests that a metaops call (glDrawPixels()) doesn't lose the last
+ * reference on an active, deleted shader prorgam (Bug #31194)
*
- * Bug #31194
+ * test_delete_duplicate: tests for shader cache errors (issue #2596) by creating 2
+ * identical program, deleting one of them, and using the other
+ * to draw something.
*/
#include "piglit-util-gl.h"
@@ -44,15 +46,44 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
PIGLIT_GL_TEST_CONFIG_END
-static GLint prog;
+static enum {
+ TEST_DELETE_ACTIVE,
+ TEST_DELETE_DUPLICATE
+} test_mode;
+
+static GLint
+build_program(void)
+{
+ GLint vs, fs;
+ const char *vs_source =
+ "void main()\n"
+ "{\n"
+ " gl_Position = gl_Vertex;\n"
+ "}\n";
+ const char *fs_source =
+ "void main()\n"
+ "{\n"
+ " gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);\n"
+ "}\n";
+
+ piglit_require_gl_version(20);
+
+ vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
+ fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
+ return piglit_link_simple_program(vs, fs);
+}
enum piglit_result
-piglit_display(void)
+test_delete_active(void)
{
- GLboolean pass = GL_TRUE;
+ bool pass = true;
float green[4] = {0.0, 1.0, 0.0, 0.0};
uint8_t pixel[4] = {0x00, 0xff, 0x00, 0xff};
+ GLint prog = build_program();
+ glUseProgram(prog);
+ glDeleteProgram(prog);
+
/* Set up fixed function to draw red if we lose our shader. */
glColor4f(1.0, 0.0, 0.0, 0.0);
@@ -70,26 +101,58 @@ piglit_display(void)
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
-void
-piglit_init(int argc, char **argv)
+enum piglit_result
+test_delete_duplicate(void)
{
- GLint vs, fs;
- const char *vs_source =
- "void main()\n"
- "{\n"
- " gl_Position = gl_Vertex;\n"
- "}\n";
- const char *fs_source =
- "void main()\n"
- "{\n"
- " gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);\n"
- "}\n";
+ bool pass = true;
+ float green[4] = {0.0, 1.0, 0.0, 0.0};
+ uint8_t pixel[4] = {0x00, 0xff, 0x00, 0xff};
- piglit_require_gl_version(20);
+ GLint prog = build_program();
+ /* Build a second program, using the same shaders */
+ GLint prog_dup = build_program();
+
+ /* Set up fixed function to draw red if we lose our shader. */
+ glColor4f(1.0, 0.0, 0.0, 0.0);
+
+ glDrawPixels(1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- prog = piglit_link_simple_program(vs, fs);
glUseProgram(prog);
+ piglit_draw_rect(-1, -1, 2, 2);
+
+ /* Delete the duplicate */
+ glDeleteProgram(prog_dup);
+
+ /* Re-draw over the whole screen with the shader. */
+ piglit_draw_rect(-1, -1, 2, 2);
+
+ pass &= piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
+ green);
+
+ piglit_present_results();
+
glDeleteProgram(prog);
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+enum piglit_result
+piglit_display(void)
+{
+ switch (test_mode) {
+ case TEST_DELETE_DUPLICATE:
+ return test_delete_duplicate();
+ case TEST_DELETE_ACTIVE:
+ default:
+ return test_delete_active();
+ }
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ test_mode = TEST_DELETE_ACTIVE;
+ if (argc == 2 && strcmp(argv[1], "delete_dup") == 0)
+ test_mode = TEST_DELETE_DUPLICATE;
+ piglit_require_gl_version(20);
}
diff --git a/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-simple-different-formats.shader_test b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-simple-different-formats.shader_test
new file mode 100644
index 000000000..c2388f9e6
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-simple-different-formats.shader_test
@@ -0,0 +1,68 @@
+# This test verifies that dynamically uniform indexing of sampler arrays
+# in the fragment shader behaves correctly.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform sampler2D s[4];
+
+uniform int n;
+
+out vec4 color;
+
+void main()
+{
+ color = texture(s[n], vec2(0.75, 0.25));
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+uniform int s[0] 0
+uniform int s[1] 1
+uniform int s[2] 2
+uniform int s[3] 3
+
+texture rgbw 0 (32, 32)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+texture rgbw 1 (32, 32) GL_RGBA32F
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+texture rgbw 2 (32, 32) GL_R11F_G11F_B10F
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+texture rgbw 3 (32, 32) GL_COMPRESSED_RGBA
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+uniform int n 0
+draw rect -1 -1 1 1
+
+relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0)
+
+uniform int n 1
+draw rect 0 -1 1 1
+
+relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0)
+
+uniform int n 2
+draw rect -1 0 1 1
+
+relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 1.0, 0.0)
+
+uniform int n 3
+draw rect 0 0 1 1
+
+relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (0.0, 1.0, 0.0)
diff --git a/tests/spec/arb_separate_shader_objects/mix-and-match-tcs-tes.c b/tests/spec/arb_separate_shader_objects/mix-and-match-tcs-tes.c
index 6e0643e61..6e42d7e3e 100644
--- a/tests/spec/arb_separate_shader_objects/mix-and-match-tcs-tes.c
+++ b/tests/spec/arb_separate_shader_objects/mix-and-match-tcs-tes.c
@@ -155,42 +155,43 @@ void piglit_init(int argc, char **argv)
1.0, -1.0,
1.0, 1.0
};
+ bool pass = true;
piglit_require_extension("GL_ARB_separate_shader_objects");
piglit_require_extension("GL_ARB_tessellation_shader");
vs_prog = glCreateShaderProgramv(GL_VERTEX_SHADER, 1,
(const GLchar *const*)&vs_code);
- piglit_link_check_status(vs_prog);
+ pass = piglit_link_check_status(vs_prog) && pass;
tcs0_prog = glCreateShaderProgramv(GL_TESS_CONTROL_SHADER, 1,
(const GLchar *const *)&tcs0_code);
- piglit_link_check_status(tcs0_prog);
+ pass = piglit_link_check_status(tcs0_prog) && pass;
tcs1_prog = glCreateShaderProgramv(GL_TESS_CONTROL_SHADER, 1,
(const GLchar *const *)&tcs1_code);
- piglit_link_check_status(tcs1_prog);
+ pass = piglit_link_check_status(tcs1_prog) && pass;
tes_prog = glCreateShaderProgramv(GL_TESS_EVALUATION_SHADER, 1,
(const GLchar *const *)&tes_code);
- piglit_link_check_status(tes_prog);
+ pass = piglit_link_check_status(tes_prog) && pass;
fs_prog = glCreateShaderProgramv(GL_FRAGMENT_SHADER, 1,
(const GLchar *const *)&fs_code);
- piglit_link_check_status(fs_prog);
+ pass = piglit_link_check_status(fs_prog) && pass;
glGenProgramPipelines(2, pipeline);
glUseProgramStages(pipeline[0], GL_VERTEX_SHADER_BIT, vs_prog);
glUseProgramStages(pipeline[0], GL_TESS_CONTROL_SHADER_BIT, tcs0_prog);
glUseProgramStages(pipeline[0], GL_TESS_EVALUATION_SHADER_BIT, tes_prog);
glUseProgramStages(pipeline[0], GL_FRAGMENT_SHADER_BIT, fs_prog);
- piglit_program_pipeline_check_status(pipeline[0]);
+ pass = piglit_program_pipeline_check_status(pipeline[0]) && pass;
glUseProgramStages(pipeline[1], GL_VERTEX_SHADER_BIT, vs_prog);
glUseProgramStages(pipeline[1], GL_TESS_CONTROL_SHADER_BIT, tcs1_prog);
glUseProgramStages(pipeline[1], GL_TESS_EVALUATION_SHADER_BIT, tes_prog);
glUseProgramStages(pipeline[1], GL_FRAGMENT_SHADER_BIT, fs_prog);
- piglit_program_pipeline_check_status(pipeline[1]);
+ pass = piglit_program_pipeline_check_status(pipeline[1]) && pass;
/* Set up the VAOs/VBOs for drawing rectangles using the approach
* from spec/arb_tessellation_shader/execution/sanity.shader_test.
@@ -204,6 +205,8 @@ void piglit_init(int argc, char **argv)
glEnableVertexAttribArray(PIGLIT_ATTRIB_POS);
glPatchParameteri(GL_PATCH_VERTICES, 3);
- if (!piglit_check_gl_error(0))
+ pass = piglit_check_gl_error(0) && pass;
+
+ if (!pass)
piglit_report_result(PIGLIT_FAIL);
}
diff --git a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
index 28ea09266..c0e9c0e95 100644
--- a/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_shader_storage_buffer_object/CMakeLists.gl.txt
@@ -10,6 +10,7 @@ link_libraries (
piglit_add_executable (arb_shader_storage_buffer_object-minmax minmax.c)
piglit_add_executable (arb_shader_storage_buffer_object-rendering rendering.c)
+piglit_add_executable (arb_shader_storage_buffer_object-issue1258 issue1258.c)
piglit_add_executable (arb_shader_storage_buffer_object-max-ssbo-size max-ssbo-size.c)
piglit_add_executable (arb_shader_storage_buffer_object-getintegeri_v getintegeri_v.c)
piglit_add_executable (arb_shader_storage_buffer_object-deletebuffers deletebuffers.c)
diff --git a/tests/spec/arb_shader_storage_buffer_object/issue1258.c b/tests/spec/arb_shader_storage_buffer_object/issue1258.c
new file mode 100644
index 000000000..a5ed459db
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/issue1258.c
@@ -0,0 +1,164 @@
+/*
+ * Copyright © 2020 Advanced Micro Devices, Inc.
+ *
+ * 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.
+ */
+
+/** @file issue1258.c
+ *
+ * This is a reproducer for issue 1258.
+ * When using separable programs and ssbo a use-after-free can occur in
+ * st_bind_ssbos if these 2 conditions are met:
+ * - the program has been relinked while its pipeline is not bound
+ * - a new ssbo has been attached
+ *
+ * Based on rendering.c test.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_compat_version = 32;
+ config.supports_gl_core_version = 32;
+ config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+ config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char *vert_shader_text =
+ "#version 130\n"
+ "#extension GL_ARB_separate_shader_objects: require\n"
+ "\n"
+ "in vec4 piglit_vertex;\n"
+ "\n"
+ "void main()\n"
+ "{\n"
+ " gl_Position = piglit_vertex;\n"
+ "}\n";
+
+static const char *frag_shader_text =
+ "#version 130\n"
+ "#extension GL_ARB_shader_storage_buffer_object: require\n"
+ "#extension GL_ARB_separate_shader_objects: require\n"
+ "\n"
+ "buffer ssbo_color { float color; };\n"
+ "\n"
+ "void main()\n"
+ "{\n"
+ " gl_FragColor = vec4(color);\n"
+ "}\n";
+
+static GLuint pipeline, prog_vs, prog_fs;
+static GLuint buffers[2];
+static GLint ssbo_size;
+static GLint ssbo_index;
+static float* color;
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_require_extension("GL_ARB_shader_storage_buffer_object");
+ piglit_require_extension("GL_ARB_separate_shader_objects");
+
+ color = (float*) malloc(piglit_width * piglit_height * 4 * sizeof(float));
+ for (int i = 0; i < (piglit_width * piglit_height * 4); i++)
+ color[i] = 0.75;
+
+ glViewport(0, 0, piglit_width, piglit_height);
+ prog_vs = piglit_build_simple_program_unlinked(vert_shader_text, NULL);
+ glProgramParameteri(prog_vs, GL_PROGRAM_SEPARABLE, GL_TRUE);
+ glLinkProgram(prog_vs);
+ piglit_link_check_status(prog_vs);
+ prog_fs = piglit_build_simple_program(NULL, frag_shader_text);
+ glProgramParameteri(prog_fs, GL_PROGRAM_SEPARABLE, GL_TRUE);
+ glLinkProgram(prog_fs);
+ piglit_link_check_status(prog_fs);
+
+ glGenProgramPipelines(1, &pipeline);
+ glUseProgramStages(pipeline, GL_VERTEX_SHADER_BIT, prog_vs);
+ glUseProgramStages(pipeline, GL_FRAGMENT_SHADER_BIT, prog_fs);
+ piglit_program_pipeline_check_status(pipeline);
+
+ ssbo_index = glGetProgramResourceIndex(prog_fs,
+ GL_SHADER_STORAGE_BLOCK,
+ "ssbo_color");
+ GLenum prop = GL_BUFFER_DATA_SIZE;
+ glGetProgramResourceiv(prog_fs, GL_SHADER_STORAGE_BLOCK, ssbo_index,
+ 1, &prop, 1, NULL, &ssbo_size);
+
+ /* Create 2 SSBO */
+ glGenBuffers(ARRAY_SIZE(buffers), buffers);
+ for (int i = 0; i < ARRAY_SIZE(buffers); i++) {
+ glBindBuffer(GL_SHADER_STORAGE_BUFFER, buffers[i]);
+ glBufferData(GL_SHADER_STORAGE_BUFFER, ssbo_size,
+ &color[0], GL_DYNAMIC_DRAW);
+ }
+
+
+ if (!piglit_check_gl_error(0))
+ piglit_report_result(PIGLIT_FAIL);
+
+ glClearColor(0.2, 0.2, 0.2, 0.2);
+}
+
+bool
+draw(void)
+{
+ glViewport(0, 0, piglit_width, piglit_height);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ return PIGLIT_FAIL;
+
+ piglit_draw_rect(-1, -1, 2, 2);
+ glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
+
+ return piglit_probe_image_color(
+ 0, 0,
+ piglit_width, piglit_height,
+ GL_RGBA, color);
+}
+
+
+enum piglit_result
+piglit_display(void)
+{
+ glBindProgramPipeline(pipeline);
+ glBindBufferRange(GL_SHADER_STORAGE_BUFFER, 0, buffers[0], 0, ssbo_size);
+ glShaderStorageBlockBinding(prog_fs, ssbo_index, 0);
+ if (!draw()) {
+ return PIGLIT_FAIL;
+ }
+
+ glBindProgramPipeline(0);
+ glLinkProgram(prog_fs);
+ glBindProgramPipeline(pipeline);
+
+ glBindBufferRange(GL_SHADER_STORAGE_BUFFER, 0, buffers[1], 0, ssbo_size);
+ glShaderStorageBlockBinding(prog_fs, ssbo_index, 0);
+ if (!draw()) {
+ return PIGLIT_FAIL;
+ }
+
+ piglit_present_results();
+
+ return PIGLIT_PASS;
+}
diff --git a/tests/spec/arb_shading_language_include/compile/path_not_in_directive.frag b/tests/spec/arb_shading_language_include/compile/path_not_in_directive.frag
new file mode 100644
index 000000000..3c8798e09
--- /dev/null
+++ b/tests/spec/arb_shading_language_include/compile/path_not_in_directive.frag
@@ -0,0 +1,14 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// require_extensions: GL_ARB_shading_language_include
+// [end config]
+//
+// GLSL doesn't have string literals, GL_ARB_shading_language_include
+// does add notion of path but it only has meaning with #line and #include
+
+#extension GL_ARB_shading_language_include: enable
+
+void main() {
+ int i = "1";
+}
diff --git a/tests/spec/ext_texture_norm16/render.c b/tests/spec/ext_texture_norm16/render.c
index 08a84501c..19b9f9816 100644
--- a/tests/spec/ext_texture_norm16/render.c
+++ b/tests/spec/ext_texture_norm16/render.c
@@ -253,8 +253,8 @@ verify_contents(const struct fmt_test *test)
continue;
piglit_report_subtest_result(PIGLIT_FAIL,
- "format 0x%x read fail",
- test->iformat);
+ "format %s read fail",
+ piglit_get_gl_enum_name(test->iformat));
result = false;
break;
}
@@ -295,8 +295,8 @@ test_copy_image(const struct fmt_test *test, GLuint src, GLuint *texture)
if (!piglit_check_gl_error(GL_NO_ERROR)) {
piglit_report_subtest_result(PIGLIT_FAIL,
- "format 0x%x copyimage fail",
- test->iformat);
+ "format %s copyimage fail",
+ piglit_get_gl_enum_name(test->iformat));
result = false;
}
return result;
@@ -352,8 +352,8 @@ test_format(const struct fmt_test *test)
test->can_texbuf) {
bool buf_test = buffer_test(test);
piglit_report_subtest_result(PIGLIT_RESULT(buf_test),
- "format 0x%x TBO test",
- test->iformat);
+ "format %s TBO test",
+ piglit_get_gl_enum_name(test->iformat));
pass &= buf_test;
}
@@ -372,8 +372,8 @@ test_format(const struct fmt_test *test)
bool render_test = verify_contents_float(test);
piglit_present_results();
piglit_report_subtest_result(PIGLIT_RESULT(render_test),
- "format 0x%x",
- test->iformat);
+ "format %s",
+ piglit_get_gl_enum_name(test->iformat));
glDeleteTextures(1, &texture);
pass &= render_test;
return pass;
@@ -383,13 +383,13 @@ test_format(const struct fmt_test *test)
GLuint rbo = create_rbo(test);
if (!rbo || !piglit_check_gl_error(GL_NO_ERROR)) {
piglit_report_subtest_result(PIGLIT_FAIL,
- "format 0x%x RBO test",
- test->iformat);
+ "format %s RBO test",
+ piglit_get_gl_enum_name(test->iformat));
pass &= false;
} else {
piglit_report_subtest_result(PIGLIT_PASS,
- "format 0x%x RBO test",
- test->iformat);
+ "format %s RBO test",
+ piglit_get_gl_enum_name(test->iformat));
}
glDeleteRenderbuffers(1, &rbo);
@@ -400,8 +400,8 @@ test_format(const struct fmt_test *test)
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) !=
GL_FRAMEBUFFER_COMPLETE) {
piglit_report_subtest_result(PIGLIT_FAIL,
- "format 0x%x fbo fail",
- test->iformat);
+ "format %s fbo fail",
+ piglit_get_gl_enum_name(test->iformat));
pass &= false;
}
@@ -431,8 +431,8 @@ test_format(const struct fmt_test *test)
test_copy_image(test, texture, &texture_copy);
pass &= copy_pass;
piglit_report_subtest_result(PIGLIT_RESULT(copy_pass),
- "copy image format 0x%x",
- test->iformat);
+ "copy image format %s",
+ piglit_get_gl_enum_name(test->iformat));
render_texture(texture_copy, GL_TEXTURE_2D, fbo);
}
@@ -486,8 +486,8 @@ piglit_display(void)
for (unsigned i = 0; i < ARRAY_SIZE(tests); i++, test++) {
bool fmt_pass = test_format(test);
piglit_report_subtest_result(PIGLIT_RESULT(fmt_pass),
- "format 0x%x",
- test->iformat);
+ "format %s",
+ piglit_get_gl_enum_name(test->iformat));
pass &= fmt_pass;
}
diff --git a/tests/spec/glsl-1.10/compiler/arithmetic-on-non-existing-variable.vert b/tests/spec/glsl-1.10/compiler/arithmetic-on-non-existing-variable.vert
new file mode 100644
index 000000000..e46b88ec0
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/arithmetic-on-non-existing-variable.vert
@@ -0,0 +1,11 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+
+void main()
+{
+ int i;
+ for (i = 0; i < 10; i += j);
+}
diff --git a/tests/spec/glsl-1.10/compiler/literals/invalid-string.vert b/tests/spec/glsl-1.10/compiler/literals/invalid-string.vert
new file mode 100644
index 000000000..a6a0b55fc
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/literals/invalid-string.vert
@@ -0,0 +1,10 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// GLSL doesn't have string literals
+
+void main() {
+ int i = "1";
+}
diff --git a/tests/spec/glsl-1.10/execution/cmod-cmp-to-add-e.shader_test b/tests/spec/glsl-1.10/execution/cmod-cmp-to-add-e.shader_test
new file mode 100644
index 000000000..82a080c1e
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/cmod-cmp-to-add-e.shader_test
@@ -0,0 +1,30 @@
+# Test case reproduces mesa#2610. On Intel GPUs, the ordering of .sat
+# destination modifier and flag generation were handled backwards.
+
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 110
+
+uniform float uni_val;
+
+void main()
+{
+ float val = 0.0;
+ val = clamp(uni_val - 10.0, 0.0, 1.0);
+
+ if (uni_val == 10.0)
+ val = 1.0;
+
+ gl_FragColor = vec4(val, 1.0 - val, 0.0, 1.0);
+}
+
+[test]
+uniform float uni_val 5.0
+clear color 0.5 0.5 0.5 0.5
+clear
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.10/execution/cmod-cmp-to-add-g.shader_test b/tests/spec/glsl-1.10/execution/cmod-cmp-to-add-g.shader_test
new file mode 100644
index 000000000..8f116c7b4
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/cmod-cmp-to-add-g.shader_test
@@ -0,0 +1,30 @@
+# Test case reproduces mesa#2610. On Intel GPUs, the ordering of .sat
+# destination modifier and flag generation were handled backwards.
+
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 110
+
+uniform float uni_val;
+
+void main()
+{
+ float val = 0.0;
+ val = clamp(uni_val - 10.0, 0.0, 1.0);
+
+ if (uni_val > 10.0)
+ val = 1.0;
+
+ gl_FragColor = vec4(val, 1.0 - val, 0.0, 1.0);
+}
+
+[test]
+uniform float uni_val 5.0
+clear color 0.5 0.5 0.5 0.5
+clear
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.10/execution/cmod-cmp-to-add-ge.shader_test b/tests/spec/glsl-1.10/execution/cmod-cmp-to-add-ge.shader_test
new file mode 100644
index 000000000..6be918285
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/cmod-cmp-to-add-ge.shader_test
@@ -0,0 +1,30 @@
+# Test case reproduces mesa#2610. On Intel GPUs, the ordering of .sat
+# destination modifier and flag generation were handled backwards.
+
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 110
+
+uniform float uni_val;
+
+void main()
+{
+ float val = 0.0;
+ val = clamp(uni_val - 10.0, 0.0, 1.0);
+
+ if (uni_val >= 10.0)
+ val = 1.0;
+
+ gl_FragColor = vec4(val, 1.0 - val, 0.0, 1.0);
+}
+
+[test]
+uniform float uni_val 5.0
+clear color 0.5 0.5 0.5 0.5
+clear
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.10/execution/cmod-cmp-to-add-l.shader_test b/tests/spec/glsl-1.10/execution/cmod-cmp-to-add-l.shader_test
new file mode 100644
index 000000000..c2a303620
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/cmod-cmp-to-add-l.shader_test
@@ -0,0 +1,30 @@
+# Test case reproduces mesa#2610. On Intel GPUs, the ordering of .sat
+# destination modifier and flag generation were handled backwards.
+
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 110
+
+uniform float uni_val;
+
+void main()
+{
+ float val = 0.0;
+ val = 1.0;
+
+ if (uni_val < 10.0)
+ val = clamp(uni_val - 10.0, 0.0, 1.0);
+
+ gl_FragColor = vec4(val, 1.0 - val, 0.0, 1.0);
+}
+
+[test]
+uniform float uni_val 5.0
+clear color 0.5 0.5 0.5 0.5
+clear
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.10/execution/cmod-cmp-to-add-le.shader_test b/tests/spec/glsl-1.10/execution/cmod-cmp-to-add-le.shader_test
new file mode 100644
index 000000000..6e30488a7
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/cmod-cmp-to-add-le.shader_test
@@ -0,0 +1,30 @@
+# Test case reproduces mesa#2610. On Intel GPUs, the ordering of .sat
+# destination modifier and flag generation were handled backwards.
+
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 110
+
+uniform float uni_val;
+
+void main()
+{
+ float val = 0.0;
+ val = 1.0;
+
+ if (uni_val <= 10.0)
+ val = clamp(uni_val - 10.0, 0.0, 1.0);
+
+ gl_FragColor = vec4(val, 1.0 - val, 0.0, 1.0);
+}
+
+[test]
+uniform float uni_val 5.0
+clear color 0.5 0.5 0.5 0.5
+clear
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.10/execution/cmod-cmp-to-add-ne.shader_test b/tests/spec/glsl-1.10/execution/cmod-cmp-to-add-ne.shader_test
new file mode 100644
index 000000000..cbc1614ae
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/cmod-cmp-to-add-ne.shader_test
@@ -0,0 +1,30 @@
+# Test case reproduces mesa#2610. On Intel GPUs, the ordering of .sat
+# destination modifier and flag generation were handled backwards.
+
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 110
+
+uniform float uni_val;
+
+void main()
+{
+ float val = 0.0;
+ val = 1.0;
+
+ if (uni_val != 10.0)
+ val = clamp(uni_val - 10.0, 0.0, 1.0);
+
+ gl_FragColor = vec4(val, 1.0 - val, 0.0, 1.0);
+}
+
+[test]
+uniform float uni_val 5.0
+clear color 0.5 0.5 0.5 0.5
+clear
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-mat4-out-of-bounds-const-1.vert b/tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-mat4-out-of-bounds-const-1.vert
new file mode 100644
index 000000000..f06abe97f
--- /dev/null
+++ b/tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-mat4-out-of-bounds-const-1.vert
@@ -0,0 +1,18 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// [end config]
+
+/* From section 5.6 "Matrix Components" of the GLSL 1.20 spec:
+ *
+ * "It is an error to access a matrix with a constant expression
+ * that is outside the bounds of thematrix."
+ */
+
+#version 120
+
+void main()
+{
+ mat4 mat = mat4(1.0);
+ mat[-1];
+}
diff --git a/tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-mat4-out-of-bounds-const-2.vert b/tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-mat4-out-of-bounds-const-2.vert
new file mode 100644
index 000000000..f5d5ef2e8
--- /dev/null
+++ b/tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-mat4-out-of-bounds-const-2.vert
@@ -0,0 +1,18 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// [end config]
+
+/* From section 5.6 "Matrix Components" of the GLSL 1.20 spec:
+ *
+ * "It is an error to access a matrix with a constant expression
+ * that is outside the bounds of thematrix."
+ */
+
+#version 120
+
+void main()
+{
+ mat4 mat = mat4(1.0);
+ mat[255];
+}
diff --git a/tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-mat4-out-of-bounds-const-3.vert b/tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-mat4-out-of-bounds-const-3.vert
new file mode 100644
index 000000000..ce13bedd4
--- /dev/null
+++ b/tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-mat4-out-of-bounds-const-3.vert
@@ -0,0 +1,19 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// [end config]
+
+/* From section 5.6 "Matrix Components" of the GLSL 1.20 spec:
+ *
+ * "It is an error to access a matrix with a constant expression
+ * that is outside the bounds of thematrix."
+ */
+
+#version 120
+
+void main()
+{
+ mat4 mat = mat4(1.0);
+ const int index = -1;
+ mat[index * index * index];
+}
diff --git a/tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-vec4-out-of-bounds-const-1.vert b/tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-vec4-out-of-bounds-const-1.vert
new file mode 100644
index 000000000..1f7c1cce9
--- /dev/null
+++ b/tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-vec4-out-of-bounds-const-1.vert
@@ -0,0 +1,19 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// [end config]
+
+/* From section 5.5 "Vector Components" of the GLSL 1.20 spec:
+ *
+ * "Reading from or writing to a vector using a constant integral expression
+ * with a value that is negative or greater than or equal to the size of
+ * the vector is illegal"
+ */
+
+#version 120
+
+void main()
+{
+ vec4 vec = vec4(1.0);
+ vec[-1];
+}
diff --git a/tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-vec4-out-of-bounds-const-2.vert b/tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-vec4-out-of-bounds-const-2.vert
new file mode 100644
index 000000000..2d6e89e09
--- /dev/null
+++ b/tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-vec4-out-of-bounds-const-2.vert
@@ -0,0 +1,19 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// [end config]
+
+/* From section 5.5 "Vector Components" of the GLSL 1.20 spec:
+ *
+ * "Reading from or writing to a vector using a constant integral expression
+ * with a value that is negative or greater than or equal to the size of
+ * the vector is illegal"
+ */
+
+#version 120
+
+void main()
+{
+ vec4 vec = vec4(1.0);
+ vec[255];
+}
diff --git a/tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-vec4-out-of-bounds-const-3.vert b/tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-vec4-out-of-bounds-const-3.vert
new file mode 100644
index 000000000..44f63af79
--- /dev/null
+++ b/tests/spec/glsl-1.20/compiler/out-of-bounds-access/vs-vec4-out-of-bounds-const-3.vert
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// [end config]
+
+/* From section 5.5 "Vector Components" of the GLSL 1.20 spec:
+ *
+ * "Reading from or writing to a vector using a constant integral expression
+ * with a value that is negative or greater than or equal to the size of
+ * the vector is illegal"
+ */
+
+#version 120
+
+void main()
+{
+ vec4 vec = vec4(1.0);
+ const int index = -1;
+ vec[index * index * index];
+}
diff --git a/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-1.shader_test b/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-1.shader_test
new file mode 100644
index 000000000..92fa38984
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-1.shader_test
@@ -0,0 +1,29 @@
+/* From section 5.6 "Matrix Components" of the GLSL 1.20 spec:
+ *
+ * "Behavior is undefined when accessing a component outside the bounds
+ * of a matrix with a non-constant expression."
+ *
+ * The behaviour becomes defined only in robustness extensions, however even
+ * if driver is technically allowed to crash and hang, it most likely
+ * doesn't want to.
+ */
+
+[require]
+GLSL >= 1.20
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 120
+
+void main()
+{
+ mat4 mat = mat4(1.0);
+ int index = -1;
+ mat[index] = vec4(1);
+
+ gl_FragColor = mat[index];
+}
+
+[test]
+draw rect -1 -1 2 2
diff --git a/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-2.shader_test b/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-2.shader_test
new file mode 100644
index 000000000..884820eb0
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-2.shader_test
@@ -0,0 +1,31 @@
+/* From section 5.6 "Matrix Components" of the GLSL 1.20 spec:
+ *
+ * "Behavior is undefined when accessing a component outside the bounds
+ * of a matrix with a non-constant expression."
+ *
+ * The behaviour becomes defined only in robustness extensions, however even
+ * if driver is technically allowed to crash or hang, it most likely
+ * doesn't want to.
+ */
+
+[require]
+GLSL >= 1.20
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 120
+
+void main()
+{
+ mat4 mat = mat4(1.0);
+ int index = -1;
+ if (mat[index][0] >= 1.0) {
+ mat[index] = vec4(-1.0);
+ }
+
+ gl_FragColor = mat[index];
+}
+
+[test]
+draw rect -1 -1 2 2
diff --git a/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-3.shader_test b/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-3.shader_test
new file mode 100644
index 000000000..622173032
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-3.shader_test
@@ -0,0 +1,31 @@
+/* From section 5.6 "Matrix Components" of the GLSL 1.20 spec:
+ *
+ * "Behavior is undefined when accessing a component outside the bounds
+ * of a matrix with a non-constant expression."
+ *
+ * The behaviour becomes defined only in robustness extensions, however even
+ * if driver is technically allowed to crash or hang, it most likely
+ * doesn't want to.
+ */
+
+[require]
+GLSL >= 1.20
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 120
+
+void main()
+{
+ mat4 mat = mat4(1.0);
+ int index = 5;
+ if (mat[index][0] >= 1.0) {
+ mat[index] = vec4(-1.0);
+ }
+
+ gl_FragColor = mat[index];
+}
+
+[test]
+draw rect -1 -1 2 2
diff --git a/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-4.shader_test b/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-4.shader_test
new file mode 100644
index 000000000..bdee95621
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-4.shader_test
@@ -0,0 +1,31 @@
+/* From section 5.6 "Matrix Components" of the GLSL 1.20 spec:
+ *
+ * "Behavior is undefined when accessing a component outside the bounds
+ * of a matrix with a non-constant expression."
+ *
+ * The behaviour becomes defined only in robustness extensions, however even
+ * if driver is technically allowed to crash or hang, it most likely
+ * doesn't want to.
+ */
+
+[require]
+GLSL >= 1.20
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 120
+
+void main()
+{
+ mat4 mat = mat4(1.0);
+ int index = 2147483647;
+ if (mat[index][0] >= 1.0) {
+ mat[index] = vec4(-1.0);
+ }
+
+ gl_FragColor = mat[index];
+}
+
+[test]
+draw rect -1 -1 2 2
diff --git a/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-5.shader_test b/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-5.shader_test
new file mode 100644
index 000000000..3571c6d62
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-5.shader_test
@@ -0,0 +1,31 @@
+/* From section 5.6 "Matrix Components" of the GLSL 1.20 spec:
+ *
+ * "Behavior is undefined when accessing a component outside the bounds
+ * of a matrix with a non-constant expression."
+ *
+ * The behaviour becomes defined only in robustness extensions, however even
+ * if driver is technically allowed to crash or hang, it most likely
+ * doesn't want to.
+ */
+
+[require]
+GLSL >= 1.20
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 120
+
+void main()
+{
+ mat4 mat = mat4(-1.0);
+ int index = int(mat[0][0]);
+ if (mat[index][0] >= 1.0) {
+ mat[index] = vec4(-1.0);
+ }
+
+ gl_FragColor = mat[index];
+}
+
+[test]
+draw rect -1 -1 2 2
diff --git a/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-6.shader_test b/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-6.shader_test
new file mode 100644
index 000000000..0dbea998f
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-6.shader_test
@@ -0,0 +1,29 @@
+/* From section 5.6 "Matrix Components" of the GLSL 1.20 spec:
+ *
+ * "Behavior is undefined when accessing a component outside the bounds
+ * of a matrix with a non-constant expression."
+ *
+ * The behaviour becomes defined only in robustness extensions, however even
+ * if driver is technically allowed to crash or hang, it most likely
+ * doesn't want to.
+ */
+
+[require]
+GLSL >= 1.20
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 120
+
+void main()
+{
+ mat4 mat = mat4(1.0);
+ int index = 2147483647;
+ mat[index > 0 ? index : -1][0] = -1.0;
+
+ gl_FragColor = mat[index];
+}
+
+[test]
+draw rect -1 -1 2 2
diff --git a/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-7.shader_test b/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-7.shader_test
new file mode 100644
index 000000000..a65ab3cb7
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/matrix-out-of-bounds-access/fs-mat4-out-of-bounds-7.shader_test
@@ -0,0 +1,33 @@
+/* From section 5.6 "Matrix Components" of the GLSL 1.20 spec:
+ *
+ * "Behavior is undefined when accessing a component outside the bounds
+ * of a matrix with a non-constant expression."
+ *
+ * The behaviour becomes defined only in robustness extensions, however even
+ * if driver is technically allowed to crash or hang, it most likely
+ * doesn't want to.
+ */
+
+[require]
+GLSL >= 1.20
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 120
+
+uniform int index;
+
+void main()
+{
+ mat4 mat = mat4(1.0);
+ if (mat[index][0] >= 1.0) {
+ mat[index] = vec4(-1.0);
+ }
+
+ gl_FragColor = mat[index];
+}
+
+[test]
+uniform int index -1
+draw rect -1 -1 2 2
diff --git a/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-1.shader_test b/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-1.shader_test
new file mode 100644
index 000000000..0adb797df
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-1.shader_test
@@ -0,0 +1,29 @@
+/* From section 5.5 "Vector Components" of the GLSL 1.20 spec:
+ *
+ * "When indexing with non-constant expressions, behavior is undefined if the
+ * index is negative, or greater than or equal to the size of the vector."
+ *
+ * The behaviour becomes defined only in robustness extensions, however even
+ * if driver is technically allowed to crash or hang, it most likely
+ * doesn't want to.
+ */
+
+[require]
+GLSL >= 1.20
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 120
+
+void main()
+{
+ vec4 vec = vec4(1.0, 2.0, 3.0, 4.0);
+ int index = -1;
+ vec[index] = -1.0;
+
+ gl_FragColor = vec4(vec[index], 0.0, 0.0, 0.0);
+}
+
+[test]
+draw rect -1 -1 2 2
diff --git a/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-2.shader_test b/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-2.shader_test
new file mode 100644
index 000000000..37a3a1ff5
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-2.shader_test
@@ -0,0 +1,31 @@
+/* From section 5.5 "Vector Components" of the GLSL 1.20 spec:
+ *
+ * "When indexing with non-constant expressions, behavior is undefined if the
+ * index is negative, or greater than or equal to the size of the vector."
+ *
+ * The behaviour becomes defined only in robustness extensions, however even
+ * if driver is technically allowed to crash or hang, it most likely
+ * doesn't want to.
+ */
+
+[require]
+GLSL >= 1.20
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 120
+
+void main()
+{
+ vec4 vec = vec4(1.0, 2.0, 3.0, 4.0);
+ int index = -1;
+ if (vec[index] >= 1.0) {
+ vec[index] = -1.0;
+ }
+
+ gl_FragColor = vec4(vec[index], 0.0, 0.0, 0.0);
+}
+
+[test]
+draw rect -1 -1 2 2
diff --git a/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-3.shader_test b/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-3.shader_test
new file mode 100644
index 000000000..71a4fae58
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-3.shader_test
@@ -0,0 +1,31 @@
+/* From section 5.5 "Vector Components" of the GLSL 1.20 spec:
+ *
+ * "When indexing with non-constant expressions, behavior is undefined if the
+ * index is negative, or greater than or equal to the size of the vector."
+ *
+ * The behaviour becomes defined only in robustness extensions, however even
+ * if driver is technically allowed to crash or hang, it most likely
+ * doesn't want to.
+ */
+
+[require]
+GLSL >= 1.20
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 120
+
+void main()
+{
+ vec4 vec = vec4(1.0, 2.0, 3.0, 4.0);
+ int index = 5;
+ if (vec[index] >= 1.0) {
+ vec[index] = -1.0;
+ }
+
+ gl_FragColor = vec4(vec[index], 0.0, 0.0, 0.0);
+}
+
+[test]
+draw rect -1 -1 2 2
diff --git a/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-4.shader_test b/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-4.shader_test
new file mode 100644
index 000000000..03f3fb1a4
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-4.shader_test
@@ -0,0 +1,31 @@
+/* From section 5.5 "Vector Components" of the GLSL 1.20 spec:
+ *
+ * "When indexing with non-constant expressions, behavior is undefined if the
+ * index is negative, or greater than or equal to the size of the vector."
+ *
+ * The behaviour becomes defined only in robustness extensions, however even
+ * if driver is technically allowed to crash or hang, it most likely
+ * doesn't want to.
+ */
+
+[require]
+GLSL >= 1.20
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 120
+
+void main()
+{
+ vec4 vec = vec4(1.0, 2.0, 3.0, 4.0);
+ int index = 2147483647;
+ if (vec[index] >= 1.0) {
+ vec[index] = -1.0;
+ }
+
+ gl_FragColor = vec4(vec[index], 0.0, 0.0, 0.0);
+}
+
+[test]
+draw rect -1 -1 2 2
diff --git a/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-5.shader_test b/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-5.shader_test
new file mode 100644
index 000000000..95205aba9
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-5.shader_test
@@ -0,0 +1,31 @@
+/* From section 5.5 "Vector Components" of the GLSL 1.20 spec:
+ *
+ * "When indexing with non-constant expressions, behavior is undefined if the
+ * index is negative, or greater than or equal to the size of the vector."
+ *
+ * The behaviour becomes defined only in robustness extensions, however even
+ * if driver is technically allowed to crash or hang, it most likely
+ * doesn't want to.
+ */
+
+[require]
+GLSL >= 1.20
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 120
+
+void main()
+{
+ vec4 vec = vec4(1.0, 2.0, 3.0, -1);
+ int index = int(vec.w);
+ if (vec[index] >= 1.0) {
+ vec[index] = -1.0;
+ }
+
+ gl_FragColor = vec4(vec[index], 0.0, 0.0, 0.0);
+}
+
+[test]
+draw rect -1 -1 2 2
diff --git a/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-6.shader_test b/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-6.shader_test
new file mode 100644
index 000000000..a2b492f99
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-6.shader_test
@@ -0,0 +1,29 @@
+/* From section 5.5 "Vector Components" of the GLSL 1.20 spec:
+ *
+ * "When indexing with non-constant expressions, behavior is undefined if the
+ * index is negative, or greater than or equal to the size of the vector."
+ *
+ * The behaviour becomes defined only in robustness extensions, however even
+ * if driver is technically allowed to crash or hang, it most likely
+ * doesn't want to.
+ */
+
+[require]
+GLSL >= 1.20
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 120
+
+void main()
+{
+ vec4 vec = vec4(1.0, 2.0, 3.0, 4.0);
+ int index = 2147483647;
+ vec[index > 0 ? index : -1] = -1.0;
+
+ gl_FragColor = vec4(vec[index], 0.0, 0.0, 0.0);
+}
+
+[test]
+draw rect -1 -1 2 2
diff --git a/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-7.shader_test b/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-7.shader_test
new file mode 100644
index 000000000..76ed99eac
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/vector-out-of-bounds-access/fs-vec4-out-of-bounds-7.shader_test
@@ -0,0 +1,33 @@
+/* From section 5.5 "Vector Components" of the GLSL 1.20 spec:
+ *
+ * "When indexing with non-constant expressions, behavior is undefined if the
+ * index is negative, or greater than or equal to the size of the vector."
+ *
+ * The behaviour becomes defined only in robustness extensions, however even
+ * if driver is technically allowed to crash or hang, it most likely
+ * doesn't want to.
+ */
+
+[require]
+GLSL >= 1.20
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 120
+
+uniform int index;
+
+void main()
+{
+ vec4 vec = vec4(1.0, 2.0, 3.0, 4.0);
+ if (vec[index] >= 1.0) {
+ vec[index] = -1.0;
+ }
+
+ gl_FragColor = vec4(vec[index], 0.0, 0.0, 0.0);
+}
+
+[test]
+uniform int index -1
+draw rect -1 -1 2 2