Mesa (master): glsl: Eliminate ambiguity between function ins/ outs and shader ins/outs

Paul Berry stereotype441 at kemper.freedesktop.org
Fri Jan 25 00:32:26 UTC 2013


Module: Mesa
Branch: master
Commit: 42a29d89fd85c86387f0d119950e243b6de76d79
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=42a29d89fd85c86387f0d119950e243b6de76d79

Author: Paul Berry <stereotype441 at gmail.com>
Date:   Fri Jan 11 14:39:32 2013 -0800

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 at cworth.org>
Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/glsl/ast_function.cpp                          |   15 ++--
 src/glsl/ast_to_hir.cpp                            |   64 +++++++-------
 src/glsl/builtin_variables.cpp                     |   88 ++++++++++----------
 src/glsl/ir.cpp                                    |    4 +-
 src/glsl/ir.h                                      |   10 ++-
 src/glsl/ir_function.cpp                           |    6 +-
 src/glsl/ir_print_visitor.cpp                      |    3 +-
 src/glsl/ir_reader.cpp                             |   10 ++-
 src/glsl/ir_set_program_inouts.cpp                 |    6 +-
 src/glsl/ir_validate.cpp                           |    4 +-
 src/glsl/link_varyings.cpp                         |   28 +++----
 src/glsl/linker.cpp                                |   33 ++++----
 src/glsl/lower_clip_distance.cpp                   |    8 +-
 src/glsl/lower_output_reads.cpp                    |    4 +-
 src/glsl/lower_packed_varyings.cpp                 |    6 +-
 src/glsl/lower_variable_index_to_cond_assign.cpp   |   14 ++-
 src/glsl/opt_constant_folding.cpp                  |    3 +-
 src/glsl/opt_constant_propagation.cpp              |    3 +-
 src/glsl/opt_constant_variable.cpp                 |    4 +-
 src/glsl/opt_copy_propagation.cpp                  |    3 +-
 src/glsl/opt_copy_propagation_elements.cpp         |    3 +-
 src/glsl/opt_dead_code.cpp                         |    7 +-
 src/glsl/opt_function_inlining.cpp                 |    8 +-
 src/glsl/opt_tree_grafting.cpp                     |    8 +-
 src/mesa/drivers/dri/i965/brw_fs_fp.cpp            |    2 +-
 .../drivers/dri/i965/brw_fs_vector_splitting.cpp   |   10 ++-
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp       |    4 +-
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp     |    4 +-
 src/mesa/main/shader_query.cpp                     |   12 ++--
 src/mesa/program/ir_to_mesa.cpp                    |    7 +-
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp         |   17 ++--
 31 files changed, 205 insertions(+), 193 deletions(-)

Diff:   http://cgit.freedesktop.org/mesa/mesa/diff/?id=42a29d89fd85c86387f0d119950e243b6de76d79



More information about the mesa-commit mailing list