[Mesa-dev] [PATCH 00/32] UBOs for OpenGL ES 3.0

Ian Romanick idr at freedesktop.org
Wed Jan 23 22:28:51 PST 2013


On 01/22/2013 03:51 AM, Ian Romanick wrote:
> So here it is.

I've just pushed a re-spin of this patch series to the gles3 branch.  I 
have incorporated all of the review comments received so far *except* 
Paul's question on patch 10, and his NULL initialization suggestion on 
patch 12.

> This is the last of the UBO instance and array instance rework for the
> linker.  It's a giant pile of patches, so let me explain what's going
> on.
>
> Previous to this patch series, information about the layout of a UBO was
> created at compile-time during ast-to-ir translation.  This made it
> somewhere between difficult and impossible to implement several require
> features for OpenGL ES 3.0 conformance.
>
> 1. Uniform blocks with an instance name.  These blocks have different
> scoping rules, and the fields are exposed to applications differently
> through the GL API.  In the shader, these are accessed like structures.
>
> 2. Arrays of uniform blocks.  These basically compound the issues of
> instance names.  For example, to query the layout of an instance array
> block, you do *not* use the array index.
>
> 3. Marking unused block members and unused blocks as not active.  This
> was actually way more annoying to deal than I had expected.  Even with
> the std140 layout, if a block member is never used in a shader, it
> should not show up in the active list.
>
> All of these issues led me to a design that does all of the layout
> during linking.  This allows our usual dead variable elimination and a
> bunch of other nice things.
>
> To do this, I added a new type called GLSL_TYPE_INTERFACE.  Interfaces
> work mostly like structures, but they have additional semantic
> limitations (imposed by the language).  Once that was in place in the
> compiler front-end, the linker just needed to detect unused blocks and
> block members, cross-validate the blocks, and assign the offsets.
>
> The bulk of the added code is in link_uniform_blocks.  This is the real
> work-horse of the whole deal.  The functions that do all the
> intra-shader layouts and name assignments for the blocks live here.
>
> Other than the few cases mentioned in individual commit messages, there
> are no commit-to-commit piglit or gles3conform regressions.  I don't
> believe there are any commit-to-commit build failures, but I'll double
> check that before I push.
>
> With this series, i965 passes all of the gles3conform UBO tests on IVB.
> I believe there is still one issue on SNB, but I haven't tested it.
>
>   src/glsl/Makefile.sources                      |   2 +
>   src/glsl/ast.h                                 |  12 ++-
>   src/glsl/ast_to_hir.cpp                        | 248 +++++++++++++++++++++++++++++++-------------------
>   src/glsl/builtin_types.h                       |  74 +++++++--------
>   src/glsl/glsl_parser.yy                        |  82 ++++++++++++-----
>   src/glsl/glsl_symbol_table.cpp                 |  14 +--
>   src/glsl/glsl_symbol_table.h                   |   1 -
>   src/glsl/glsl_types.cpp                        |  94 +++++++++++++++----
>   src/glsl/glsl_types.h                          |  43 ++++++++-
>   src/glsl/hir_field_selection.cpp               |   3 +-
>   src/glsl/ir.cpp                                |   1 -
>   src/glsl/ir.h                                  |  33 ++++---
>   src/glsl/ir_clone.cpp                          |  12 ++-
>   src/glsl/link_uniform_block_active_visitor.cpp | 162 +++++++++++++++++++++++++++++++++
>   src/glsl/link_uniform_block_active_visitor.h   |  62 ++++++++++++<+
>   src/glsl/link_uniform_blocks.cpp               | 313 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>   src/glsl/link_uniform_initializers.cpp         |   6 +-
>   src/glsl/link_uniforms.cpp                     | 250 +++++++++++++++++++++++++++++++++++----------------
>   src/glsl/linker.cpp                            |  25 ++----
>   src/glsl/linker.h                              |  45 +++++++++-
>   src/glsl/lower_ubo_reference.cpp               | 104 ++++++++++++++++++---
>   src/glsl/opt_dead_code.cpp                     |   7 +-
>   src/glsl/tests/uniform_initializer_utils.cpp   |   3 +
>   src/mesa/drivers/dri/i965/brw_fs.cpp           |   8 +-
>   src/mesa/drivers/dri/i965/brw_fs_visitor.cpp   |   6 +-
>   src/mesa/drivers/dri/i965/brw_shader.cpp       |   8 +-
>   src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |  10 ++-
>   src/mesa/main/mtypes.h                         |  27 ++++++
>   src/mesa/main/uniforms.c                       |   2 +-
>   src/mesa/program/ir_to_mesa.cpp                |  26 ++++--
>   src/mesa/state_tracker/st_glsl_to_tgsi.cpp     |   8 +-
>   31 files changed, 1355 insertions(+), 336 deletions(-)
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>



More information about the mesa-dev mailing list