[Mesa-dev] [PATCHES] Tessellation is here

Hi, First, I'd like to thank Fabian Bieler, Chris Forbes, and Ilia Mirkin for their contributions to this. The development of tessellation has reached the point that the only way to make it better and more compliant is to write piglit tests that help find small bugs that are difficult to catch during code review. According to piglit, it's already more compliant than the NVIDIA driver. (The NVIDIA GLSL compiler sometimes even dies with an internal error on some of the variable indexing tests. I haven't tested Catalyst.) Other than piglit, the following apps have been tested: - Unigine Heaven 4.0 (wireframe both on and off) - TessMark 0.3.0 * - GpuTest 0.7.0 containing a newer version of TessMark * - Tutorials 30 and 31 from http://ogldev.atspace.co.uk/ * (* These don't work with the OpenGL Core profile and need overrides and code hacks to enable OpenGL 4.0 Compatibility) The RadeonSI driver support is complete and requires LLVM 3.6.2. There is just one small bug with GpuTest 0.7.0. The patches will be split up into 3 series: 1) Mesa + GLSL 2) State tracker 3) Radeonsi docs/GL3.txt | 2 +- docs/relnotes/10.7.0.html | 1 + src/gallium/docs/source/screen.rst | 4 + src/gallium/drivers/freedreno/freedreno_screen.c | 1 + src/gallium/drivers/i915/i915_screen.c | 1 + src/gallium/drivers/ilo/ilo_screen.c | 1 + src/gallium/drivers/llvmpipe/lp_screen.c | 1 + src/gallium/drivers/nouveau/nv30/nv30_screen.c | 1 + src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 + src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 + src/gallium/drivers/r300/r300_screen.c | 1 + src/gallium/drivers/r600/r600_pipe.c | 1 + src/gallium/drivers/radeon/r600_pipe_common.c | 6 + src/gallium/drivers/radeon/r600_pipe_common.h | 20 +- src/gallium/drivers/radeon/radeon_llvm.h | 14 +- src/gallium/drivers/radeon/radeon_llvm_emit.c | 2 + .../drivers/radeon/radeon_setup_tgsi_llvm.c | 40 +- src/gallium/drivers/radeonsi/si_blit.c | 2 + src/gallium/drivers/radeonsi/si_descriptors.c | 251 ++++-- src/gallium/drivers/radeonsi/si_hw_context.c | 8 + src/gallium/drivers/radeonsi/si_pipe.c | 22 +- src/gallium/drivers/radeonsi/si_pipe.h | 29 +- src/gallium/drivers/radeonsi/si_shader.c | 835 ++++++++++++++++++-- src/gallium/drivers/radeonsi/si_shader.h | 123 ++- src/gallium/drivers/radeonsi/si_state.c | 47 +- src/gallium/drivers/radeonsi/si_state.h | 23 +- src/gallium/drivers/radeonsi/si_state_draw.c | 217 ++++- src/gallium/drivers/radeonsi/si_state_shaders.c | 494 +++++++++++- src/gallium/drivers/softpipe/sp_screen.c | 1 + src/gallium/drivers/svga/svga_screen.c | 1 + src/gallium/drivers/vc4/vc4_screen.c | 1 + src/gallium/include/pipe/p_defines.h | 1 + src/glsl/Makefile.sources | 1 + src/glsl/ast.h | 55 +- src/glsl/ast_array_index.cpp | 47 +- src/glsl/ast_to_hir.cpp | 350 +++++++- src/glsl/ast_type.cpp | 115 ++- src/glsl/builtin_functions.cpp | 4 +- src/glsl/builtin_variables.cpp | 112 ++- src/glsl/glcpp/glcpp-parse.y | 3 + src/glsl/glsl_lexer.ll | 5 +- src/glsl/glsl_parser.yy | 133 +++- src/glsl/glsl_parser_extras.cpp | 60 +- src/glsl/glsl_parser_extras.h | 48 +- src/glsl/glsl_types.cpp | 5 + src/glsl/glsl_types.h | 6 + src/glsl/ir.cpp | 2 + src/glsl/ir.h | 1 + src/glsl/ir_optimization.h | 8 +- src/glsl/ir_print_visitor.cpp | 5 +- src/glsl/ir_reader.cpp | 2 + src/glsl/ir_set_program_inouts.cpp | 96 ++- src/glsl/link_interface_blocks.cpp | 11 +- src/glsl/link_varyings.cpp | 183 ++++- src/glsl/link_varyings.h | 16 +- src/glsl/linker.cpp | 415 +++++++++- src/glsl/lower_clip_distance.cpp | 185 +++-- src/glsl/lower_named_interface_blocks.cpp | 8 +- src/glsl/lower_output_reads.cpp | 13 +- src/glsl/lower_packed_varyings.cpp | 1 + src/glsl/lower_tess_level.cpp | 462 +++++++++++ src/glsl/lower_variable_index_to_cond_assign.cpp | 43 +- src/glsl/main.cpp | 8 +- src/glsl/shader_enums.h | 21 +- src/glsl/standalone_scaffolding.cpp | 1 + src/glsl/standalone_scaffolding.h | 4 + src/glsl/test_optpass.cpp | 3 +- src/mapi/glapi/gen/ARB_tessellation_shader.xml | 62 ++ src/mapi/glapi/gen/gl_API.xml | 6 +- src/mapi/glapi/gen/gl_enums.py | 1 + src/mesa/Makefile.sources | 1 + src/mesa/drivers/common/meta.c | 2 + src/mesa/drivers/dri/common/drirc | 23 +- src/mesa/drivers/dri/i965/brw_context.c | 1 + src/mesa/drivers/dri/i965/brw_shader.cpp | 10 +- src/mesa/drivers/dri/i965/intel_debug.c | 4 +- src/mesa/main/api_validate.c | 86 +- src/mesa/main/config.h | 8 + src/mesa/main/context.c | 12 + src/mesa/main/context.h | 11 + src/mesa/main/get.c | 1 + src/mesa/main/get_hash_params.py | 28 + src/mesa/main/mtypes.h | 141 +++- src/mesa/main/pipelineobj.c | 32 +- src/mesa/main/queryobj.c | 2 +- src/mesa/main/shader_query.cpp | 18 +- src/mesa/main/shaderapi.c | 182 ++++- src/mesa/main/shaderapi.h | 8 + src/mesa/main/shaderobj.h | 4 + src/mesa/main/state.c | 54 +- src/mesa/main/tests/dispatch_sanity.cpp | 2 + src/mesa/main/uniforms.c | 21 +- src/mesa/program/ir_to_mesa.cpp | 2 +- src/mesa/program/prog_print.c | 10 + src/mesa/program/program.c | 59 ++ src/mesa/program/program.h | 80 +- src/mesa/state_tracker/st_atom.c | 9 + src/mesa/state_tracker/st_atom.h | 9 + src/mesa/state_tracker/st_atom_constbuf.c | 88 ++- src/mesa/state_tracker/st_atom_sampler.c | 16 + src/mesa/state_tracker/st_atom_shader.c | 72 ++ src/mesa/state_tracker/st_atom_tess.c | 59 ++ src/mesa/state_tracker/st_atom_texture.c | 52 ++ src/mesa/state_tracker/st_cb_program.c | 58 ++ src/mesa/state_tracker/st_context.c | 3 + src/mesa/state_tracker/st_context.h | 8 +- src/mesa/state_tracker/st_draw.c | 2 + src/mesa/state_tracker/st_extensions.c | 21 + src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 159 +++- src/mesa/state_tracker/st_program.c | 495 ++++++++++-- src/mesa/state_tracker/st_program.h | 122 ++- 111 files changed, 5956 insertions(+), 673 deletions(-) create mode 100644 src/glsl/lower_tess_level.cpp create mode 100644 src/mapi/glapi/gen/ARB_tessellation_shader.xml create mode 100644 src/mesa/state_tracker/st_atom_tess.c Marek