glsl: Eliminate ambiguity between function ins/outs and shader ins/outs
authorPaul Berry <stereotype441@gmail.com>
Fri, 11 Jan 2013 22:39:32 +0000 (14:39 -0800)
committerPaul Berry <stereotype441@gmail.com>
Fri, 25 Jan 2013 00:30:30 +0000 (16:30 -0800)
commit42a29d89fd85c86387f0d119950e243b6de76d79
tree9eee8f2d609855dc9c6813aac84f5fdcd6786a54
parent7d51ead56e2b97d313c6a0fda22cc930b5c41e9d
glsl: Eliminate ambiguity between function ins/outs and shader ins/outs

This patch replaces the three ir_variable_mode enums:

- ir_var_in
- ir_var_out
- ir_var_inout

with the following five:

- ir_var_shader_in
- ir_var_shader_out
- ir_var_function_in
- ir_var_function_out
- ir_var_function_inout

This eliminates a frustrating ambiguity: it used to be impossible to
tell whether an ir_var_{in,out} variable was a shader in/out or a
function in/out without seeing where the variable was declared in the
IR.  This complicated some optimization and lowering passes, and would
have become a problem for implementing varying structs.

In the lisp-style serialization of GLSL IR to strings performed by
ir_print_visitor.cpp and ir_reader.cpp, I've retained the names "in",
"out", and "inout" for function parameters, to avoid introducing code
churn to the src/glsl/builtins/ir/ directory.

Note: a couple of comments in the code seemed to indicate that we were
planning for a possible future in which geometry shaders could have
shader-scope inout variables.  Our GLSL grammar rejects shader-scope
inout variables, and I've been unable to find any evidence in the GLSL
standards documents (or extensions) that this will ever be allowed, so
I've eliminated these comments.

Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
31 files changed:
src/glsl/ast_function.cpp
src/glsl/ast_to_hir.cpp
src/glsl/builtin_variables.cpp
src/glsl/ir.cpp
src/glsl/ir.h
src/glsl/ir_function.cpp
src/glsl/ir_print_visitor.cpp
src/glsl/ir_reader.cpp
src/glsl/ir_set_program_inouts.cpp
src/glsl/ir_validate.cpp
src/glsl/link_varyings.cpp
src/glsl/linker.cpp
src/glsl/lower_clip_distance.cpp
src/glsl/lower_output_reads.cpp
src/glsl/lower_packed_varyings.cpp
src/glsl/lower_variable_index_to_cond_assign.cpp
src/glsl/opt_constant_folding.cpp
src/glsl/opt_constant_propagation.cpp
src/glsl/opt_constant_variable.cpp
src/glsl/opt_copy_propagation.cpp
src/glsl/opt_copy_propagation_elements.cpp
src/glsl/opt_dead_code.cpp
src/glsl/opt_function_inlining.cpp
src/glsl/opt_tree_grafting.cpp
src/mesa/drivers/dri/i965/brw_fs_fp.cpp
src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
src/mesa/main/shader_query.cpp
src/mesa/program/ir_to_mesa.cpp
src/mesa/state_tracker/st_glsl_to_tgsi.cpp