[Piglit] [PATCH] ext_gpu_shader4: add compiler tests for everything
Marek Olšák
maraeo at gmail.com
Sat Apr 6 19:05:05 UTC 2019
From: Marek Olšák <marek.olsak at amd.com>
---
generated_tests/CMakeLists.txt | 16 +
generated_tests/gen_gpu_shader4_tests.py | 376 ++++++++++++++++++
.../gen_gpu_shader4_tests/binary.frag.mako | 16 +
.../gen_gpu_shader4_tests/binary.vert.mako | 18 +
.../gen_gpu_shader4_tests/binary_op.frag.mako | 16 +
.../gen_gpu_shader4_tests/binary_op.vert.mako | 18 +
.../gen_gpu_shader4_tests/ternary.frag.mako | 16 +
.../gen_gpu_shader4_tests/ternary.vert.mako | 18 +
.../gen_gpu_shader4_tests/tex.frag.mako | 21 +
.../gen_gpu_shader4_tests/tex.vert.mako | 22 +
.../gen_gpu_shader4_tests/tex_bias.frag.mako | 22 +
.../gen_gpu_shader4_tests/tex_grad.frag.mako | 22 +
.../gen_gpu_shader4_tests/tex_grad.vert.mako | 24 ++
.../gen_gpu_shader4_tests/tex_lod.frag.mako | 22 +
.../gen_gpu_shader4_tests/tex_lod.vert.mako | 23 ++
.../texel_fetch.frag.mako | 25 ++
.../texel_fetch.vert.mako | 26 ++
.../texture_size.frag.mako | 21 +
.../texture_size.vert.mako | 22 +
.../gen_gpu_shader4_tests/unary.frag.mako | 15 +
.../gen_gpu_shader4_tests/unary.vert.mako | 17 +
.../gen_gpu_shader4_tests/unary_op.frag.mako | 15 +
.../gen_gpu_shader4_tests/unary_op.vert.mako | 17 +
.../vec_compare.frag.mako | 15 +
.../vec_compare.vert.mako | 18 +
.../compiler/gl_InstanceID.vert | 16 +
.../compiler/gl_PrimitiveID.frag | 13 +
.../ext_gpu_shader4/compiler/gl_VertexID.vert | 16 +
.../compiler/unsigned-int.vert | 22 +
.../compiler/varying-arrays.frag | 22 +
.../compiler/varying-out-float.frag | 25 ++
.../compiler/varying-out-int.frag | 37 ++
.../ext_gpu_shader4/compiler/varyings.frag | 19 +
33 files changed, 1011 insertions(+)
create mode 100644 generated_tests/gen_gpu_shader4_tests.py
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/binary.frag.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/binary.vert.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/binary_op.frag.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/binary_op.vert.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/ternary.frag.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/ternary.vert.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/tex.frag.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/tex.vert.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/tex_bias.frag.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/tex_grad.frag.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/tex_grad.vert.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/tex_lod.frag.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/tex_lod.vert.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/texel_fetch.frag.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/texel_fetch.vert.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/texture_size.frag.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/texture_size.vert.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/unary.frag.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/unary.vert.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/unary_op.frag.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/unary_op.vert.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/vec_compare.frag.mako
create mode 100644 generated_tests/templates/gen_gpu_shader4_tests/vec_compare.vert.mako
create mode 100644 tests/spec/ext_gpu_shader4/compiler/gl_InstanceID.vert
create mode 100644 tests/spec/ext_gpu_shader4/compiler/gl_PrimitiveID.frag
create mode 100644 tests/spec/ext_gpu_shader4/compiler/gl_VertexID.vert
create mode 100644 tests/spec/ext_gpu_shader4/compiler/unsigned-int.vert
create mode 100644 tests/spec/ext_gpu_shader4/compiler/varying-arrays.frag
create mode 100644 tests/spec/ext_gpu_shader4/compiler/varying-out-float.frag
create mode 100644 tests/spec/ext_gpu_shader4/compiler/varying-out-int.frag
create mode 100644 tests/spec/ext_gpu_shader4/compiler/varyings.frag
diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
index adec9b4cb..6d41dd28d 100644
--- a/generated_tests/CMakeLists.txt
+++ b/generated_tests/CMakeLists.txt
@@ -90,20 +90,35 @@ piglit_make_generated_tests(
templates/interpolation-qualifier-built-in-variable/vs-fs-flip.shader_test.mako
templates/interpolation-qualifier-built-in-variable/vs-fs.shader_test.mako
)
piglit_make_generated_tests(
texture_lod_tests.list
gen_texture_lod_tests.py
templates/gen_texture_lod_tests/tex_grad.vert.mako
templates/gen_texture_lod_tests/tex_grad.frag.mako
templates/gen_texture_lod_tests/frag_lod.glsl_parser_test.mako
)
+piglit_make_generated_tests(
+ gpu_shader4_tests.list
+ gen_gpu_shader4_tests.py
+ templates/gen_texture_lod_tests/tex.frag.mako
+ templates/gen_texture_lod_tests/tex.vert.mako
+ templates/gen_texture_lod_tests/tex_bias.mako
+ templates/gen_texture_lod_tests/tex_grad.frag.mako
+ templates/gen_texture_lod_tests/tex_grad.vert.mako
+ templates/gen_texture_lod_tests/tex_lod.frag.mako
+ templates/gen_texture_lod_tests/tex_lod.vert.mako
+ templates/gen_texture_lod_tests/texel_fetch.frag.mako
+ templates/gen_texture_lod_tests/texel_fetch.vert.mako
+ templates/gen_texture_lod_tests/texture_size.frag.mako
+ templates/gen_texture_lod_tests/texture_size.vert.mako
+ )
piglit_make_generated_tests(
outerproduct_invalid_params.list
gen_outerproduct_invalid_params.py
templates/gen_outerproduct_invalid_params/template.vert.mako
)
piglit_make_generated_tests(
outerproduct_tests.list
gen_outerproduct_tests.py
templates/gen_outerproduct_tests/template.shader_test.mako
)
@@ -261,20 +276,21 @@ add_custom_target(gen-gl-tests
shader_precision_tests.list
shader_framebuffer_fetch_tests.list
shader_image_load_store_tests.list
shader_image_nv_image_formats_tests.list
shader_intel_conservative_rasterization.list
variable_index_read_tests.list
gen_extensions_defined.list
vp-tex.list
variable_index_write_tests.list
vs_in_fp64.list
+ gpu_shader4_tests.list
)
# Create a custom target for generating OpenCL tests
# This is not added to the default target, instead it is added
# as a dependency of gen-tests if OpenCL tests are enabled
add_custom_target(gen-cl-tests
DEPENDS builtin_cl_int_tests.list
builtin_cl_math_tests.list
builtin_cl_relational_tests.list
builtin_cl_common_tests.list
diff --git a/generated_tests/gen_gpu_shader4_tests.py b/generated_tests/gen_gpu_shader4_tests.py
new file mode 100644
index 000000000..c78824bc1
--- /dev/null
+++ b/generated_tests/gen_gpu_shader4_tests.py
@@ -0,0 +1,376 @@
+# coding=utf-8
+# Copyright (c) 2014 Intel Corporation
+# Copyright (c) 2018 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 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 spec/EXT_gpu_shader4 tests """
+
+from __future__ import print_function, division, absolute_import
+import os
+import collections
+
+from templates import template_dir
+from modules import utils
+
+TEMPLATES = template_dir(os.path.basename(os.path.splitext(__file__)[0]))
+
+vec = ['vec2', 'vec3', 'vec4']
+ivec = ['ivec2', 'ivec3', 'ivec4']
+uvec = ['uvec2', 'uvec3', 'uvec4']
+
+genType = ['float'] + vec
+genIType = ['int'] + ivec
+genUType = ['unsigned int'] + uvec
+
+ShiftOpTypes = [
+ ('int', 'int'), ('unsigned int', 'unsigned int'),
+ ('ivec2', 'ivec2'), ('ivec3', 'ivec3'), ('ivec4', 'ivec4'),
+ ('uvec2', 'uvec2'), ('uvec3', 'uvec3'), ('uvec4', 'uvec4'),
+
+ ('ivec2', 'int'), ('ivec3', 'int'), ('ivec4', 'int'),
+ ('uvec2', 'unsigned int'), ('uvec3', 'unsigned int'), ('uvec4', 'unsigned int'),
+]
+
+BinaryOpTypes = ShiftOpTypes + [
+ ('int', 'ivec2'), ('int', 'ivec3'), ('int', 'ivec4'),
+ ('unsigned int', 'uvec2'), ('unsigned int', 'uvec3'), ('unsigned int', 'uvec4'),
+]
+
+OperatorParams = collections.namedtuple(
+ 'OperatorParams', ['name', 'op', 'types'])
+
+UNARY_OP_TESTS = [
+ OperatorParams('bitwise-not', '~', genIType + genUType),
+]
+
+BINARY_OP_TESTS = [
+ OperatorParams('mod', '%', BinaryOpTypes),
+ OperatorParams('bitwise-and', '&', BinaryOpTypes),
+ OperatorParams('bitwise-or', '|', BinaryOpTypes),
+ OperatorParams('xor', '^', BinaryOpTypes),
+ OperatorParams('lshift', '<<', ShiftOpTypes),
+ OperatorParams('rshift', '>>', ShiftOpTypes),
+]
+
+
+Type1Params = collections.namedtuple(
+ 'Type1Params', ['func', 'type1'])
+Type2Params = collections.namedtuple(
+ 'Type2Params', ['func', 'type1', 'type2'])
+
+UNARY_TESTS = [
+ Type1Params('abs', genIType),
+ Type1Params('sign', genIType),
+ Type1Params('truncate', genType),
+ Type1Params('round', genType),
+]
+
+BINARY_TESTS = [
+ Type1Params('min', genIType),
+ Type2Params('min', ivec, 'int'),
+ Type1Params('min', genUType),
+ Type2Params('min', uvec, 'unsigned int'),
+
+ Type1Params('max', genIType),
+ Type2Params('max', ivec, 'int'),
+ Type1Params('max', genUType),
+ Type2Params('max', uvec, 'unsigned int'),
+]
+
+TERNARY_TESTS = [
+ Type1Params('clamp', genIType),
+ Type2Params('clamp', ivec, 'int'),
+ Type1Params('clamp', genUType),
+ Type2Params('clamp', uvec, 'unsigned int'),
+]
+
+VEC_COMPARE_TESTS = [
+ Type1Params('lessThan', uvec),
+ Type1Params('lessThanEqual', uvec),
+ Type1Params('greaterThan', uvec),
+ Type1Params('greaterThanEqual', uvec),
+ Type1Params('equal', uvec),
+ Type1Params('notEqual', uvec),
+]
+
+
+FLOAT = ['']
+INT = ['i', 'u']
+ALL = FLOAT + INT
+
+FetchParams = collections.namedtuple(
+ 'FetchParams', ['sampler', 'coord', 'offsetcoord', 'variants'])
+
+FETCH_TESTS = [
+ FetchParams('1D', 'int', 'int', ALL),
+ FetchParams('2D', 'ivec2', 'ivec2', ALL),
+ FetchParams('3D', 'ivec3', 'ivec3', ALL),
+ FetchParams('2DRect', 'ivec2', 'ivec2', ALL),
+ FetchParams('1DArray', 'ivec2', 'int', ALL),
+ FetchParams('2DArray', 'ivec3', 'ivec2', ALL),
+ FetchParams('Buffer', 'int', '', ALL),
+]
+
+SIZE_TESTS = FETCH_TESTS + [
+ FetchParams('Cube', 'ivec2', '', ALL),
+]
+
+
+TextureParams = collections.namedtuple(
+ 'TextureParams', ['func', 'sampler', 'coord', 'offsetcoord', 'variants'])
+
+# Variants: std, bias, lod
+COMMON_TEXTURE_TESTS = [
+ # Inherited from GLSL 1.10, test integer textures
+ TextureParams('texture1D', '1D', 'float', 'int', INT),
+ TextureParams('texture1DProj', '1D', 'vec2', 'int', INT),
+ TextureParams('texture1DProj', '1D', 'vec4', 'int', INT),
+
+ TextureParams('texture2D', '2D', 'vec2', 'ivec2', INT),
+ TextureParams('texture2DProj', '2D', 'vec3', 'ivec2', INT),
+ TextureParams('texture2DProj', '2D', 'vec4', 'ivec2', INT),
+
+ TextureParams('texture3D', '3D', 'vec3', 'ivec3', INT),
+ TextureParams('texture3DProj', '3D', 'vec4', 'ivec3', INT),
+
+ TextureParams('textureCube', 'Cube', 'vec3', '', INT),
+
+ # Added by GL_EXT_gpu_shader4
+ TextureParams('texture1DArray', '1DArray', 'vec2', 'int', ALL),
+ TextureParams('texture2DArray', '2DArray', 'vec3', 'ivec2', ALL),
+
+ TextureParams('shadow1D', '1DShadow', 'vec3', 'int', FLOAT),
+ TextureParams('shadow2D', '2DShadow', 'vec3', 'ivec2', FLOAT),
+ TextureParams('shadow1DProj', '1DShadow', 'vec4', 'int', FLOAT),
+ TextureParams('shadow2DProj', '2DShadow', 'vec4', 'ivec2', FLOAT),
+ TextureParams('shadow1DArray', '1DArrayShadow', 'vec3', 'int', FLOAT),
+]
+
+TEXTURE_TESTS = COMMON_TEXTURE_TESTS + [
+ TextureParams('shadow2DArray', '2DArrayShadow', 'vec4', 'ivec2', FLOAT),
+ TextureParams('shadowCube', 'CubeShadow', 'vec4', '', FLOAT),
+
+ # Inherited from ARB_texture_rectangle, test integer textures
+ TextureParams('texture2DRect', '2DRect', 'vec2', 'ivec2', INT),
+ TextureParams('texture2DRectProj', '2DRect', 'vec3', 'ivec2', INT),
+ TextureParams('texture2DRectProj', '2DRect', 'vec4', 'ivec2', INT),
+ TextureParams('shadow2DRect', '2DRectShadow', 'vec3', 'ivec2', FLOAT),
+ TextureParams('shadow2DRectProj', '2DRectShadow', 'vec4', 'ivec2', FLOAT),
+]
+
+LOD_TESTS = COMMON_TEXTURE_TESTS
+BIAS_TESTS = COMMON_TEXTURE_TESTS
+
+
+GradParams = collections.namedtuple(
+ 'GradParams', ['coord', 'grad', 'offsetcoord', 'sampler', 'func', 'variants'])
+
+GRAD_TESTS = [
+ GradParams('float', 'float', 'int', '1D', 'texture1D', ALL),
+ GradParams('vec2', 'float', 'int', '1D', 'texture1DProj', ALL),
+ GradParams('vec4', 'float', 'int', '1D', 'texture1DProj', ALL),
+ GradParams('vec2', 'float', 'int', '1DArray', 'texture1DArray', ALL),
+
+ GradParams('vec2', 'vec2', 'ivec2', '2D', 'texture2D', ALL),
+ GradParams('vec3', 'vec2', 'ivec2', '2D', 'texture2DProj', ALL),
+ GradParams('vec4', 'vec2', 'ivec2', '2D', 'texture2DProj', ALL),
+ GradParams('vec3', 'vec2', 'ivec2', '2DArray', 'texture2DArray', ALL),
+
+ GradParams('vec3', 'vec3', 'ivec3', '3D', 'texture3D', ALL),
+ GradParams('vec4', 'vec3', 'ivec3', '3D', 'texture3DProj', ALL),
+
+ GradParams('vec3', 'vec3', '', 'Cube', 'textureCube', ALL),
+
+ GradParams('vec3', 'float', 'int', '1DShadow', 'shadow1D', FLOAT),
+ GradParams('vec4', 'float', 'int', '1DShadow', 'shadow1DProj', FLOAT),
+ GradParams('vec3', 'float', 'int', '1DArrayShadow', 'shadow1DArray', FLOAT),
+
+ GradParams('vec3', 'vec2', 'ivec2', '2DShadow', 'shadow2D', FLOAT),
+ GradParams('vec4', 'vec2', 'ivec2', '2DShadow', 'shadow2DProj', FLOAT),
+ GradParams('vec4', 'vec2', 'ivec2', '2DArrayShadow', 'shadow2DArray', FLOAT),
+
+ GradParams('vec2', 'vec2', 'ivec2', '2DRect', 'texture2DRect', ALL),
+ GradParams('vec3', 'vec2', 'ivec2', '2DRect', 'texture2DRectProj', ALL),
+ GradParams('vec4', 'vec2', 'ivec2', '2DRect', 'texture2DRectProj', ALL),
+
+ GradParams('vec3', 'vec2', 'ivec2', '2DRectShadow', 'shadow2DRect', FLOAT),
+ GradParams('vec4', 'vec2', 'ivec2', '2DRectShadow', 'shadow2DRectProj', FLOAT),
+
+ GradParams('vec4', 'vec3', '', 'CubeShadow', 'shadowCube', FLOAT),
+]
+
+def get_swizzle(vtype):
+ """
+ Expand the type to vec4.
+ """
+ if '3' in vtype:
+ return '.xyzz';
+ if '2' in vtype:
+ return '.xyyy';
+ return '';
+
+def get_bvec(vtype):
+ """
+ Return the corresponding bvec type.
+ """
+ if '4' in vtype:
+ return 'bvec4';
+ if '3' in vtype:
+ return 'bvec3';
+ if '2' in vtype:
+ return 'bvec2';
+ return 'invalid';
+
+def get_extensions(sampler):
+ """ If this test uses GL_ARB_texture_rectangle add it
+
+ GL_ARB_texture_rectangle is an odd extension, it is on by default, so don't
+ generate a #extension in the shader, just in the config block.
+
+ """
+ if 'Rect' in sampler:
+ return 'GL_EXT_gpu_shader4 GL_ARB_texture_rectangle'
+
+ if 'Array' in sampler:
+ return 'GL_EXT_gpu_shader4 GL_EXT_texture_array'
+
+ if 'Buffer' in sampler:
+ return 'GL_EXT_gpu_shader4 GL_EXT_texture_buffer_object'
+
+ return 'GL_EXT_gpu_shader4'
+
+
+def main():
+ """ Main function
+
+ Writes tests to generated_tests/spec/ext_gpu_shader4/ directory
+
+ """
+ dirname = 'spec/ext_gpu_shader4/compiler'
+ utils.safe_makedirs(dirname)
+
+ for params in UNARY_OP_TESTS:
+ for type1 in params.types:
+ name = os.path.join(
+ dirname,
+ "{func}-{type1}".format(
+ func=params.name,
+ type1=type1.replace(' ', '_')))
+
+ for stage in ['frag', 'vert']:
+ filename = '{0}.{1}'.format(name, stage)
+ print(filename)
+ with open(filename, 'w+') as f:
+ f.write(TEMPLATES.get_template(
+ '{0}.{1}.mako'.format('unary_op', stage)).render_unicode(
+ param=params,
+ type1=type1,
+ swizzle=get_swizzle(type1)))
+
+ for params in BINARY_OP_TESTS:
+ for types in params.types:
+ name = os.path.join(
+ dirname,
+ "{func}-{type1}-{type2}".format(
+ func=params.name,
+ type1=types[0].replace(' ', '_'),
+ type2=types[1].replace(' ', '_')))
+ result_type = types[0] if 'int' in types[1] else types[1]
+
+ for stage in ['frag', 'vert']:
+ filename = '{0}.{1}'.format(name, stage)
+ print(filename)
+ with open(filename, 'w+') as f:
+ f.write(TEMPLATES.get_template(
+ '{0}.{1}.mako'.format('binary_op', stage)).render_unicode(
+ param=params,
+ types=types,
+ result_type=result_type,
+ swizzle=get_swizzle(result_type)))
+
+ for tests in [('unary', UNARY_TESTS),
+ ('binary', BINARY_TESTS),
+ ('ternary', TERNARY_TESTS),
+ ('vec_compare', VEC_COMPARE_TESTS)]:
+ for params in tests[1]:
+ for type1 in params.type1:
+ name = os.path.join(
+ dirname,
+ "{func}-{type1}{type2}".format(
+ func=params.func,
+ type1=type1,
+ type2='-' + params.type2 if 'type2' in params._fields else ''))
+
+ for stage in ['frag', 'vert']:
+ filename = '{0}.{1}'.format(name, stage)
+ print(filename)
+ with open(filename, 'w+') as f:
+ f.write(TEMPLATES.get_template(
+ '{0}.{1}.mako'.format(tests[0], stage)).render_unicode(
+ param=params,
+ type1=type1,
+ type2=params.type2 if 'type2' in params._fields else type1,
+ swizzle=get_swizzle(type1),
+ bvec=get_bvec(type1)))
+
+ for tests in [('texture_size', SIZE_TESTS, ''),
+ ('texel_fetch', FETCH_TESTS, ''),
+ ('tex', TEXTURE_TESTS, ''),
+ ('tex_bias', BIAS_TESTS, ''),
+ ('tex_lod', LOD_TESTS, ''),
+ ('tex_grad', GRAD_TESTS, ''),
+ ('texel_fetch', FETCH_TESTS, 'Offset'),
+ ('tex', TEXTURE_TESTS, 'Offset'),
+ ('tex_bias', BIAS_TESTS, 'Offset'),
+ ('tex_lod', LOD_TESTS, 'Offset'),
+ ('tex_grad', GRAD_TESTS, 'Offset')]:
+ for params in tests[1]:
+ if tests[2] == 'Offset' and params.offsetcoord == '':
+ continue
+
+ for prefix in params.variants:
+ name = os.path.join(
+ dirname,
+ "{0}{func}{offset}-{prefix}sampler{sampler}-{coord}".format(
+ tests[0],
+ func='-' + params.func if 'func' in params._fields else '',
+ offset=tests[2],
+ prefix=prefix,
+ sampler=params.sampler,
+ coord=params.coord))
+
+ stages = ['frag']
+ if tests[0] != 'tex_bias':
+ stages = stages + ['vert']
+
+ for stage in stages:
+ filename = '{0}.{1}'.format(name, stage)
+ print(filename)
+ with open(filename, 'w+') as f:
+ f.write(TEMPLATES.get_template(
+ '{0}.{1}.mako'.format(tests[0], stage)).render_unicode(
+ param=params,
+ extensions=get_extensions(params.sampler),
+ prefix=prefix,
+ swizzle=get_swizzle(params.coord),
+ offset=tests[2]))
+
+if __name__ == '__main__':
+ main()
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/binary.frag.mako b/generated_tests/templates/gen_gpu_shader4_tests/binary.frag.mako
new file mode 100644
index 000000000..f5e1ce50f
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/binary.frag.mako
@@ -0,0 +1,16 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: GL_EXT_gpu_shader4
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+flat varying ${type1} x;
+flat varying ${type2} y;
+
+void main()
+{
+ ${type1} v = ${param.func}(x, y);
+ gl_FragColor = vec4(v${swizzle});
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/binary.vert.mako b/generated_tests/templates/gen_gpu_shader4_tests/binary.vert.mako
new file mode 100644
index 000000000..4d29720b1
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/binary.vert.mako
@@ -0,0 +1,18 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: GL_EXT_gpu_shader4
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+attribute vec4 pos;
+attribute ${type1} x;
+attribute ${type2} y;
+flat varying ${type1} v;
+
+void main()
+{
+ gl_Position = pos;
+ v = ${param.func}(x, y);
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/binary_op.frag.mako b/generated_tests/templates/gen_gpu_shader4_tests/binary_op.frag.mako
new file mode 100644
index 000000000..3eeebfd61
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/binary_op.frag.mako
@@ -0,0 +1,16 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: GL_EXT_gpu_shader4
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+flat varying ${types[0]} x;
+flat varying ${types[1]} y;
+
+void main()
+{
+ ${result_type} v = x ${param.op} y;
+ gl_FragColor = vec4(v${swizzle});
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/binary_op.vert.mako b/generated_tests/templates/gen_gpu_shader4_tests/binary_op.vert.mako
new file mode 100644
index 000000000..bc22c62e3
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/binary_op.vert.mako
@@ -0,0 +1,18 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: GL_EXT_gpu_shader4
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+attribute vec4 pos;
+attribute ${types[0]} x;
+attribute ${types[1]} y;
+flat varying ${result_type} v;
+
+void main()
+{
+ gl_Position = pos;
+ v = x ${param.op} y;
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/ternary.frag.mako b/generated_tests/templates/gen_gpu_shader4_tests/ternary.frag.mako
new file mode 100644
index 000000000..ea496d046
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/ternary.frag.mako
@@ -0,0 +1,16 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: GL_EXT_gpu_shader4
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+flat varying ${type1} x;
+flat varying ${type2} y, z;
+
+void main()
+{
+ ${type1} v = ${param.func}(x, y, z);
+ gl_FragColor = vec4(v${swizzle});
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/ternary.vert.mako b/generated_tests/templates/gen_gpu_shader4_tests/ternary.vert.mako
new file mode 100644
index 000000000..549adfcc8
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/ternary.vert.mako
@@ -0,0 +1,18 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: GL_EXT_gpu_shader4
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+attribute vec4 pos;
+attribute ${type1} x;
+attribute ${type2} y, z;
+flat varying ${type1} v;
+
+void main()
+{
+ gl_Position = pos;
+ v = ${param.func}(x, y, z);
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/tex.frag.mako b/generated_tests/templates/gen_gpu_shader4_tests/tex.frag.mako
new file mode 100644
index 000000000..993eaaeb2
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/tex.frag.mako
@@ -0,0 +1,21 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: ${extensions}
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+uniform ${prefix}sampler${param.sampler} s;
+flat varying ${param.coord} coord;
+
+void main()
+{
+ ${prefix}vec4 v = ${param.func}${offset}(s, coord
+% if offset == 'Offset':
+ , ${param.offsetcoord}(1)
+% endif
+ );
+
+ gl_FragColor = vec4(v);
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/tex.vert.mako b/generated_tests/templates/gen_gpu_shader4_tests/tex.vert.mako
new file mode 100644
index 000000000..d8d484cd2
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/tex.vert.mako
@@ -0,0 +1,22 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: ${extensions}
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+uniform ${prefix}sampler${param.sampler} s;
+attribute vec4 pos;
+attribute ${param.coord} coord;
+flat varying ${prefix}vec4 color;
+
+void main()
+{
+ gl_Position = pos;
+ color = ${param.func}${offset}(s, coord
+% if offset == 'Offset':
+ , ${param.offsetcoord}(1)
+% endif
+ );
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/tex_bias.frag.mako b/generated_tests/templates/gen_gpu_shader4_tests/tex_bias.frag.mako
new file mode 100644
index 000000000..2726c8819
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/tex_bias.frag.mako
@@ -0,0 +1,22 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: ${extensions}
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+uniform ${prefix}sampler${param.sampler} s;
+flat varying ${param.coord} coord;
+varying float bias;
+
+void main()
+{
+ ${prefix}vec4 v = ${param.func}${offset}(s, coord,
+% if offset == 'Offset':
+ ${param.offsetcoord}(1),
+% endif
+ bias);
+
+ gl_FragColor = vec4(v);
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/tex_grad.frag.mako b/generated_tests/templates/gen_gpu_shader4_tests/tex_grad.frag.mako
new file mode 100644
index 000000000..59ddcb911
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/tex_grad.frag.mako
@@ -0,0 +1,22 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: ${extensions}
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+uniform ${prefix}sampler${param.sampler} s;
+varying ${param.coord} coord;
+varying ${param.grad} dPdx;
+varying ${param.grad} dPdy;
+
+void main()
+{
+ ${prefix}vec4 v = ${param.func}Grad${offset}(s, coord, dPdx, dPdy
+% if offset == 'Offset':
+ , ${param.offsetcoord}(1)
+% endif
+ );
+ gl_FragColor = vec4(v);
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/tex_grad.vert.mako b/generated_tests/templates/gen_gpu_shader4_tests/tex_grad.vert.mako
new file mode 100644
index 000000000..ee24a4102
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/tex_grad.vert.mako
@@ -0,0 +1,24 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: ${extensions}
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+uniform ${prefix}sampler${param.sampler} s;
+attribute vec4 pos;
+attribute ${param.coord} coord;
+attribute ${param.grad} dPdx;
+attribute ${param.grad} dPdy;
+flat varying ${prefix}vec4 color;
+
+void main()
+{
+ gl_Position = pos;
+ color = ${param.func}Grad${offset}(s, coord, dPdx, dPdy
+% if offset == 'Offset':
+ , ${param.offsetcoord}(1)
+% endif
+ );
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/tex_lod.frag.mako b/generated_tests/templates/gen_gpu_shader4_tests/tex_lod.frag.mako
new file mode 100644
index 000000000..0f6fe8839
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/tex_lod.frag.mako
@@ -0,0 +1,22 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: ${extensions}
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+uniform ${prefix}sampler${param.sampler} s;
+flat varying ${param.coord} coord;
+varying float lod;
+
+void main()
+{
+ ${prefix}vec4 v = ${param.func}Lod${offset}(s, coord, lod
+% if offset == 'Offset':
+ , ${param.offsetcoord}(1)
+% endif
+ );
+
+ gl_FragColor = vec4(v);
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/tex_lod.vert.mako b/generated_tests/templates/gen_gpu_shader4_tests/tex_lod.vert.mako
new file mode 100644
index 000000000..4a2460f07
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/tex_lod.vert.mako
@@ -0,0 +1,23 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: ${extensions}
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+uniform ${prefix}sampler${param.sampler} s;
+attribute vec4 pos;
+attribute ${param.coord} coord;
+attribute float lod;
+flat varying ${prefix}vec4 color;
+
+void main()
+{
+ gl_Position = pos;
+ color = ${param.func}Lod${offset}(s, coord, lod
+% if offset == 'Offset':
+ , ${param.offsetcoord}(1)
+% endif
+ );
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/texel_fetch.frag.mako b/generated_tests/templates/gen_gpu_shader4_tests/texel_fetch.frag.mako
new file mode 100644
index 000000000..2f8c329da
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/texel_fetch.frag.mako
@@ -0,0 +1,25 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: ${extensions}
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+uniform ${prefix}sampler${param.sampler} s;
+flat varying ${param.coord} coord, offset;
+flat varying int lod;
+
+void main()
+{
+ ${prefix}vec4 v = texelFetch${param.sampler}${offset}(s, coord
+% if param.sampler != '2DRect' and param.sampler != 'Buffer':
+ , lod
+% endif
+% if offset == 'Offset':
+ , ${param.offsetcoord}(1)
+% endif
+ );
+
+ gl_FragColor = vec4(v);
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/texel_fetch.vert.mako b/generated_tests/templates/gen_gpu_shader4_tests/texel_fetch.vert.mako
new file mode 100644
index 000000000..b8ccea574
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/texel_fetch.vert.mako
@@ -0,0 +1,26 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: ${extensions}
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+uniform ${prefix}sampler${param.sampler} s;
+attribute vec4 pos;
+attribute ${param.coord} coord;
+attribute int lod;
+flat varying ${prefix}vec4 color;
+
+void main()
+{
+ gl_Position = pos;
+ color = texelFetch${param.sampler}${offset}(s, coord
+% if param.sampler != '2DRect' and param.sampler != 'Buffer':
+ , lod
+% endif
+% if offset == 'Offset':
+ , ${param.offsetcoord}(1)
+% endif
+ );
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/texture_size.frag.mako b/generated_tests/templates/gen_gpu_shader4_tests/texture_size.frag.mako
new file mode 100644
index 000000000..3e06729f7
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/texture_size.frag.mako
@@ -0,0 +1,21 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: ${extensions}
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+uniform ${prefix}sampler${param.sampler} s;
+flat varying int lod;
+
+void main()
+{
+ ${param.coord} v = textureSize${param.sampler}(s
+% if param.sampler != '2DRect' and param.sampler != 'Buffer':
+ , lod
+% endif
+ );
+
+ gl_FragColor = vec4(v${swizzle});
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/texture_size.vert.mako b/generated_tests/templates/gen_gpu_shader4_tests/texture_size.vert.mako
new file mode 100644
index 000000000..0327b5a49
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/texture_size.vert.mako
@@ -0,0 +1,22 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: ${extensions}
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+uniform ${prefix}sampler${param.sampler} s;
+attribute vec4 pos;
+attribute int lod;
+flat varying ${param.coord} size;
+
+void main()
+{
+ gl_Position = pos;
+ size = textureSize${param.sampler}(s
+% if param.sampler != '2DRect' and param.sampler != 'Buffer':
+ , lod
+% endif
+ );
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/unary.frag.mako b/generated_tests/templates/gen_gpu_shader4_tests/unary.frag.mako
new file mode 100644
index 000000000..4c64186fe
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/unary.frag.mako
@@ -0,0 +1,15 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: GL_EXT_gpu_shader4
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+flat varying ${type1} x;
+
+void main()
+{
+ ${type1} v = ${param.func}(x);
+ gl_FragColor = vec4(v${swizzle});
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/unary.vert.mako b/generated_tests/templates/gen_gpu_shader4_tests/unary.vert.mako
new file mode 100644
index 000000000..50a7fe513
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/unary.vert.mako
@@ -0,0 +1,17 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: GL_EXT_gpu_shader4
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+attribute vec4 pos;
+attribute ${type1} x;
+flat varying ${type1} v;
+
+void main()
+{
+ gl_Position = pos;
+ v = ${param.func}(x);
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/unary_op.frag.mako b/generated_tests/templates/gen_gpu_shader4_tests/unary_op.frag.mako
new file mode 100644
index 000000000..c7407abc5
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/unary_op.frag.mako
@@ -0,0 +1,15 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: GL_EXT_gpu_shader4
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+flat varying ${type1} x;
+
+void main()
+{
+ ${type1} v = ${param.op}x;
+ gl_FragColor = vec4(v${swizzle});
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/unary_op.vert.mako b/generated_tests/templates/gen_gpu_shader4_tests/unary_op.vert.mako
new file mode 100644
index 000000000..06516d99d
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/unary_op.vert.mako
@@ -0,0 +1,17 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: GL_EXT_gpu_shader4
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+attribute vec4 pos;
+attribute ${type1} x;
+flat varying ${type1} v;
+
+void main()
+{
+ gl_Position = pos;
+ v = ${param.op}x;
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/vec_compare.frag.mako b/generated_tests/templates/gen_gpu_shader4_tests/vec_compare.frag.mako
new file mode 100644
index 000000000..60d1c5f4c
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/vec_compare.frag.mako
@@ -0,0 +1,15 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: GL_EXT_gpu_shader4
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+flat varying ${type1} x, y;
+
+void main()
+{
+ ${bvec} v = ${param.func}(x, y);
+ gl_FragColor = vec4(v${swizzle});
+}
diff --git a/generated_tests/templates/gen_gpu_shader4_tests/vec_compare.vert.mako b/generated_tests/templates/gen_gpu_shader4_tests/vec_compare.vert.mako
new file mode 100644
index 000000000..7f2274c60
--- /dev/null
+++ b/generated_tests/templates/gen_gpu_shader4_tests/vec_compare.vert.mako
@@ -0,0 +1,18 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: GL_EXT_gpu_shader4
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+attribute vec4 pos;
+attribute ${type1} x, y;
+flat varying ${type1} v;
+
+void main()
+{
+ gl_Position = pos;
+ ${bvec} b = ${param.func}(x, y);
+ v = ${type1}(b);
+}
diff --git a/tests/spec/ext_gpu_shader4/compiler/gl_InstanceID.vert b/tests/spec/ext_gpu_shader4/compiler/gl_InstanceID.vert
new file mode 100644
index 000000000..ef95a0492
--- /dev/null
+++ b/tests/spec/ext_gpu_shader4/compiler/gl_InstanceID.vert
@@ -0,0 +1,16 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: GL_EXT_gpu_shader4
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+attribute vec4 pos;
+flat varying int v;
+
+void main()
+{
+ gl_Position = pos;
+ v = gl_InstanceID;
+}
diff --git a/tests/spec/ext_gpu_shader4/compiler/gl_PrimitiveID.frag b/tests/spec/ext_gpu_shader4/compiler/gl_PrimitiveID.frag
new file mode 100644
index 000000000..035d2514a
--- /dev/null
+++ b/tests/spec/ext_gpu_shader4/compiler/gl_PrimitiveID.frag
@@ -0,0 +1,13 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: GL_EXT_gpu_shader4
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+void main()
+{
+ int v = gl_PrimitiveID;
+ gl_FragColor = vec4(v);
+}
diff --git a/tests/spec/ext_gpu_shader4/compiler/gl_VertexID.vert b/tests/spec/ext_gpu_shader4/compiler/gl_VertexID.vert
new file mode 100644
index 000000000..d890137ec
--- /dev/null
+++ b/tests/spec/ext_gpu_shader4/compiler/gl_VertexID.vert
@@ -0,0 +1,16 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: GL_EXT_gpu_shader4
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+attribute vec4 pos;
+flat varying int v;
+
+void main()
+{
+ gl_Position = pos;
+ v = gl_VertexID;
+}
diff --git a/tests/spec/ext_gpu_shader4/compiler/unsigned-int.vert b/tests/spec/ext_gpu_shader4/compiler/unsigned-int.vert
new file mode 100644
index 000000000..96f071dbb
--- /dev/null
+++ b/tests/spec/ext_gpu_shader4/compiler/unsigned-int.vert
@@ -0,0 +1,22 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: GL_EXT_gpu_shader4
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+attribute vec4 pos;
+attribute unsigned int x;
+uniform unsigned int w;
+flat varying unsigned int v;
+
+void main()
+{
+ gl_Position = pos;
+ int i = int(pos.y);
+ unsigned int t = 1u;
+ unsigned int u = unsigned int(pos.x);
+ unsigned int v = unsigned int(i);
+ v = t + unsigned int(x + 2U) + u + v + w;
+}
diff --git a/tests/spec/ext_gpu_shader4/compiler/varying-arrays.frag b/tests/spec/ext_gpu_shader4/compiler/varying-arrays.frag
new file mode 100644
index 000000000..57e478f03
--- /dev/null
+++ b/tests/spec/ext_gpu_shader4/compiler/varying-arrays.frag
@@ -0,0 +1,22 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: GL_EXT_gpu_shader4
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+flat varying unsigned int u1[2];
+flat varying uvec2 u2[2];
+flat varying uvec3 u3[2];
+flat varying uvec4 u4[2];
+
+flat varying int i1[2];
+flat varying ivec2 i2[2];
+flat varying ivec3 i3[2];
+flat varying ivec4 i4[2];
+
+void main()
+{
+ gl_FragColor = vec4(1.0);
+}
diff --git a/tests/spec/ext_gpu_shader4/compiler/varying-out-float.frag b/tests/spec/ext_gpu_shader4/compiler/varying-out-float.frag
new file mode 100644
index 000000000..1b68cd8ee
--- /dev/null
+++ b/tests/spec/ext_gpu_shader4/compiler/varying-out-float.frag
@@ -0,0 +1,25 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: GL_EXT_gpu_shader4
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+flat varying float u1;
+flat varying vec2 u2;
+flat varying vec3 u3;
+flat varying vec4 u4;
+
+varying out float o1;
+varying out vec2 o2;
+varying out vec3 o3;
+varying out vec4 o4;
+
+void main()
+{
+ o1 = u1;
+ o2 = u2;
+ o3 = u3;
+ o4 = u4;
+}
diff --git a/tests/spec/ext_gpu_shader4/compiler/varying-out-int.frag b/tests/spec/ext_gpu_shader4/compiler/varying-out-int.frag
new file mode 100644
index 000000000..0b8b68dde
--- /dev/null
+++ b/tests/spec/ext_gpu_shader4/compiler/varying-out-int.frag
@@ -0,0 +1,37 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: GL_EXT_gpu_shader4
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+flat varying int i1;
+flat varying ivec2 i2;
+flat varying ivec3 i3;
+flat varying ivec4 i4;
+flat varying unsigned int u1;
+flat varying uvec2 u2;
+flat varying uvec3 u3;
+flat varying uvec4 u4;
+
+varying out unsigned int o1;
+varying out uvec2 o2;
+varying out uvec3 o3;
+varying out uvec4 o4;
+varying out int o5;
+varying out ivec2 o6;
+varying out ivec3 o7;
+varying out ivec4 o8;
+
+void main()
+{
+ o1 = u1;
+ o2 = u2;
+ o3 = u3;
+ o4 = u4;
+ o5 = i1;
+ o6 = i2;
+ o7 = i3;
+ o8 = i4;
+}
diff --git a/tests/spec/ext_gpu_shader4/compiler/varyings.frag b/tests/spec/ext_gpu_shader4/compiler/varyings.frag
new file mode 100644
index 000000000..c9ce3fd80
--- /dev/null
+++ b/tests/spec/ext_gpu_shader4/compiler/varyings.frag
@@ -0,0 +1,19 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.10
+ * require_extensions: GL_EXT_gpu_shader4
+ * [end config]
+ */
+#extension GL_EXT_gpu_shader4 : require
+
+noperspective varying float temperature;
+flat varying vec3 myColor;
+centroid varying vec2 myTexCoord1;
+noperspective varying vec2 myTexCoord2;
+centroid noperspective varying vec2 myTexCoord3;
+noperspective centroid varying vec2 myTexCoord4;
+
+void main()
+{
+ gl_FragColor = vec4(1.0);
+}
--
2.17.1
More information about the Piglit
mailing list