[Mesa-dev] [PATCH] glsl: correctly detect inactive UBO arrays
Timothy Arceri
t_arceri at yahoo.com.au
Tue Sep 22 20:42:25 PDT 2015
On Wed, 2015-09-23 at 13:23 +1000, Timothy Arceri wrote:
> Previously the code was trying to get the packing type from the array
> not the
> interface.
>
> Cc: Ian Romanick <ian.d.romanick at intel.com>
> Cc: Antia Puentes <apuentes at igalia.com>
I meant to add that there is a piglit test here [1] and that this fixes
the second bug mentioned in the bug report [2].
[1]
http://lists.freedesktop.org/archives/piglit/2015-September/017247.html
[2] https://bugs.freedesktop.org/show_bug.cgi?id=83508
> ---
> src/glsl/link_uniform_block_active_visitor.cpp | 6 ++----
> src/glsl/opt_dead_code.cpp | 7 ++-----
> 2 files changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/src/glsl/link_uniform_block_active_visitor.cpp
> b/src/glsl/link_uniform_block_active_visitor.cpp
> index 5102947..72e0782 100644
> --- a/src/glsl/link_uniform_block_active_visitor.cpp
> +++ b/src/glsl/link_uniform_block_active_visitor.cpp
> @@ -77,9 +77,6 @@
> link_uniform_block_active_visitor::visit(ir_variable *var)
> if (!var->is_in_buffer_block())
> return visit_continue;
>
> - const glsl_type *const block_type = var->is_interface_instance()
> - ? var->type : var->get_interface_type();
> -
> /* Section 2.11.6 (Uniform Variables) of the OpenGL ES 3.0.3 spec
> says:
> *
> * "All members of a named uniform block declared with a
> shared or
> @@ -88,7 +85,8 @@
> link_uniform_block_active_visitor::visit(ir_variable *var)
> * also considered active, even if no member of the block is
> * referenced."
> */
> - if (block_type->interface_packing ==
> GLSL_INTERFACE_PACKING_PACKED)
> + if (var->get_interface_type()->interface_packing ==
> + GLSL_INTERFACE_PACKING_PACKED)
> return visit_continue;
>
> /* Process the block. Bail if there was an error.
> diff --git a/src/glsl/opt_dead_code.cpp b/src/glsl/opt_dead_code.cpp
> index e4bf874..2cb7f41 100644
> --- a/src/glsl/opt_dead_code.cpp
> +++ b/src/glsl/opt_dead_code.cpp
> @@ -119,11 +119,8 @@ do_dead_code(exec_list *instructions, bool
> uniform_locations_assigned)
> * layouts, do not eliminate it.
> */
> if (entry->var->is_in_buffer_block()) {
> - const glsl_type *const block_type =
> - entry->var->is_interface_instance()
> - ? entry->var->type : entry->var
> ->get_interface_type();
> -
> - if (block_type->interface_packing !=
> GLSL_INTERFACE_PACKING_PACKED)
> + if (entry->var->get_interface_type()
> ->interface_packing !=
> + GLSL_INTERFACE_PACKING_PACKED)
> continue;
> }
>
More information about the mesa-dev
mailing list