[Mesa-dev] [PATCH 00/56] Die copy-and-paste code, die
idr at freedesktop.org
Tue Jul 19 19:24:19 UTC 2016
After seeing Dave's series to add support GL_ARB_shader_gpu_int64 and
thinking about adding support for 8- and 16-bit integers, I decided
that something had to be done about the cut-and-paste madness that is
ir_constant_expression.cpp. I decided to take a page from Jason's book
and generate it from a machine description of the expressions. The
result is this series.
You may notice from some of the earlier patches in this series that I
started this work over a year ago. The previous work was an attempt to
generate opt_algebraic.cpp which was ultimately abandonded. It may be
worth picking that up again.
I haven't done *anything* for SCons, so hopefully Jose or someone can
help out there.
All of this is available at:
Other possible follow-up work:
- A few expressions don't have constant evaluation support. I don't
think I've seen a real shader use any of these, so there's a reason
we haven't "missed" them.
- Generate validation code for expressions. A few times while
developing this series I had questions about what the IR actually
supported. In quite a few cases the IR support is different from
what GLSL supports. I would often look to ir_validate.cpp to answer
these questions, and I was almost always disappointed. I would
really like to see missing type information added to
ir_expression_operation.py and generate a much more complete set of
validations for ir_expression. Then the assertions remaining in
ir_expression_operation_constant.h could be removed.
- Generate ir_expression constructors.
- Generate ir_builder. We don't support every possible expression in
ir_builder, so this may not be worth the effort.
src/compiler/Android.glsl.gen.mk | 2 +-
src/compiler/Makefile.glsl.am | 24 +-
src/compiler/Makefile.sources | 8 +-
src/compiler/glsl/.gitignore | 2 +
src/compiler/glsl/ir.cpp | 133 +-
src/compiler/glsl/ir.h | 329 +----
src/compiler/glsl/ir_constant_expression.cpp | 1332 ++----------------
src/compiler/glsl/ir_expression_operation.py | 738 ++++++++++
src/compiler/glsl/ir_print_visitor.cpp | 2 +-
src/compiler/glsl/ir_validate.cpp | 11 +
src/compiler/glsl/lower_mat_op_to_vec.cpp | 2 +-
src/mesa/Makefile.sources | 1 +
src/mesa/drivers/dri/i965/Makefile.am | 1 +
13 files changed, 901 insertions(+), 1684 deletions(-)
More information about the mesa-dev