This allows extensions to specify which stages they support, allowing such extensions as ARB_shader_viewport_layer_array to be added.
Signed-off-by: Dylan Baker <[email protected]> --- generated_tests/gen_extensions_defined.py | 176 ++++++++++++++++-------------- 1 file changed, 94 insertions(+), 82 deletions(-) diff --git a/generated_tests/gen_extensions_defined.py b/generated_tests/gen_extensions_defined.py index d42e6ad..aee2af6 100644 --- a/generated_tests/gen_extensions_defined.py +++ b/generated_tests/gen_extensions_defined.py @@ -52,83 +52,93 @@ ENABLED_TEMPLATE = _TEMPLATES.get_template('enabled.glsl.mako') DISABLED_TEMPLATE = _TEMPLATES.get_template('disabled.glsl.mako') UNDEFINED_TEMPLATE = _TEMPLATES.get_template('undefined-require.glsl.mako') + +class Ext(object): + """Represents an OpenGL (ES) extension.""" + + def __init__(self, name, version, stages=None): + self.name = name + self.version = glsl.Version(version) + self.stages = stages or ['vert', 'frag', 'geom', 'tesc', 'tese', 'comp'] + + # A list of tuples with the full preprocess defined name, and the minimum -# supported version of that extension. +# supported version of that extension, optionally it may contain a list of +# stages supported. EXTENSIONS = [ - ("GL_ARB_draw_instanced", "110"), - ("GL_ARB_draw_buffers", "110"), - ("GL_ARB_enhanced_layouts", "140"), - ("GL_ARB_separate_shader_objects", "110"), - ("GL_ARB_texture_rectangle", "110"), - ("GL_AMD_shader_trinary_minmax", "110"), - ("GL_EXT_texture_array", "110"), - ("GL_ARB_ES3_1_compatibility", "430"), - ("GL_ARB_arrays_of_arrays", "110"), - ("GL_ARB_fragment_coord_conventions", "110"), - ("GL_ARB_fragment_layer_viewport", "150"), - ("GL_ARB_explicit_attrib_location", "110"), - ("GL_ARB_explicit_uniform_location", "110"), - ("GL_ARB_shader_texture_lod", "110"), - ("GL_AMD_conservative_depth", "110"), - ("GL_ARB_conservative_depth", "110"), - ("GL_ARB_shader_bit_encoding", "110"), - ("GL_ARB_shader_clock", "110"), - ("GL_ARB_uniform_buffer_object", "110"), - ("GL_ARB_texture_cube_map_array", "110"), - ("GL_ARB_shading_language_packing", "110"), - ("GL_ARB_texture_multisample", "110"), - ("GL_ARB_texture_query_levels", "110"), - ("GL_ARB_texture_query_lod", "110"), - ("GL_ARB_gpu_shader5", "150"), - ("GL_ARB_gpu_shader_fp64", "150"), - ("GL_ARB_vertex_attrib_64bit", "150"), - ("GL_AMD_vertex_shader_layer", "130"), - ("GL_AMD_vertex_shader_viewport_index", "110"), - ("GL_ARB_shading_language_420pack", "110"), - ("GL_ARB_sample_shading", "110"), - ("GL_ARB_texture_gather", "110"), - ("GL_ARB_shader_atomic_counters", "110"), - ("GL_ARB_shader_atomic_counter_ops", "140"), - ("GL_ARB_viewport_array", "110"), - ("GL_ARB_compute_shader", "110"), - ("GL_ARB_shader_image_load_store", "130"), - ("GL_ARB_shader_image_size", "110"), - ("GL_ARB_shader_texture_image_samples", "110"), + Ext("GL_ARB_draw_instanced", "110"), + Ext("GL_ARB_draw_buffers", "110"), + Ext("GL_ARB_enhanced_layouts", "140"), + Ext("GL_ARB_separate_shader_objects", "110"), + Ext("GL_ARB_texture_rectangle", "110"), + Ext("GL_AMD_shader_trinary_minmax", "110"), + Ext("GL_EXT_texture_array", "110"), + Ext("GL_ARB_ES3_1_compatibility", "430"), + Ext("GL_ARB_arrays_of_arrays", "110"), + Ext("GL_ARB_fragment_coord_conventions", "110"), + Ext("GL_ARB_fragment_layer_viewport", "150"), + Ext("GL_ARB_explicit_attrib_location", "110"), + Ext("GL_ARB_explicit_uniform_location", "110"), + Ext("GL_ARB_shader_texture_lod", "110"), + Ext("GL_AMD_conservative_depth", "110"), + Ext("GL_ARB_conservative_depth", "110"), + Ext("GL_ARB_shader_bit_encoding", "110"), + Ext("GL_ARB_shader_clock", "110"), + Ext("GL_ARB_uniform_buffer_object", "110"), + Ext("GL_ARB_texture_cube_map_array", "110"), + Ext("GL_ARB_shading_language_packing", "110"), + Ext("GL_ARB_texture_multisample", "110"), + Ext("GL_ARB_texture_query_levels", "110"), + Ext("GL_ARB_texture_query_lod", "110"), + Ext("GL_ARB_gpu_shader5", "150"), + Ext("GL_ARB_gpu_shader_fp64", "150"), + Ext("GL_ARB_vertex_attrib_64bit", "150"), + Ext("GL_AMD_vertex_shader_layer", "130"), + Ext("GL_AMD_vertex_shader_viewport_index", "110"), + Ext("GL_ARB_shading_language_420pack", "110"), + Ext("GL_ARB_sample_shading", "110"), + Ext("GL_ARB_texture_gather", "110"), + Ext("GL_ARB_shader_atomic_counters", "110"), + Ext("GL_ARB_shader_atomic_counter_ops", "140"), + Ext("GL_ARB_viewport_array", "110"), + Ext("GL_ARB_compute_shader", "110"), + Ext("GL_ARB_shader_image_load_store", "130"), + Ext("GL_ARB_shader_image_size", "110"), + Ext("GL_ARB_shader_texture_image_samples", "110"), # That is what the original hand written test required. - ("GL_ARB_derivative_control", "150"), - ("GL_ARB_shader_precision", "110"), - ("GL_ARB_shader_storage_buffer_object", "110"), - ("GL_ARB_tessellation_shader", "150"), - ("GL_ARB_shader_subroutine", "150"), - ("GL_ARB_shader_draw_parameters", "140"), - ("GL_EXT_separate_shader_objects", "100"), - ("GL_EXT_draw_buffers", "100"), - ("GL_AMD_shader_stencil_export", "120"), - ("GL_ARB_shader_stencil_export", "120"), - ("GL_ARB_geometry_shader4", "110"), - ("GL_OES_EGL_image_external", "100"), - ("GL_EXT_shader_samples_identical", "110"), - ("GL_ARB_shader_group_vote", "110"), - ("GL_EXT_shader_samples_identical", "310 es"), - ("GL_OES_sample_variables", "300 es"), - ("GL_OES_multisample_interpolation", "300 es"), - ("GL_OES_standard_derivatives", "100"), - ("GL_OES_texture_storage_multisample_2d_array", "310 es"), - ("GL_OES_blend_func_extended", "100"), - ("GL_OES_shader_image_atomic", "310 es"), - ("GL_OES_shader_io_blocks", "310 es"), - ("GL_EXT_shader_io_blocks", "310 es"), - ("GL_OES_geometry_shader", "310 es"), - ("GL_EXT_geometry_shader", "310 es"), - ("GL_OES_geometry_point_size", "310 es"), - ("GL_EXT_geometry_point_size", "310 es"), - ("GL_EXT_gpu_shader5", "310 es"), - ("GL_OES_gpu_shader5", "310 es"), - ("GL_EXT_texture_buffer", "310 es"), - ("GL_OES_texture_buffer", "310 es"), - ("GL_EXT_clip_cull_distance", "300 es"), + Ext("GL_ARB_derivative_control", "150"), + Ext("GL_ARB_shader_precision", "110"), + Ext("GL_ARB_shader_storage_buffer_object", "110"), + Ext("GL_ARB_tessellation_shader", "150"), + Ext("GL_ARB_shader_subroutine", "150"), + Ext("GL_ARB_shader_draw_parameters", "140"), + Ext("GL_EXT_separate_shader_objects", "100"), + Ext("GL_EXT_draw_buffers", "100"), + Ext("GL_AMD_shader_stencil_export", "120"), + Ext("GL_ARB_shader_stencil_export", "120"), + Ext("GL_ARB_geometry_shader4", "110"), + Ext("GL_OES_EGL_image_external", "100"), + Ext("GL_EXT_shader_samples_identical", "110"), + Ext("GL_ARB_shader_group_vote", "110"), + Ext("GL_EXT_shader_samples_identical", "310 es"), + Ext("GL_OES_sample_variables", "300 es"), + Ext("GL_OES_multisample_interpolation", "300 es"), + Ext("GL_OES_standard_derivatives", "100"), + Ext("GL_OES_texture_storage_multisample_2d_array", "310 es"), + Ext("GL_OES_blend_func_extended", "100"), + Ext("GL_OES_shader_image_atomic", "310 es"), + Ext("GL_OES_shader_io_blocks", "310 es"), + Ext("GL_EXT_shader_io_blocks", "310 es"), + Ext("GL_OES_geometry_shader", "310 es"), + Ext("GL_EXT_geometry_shader", "310 es"), + Ext("GL_OES_geometry_point_size", "310 es"), + Ext("GL_EXT_geometry_point_size", "310 es"), + Ext("GL_EXT_gpu_shader5", "310 es"), + Ext("GL_OES_gpu_shader5", "310 es"), + Ext("GL_EXT_texture_buffer", "310 es"), + Ext("GL_OES_texture_buffer", "310 es"), + Ext("GL_EXT_clip_cull_distance", "300 es"), ] -EXTENSIONS = [(n, glsl.Version(v)) for n, v in EXTENSIONS] def _gen_tests(ext, version, stage, path, extra_name, extra_extensions): @@ -162,17 +172,18 @@ def _gen_tests(ext, version, stage, path, extra_name, extra_extensions): def main(): """Main function.""" - for ext, ver in EXTENSIONS: + for ext in EXTENSIONS: # Lower ext in the path name, but keep it capitalized for the generated # tests - path = os.path.join('spec', ext[3:].lower(), 'preprocessor') + path = os.path.join('spec', ext.name[3:].lower(), 'preprocessor') utils.safe_makedirs(path) - for stage in ['vert', 'frag', 'geom', 'tesc', 'tese', 'comp']: + for stage in ext.stages: # Calculate the minimum version for the stage, with extensions. # This makes the maximum number of tests run on the widest swath of # hardware. - version, extra_ext = glsl.MinVersion.for_stage_with_ext(stage, ver) + version, extra_ext = glsl.MinVersion.for_stage_with_ext( + stage, ext.version) if extra_ext is not None: extra_extensions = [extra_ext] else: @@ -182,15 +193,16 @@ def main(): # if the actual version is less than 140 make a compat test and # a core test, otherwise just make a core test if version < 140: - _gen_tests(ext, version, stage, path, 'compat', - extra_extensions) - _gen_tests(ext, glsl.Version('140'), stage, path, 'core', + _gen_tests(ext.name, version, stage, path, 'compat', extra_extensions) + _gen_tests(ext.name, glsl.Version('140'), stage, path, + 'core', extra_extensions) else: - _gen_tests(ext, version, stage, path, 'core', + _gen_tests(ext.name, version, stage, path, 'core', extra_extensions) else: - _gen_tests(ext, version, stage, path, 'es', extra_extensions) + _gen_tests(ext.name, version, stage, path, 'es', + extra_extensions) if __name__ == '__main__': -- 2.9.3 _______________________________________________ Piglit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/piglit
