[Mesa-dev,26/46] glsl: add "in" or "out" prefix to name when flattening interface blocks

Submitted by Marek Olšák on June 16, 2015, 11:01 p.m.

Details

Message ID 1434495702-27901-26-git-send-email-maraeo@gmail.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Marek Olšák June 16, 2015, 11:01 p.m.
From: Fabian Bieler <fabianbieler@fastmail.fm>

This is to prevent a name conflict in tessellation shaders built-in interface
blocks.
---
 src/glsl/lower_named_interface_blocks.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/glsl/lower_named_interface_blocks.cpp b/src/glsl/lower_named_interface_blocks.cpp
index 2f1e3af..29606f7 100644
--- a/src/glsl/lower_named_interface_blocks.cpp
+++ b/src/glsl/lower_named_interface_blocks.cpp
@@ -125,7 +125,8 @@  flatten_named_interface_blocks_declarations::run(exec_list *instructions)
       for (unsigned i = 0; i < iface_t->length; i++) {
          const char * field_name = iface_t->fields.structure[i].name;
          char *iface_field_name =
-            ralloc_asprintf(mem_ctx, "%s.%s.%s",
+            ralloc_asprintf(mem_ctx, "%s %s.%s.%s",
+                            var->data.mode == ir_var_shader_in ? "in" : "out",
                             iface_t->name, var->name, field_name);
 
          ir_variable *found_var =
@@ -218,7 +219,9 @@  flatten_named_interface_blocks_declarations::handle_rvalue(ir_rvalue **rvalue)
 
    if (var->get_interface_type() != NULL) {
       char *iface_field_name =
-         ralloc_asprintf(mem_ctx, "%s.%s.%s", var->get_interface_type()->name,
+         ralloc_asprintf(mem_ctx, "%s %s.%s.%s",
+                         var->data.mode == ir_var_shader_in ? "in" : "out",
+                         var->get_interface_type()->name,
                          var->name, ir->field);
       /* Find the variable in the set of flattened interface blocks */
       ir_variable *found_var =

Comments

On 17 June 2015 at 09:01, Marek Olšák <maraeo@gmail.com> wrote:
> From: Fabian Bieler <fabianbieler@fastmail.fm>
>
Reviewed-by: Dave Airlie <airlied@redhat.com>
> This is to prevent a name conflict in tessellation shaders built-in interface
> blocks.
> ---
>  src/glsl/lower_named_interface_blocks.cpp | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/glsl/lower_named_interface_blocks.cpp b/src/glsl/lower_named_interface_blocks.cpp
> index 2f1e3af..29606f7 100644
> --- a/src/glsl/lower_named_interface_blocks.cpp
> +++ b/src/glsl/lower_named_interface_blocks.cpp
> @@ -125,7 +125,8 @@ flatten_named_interface_blocks_declarations::run(exec_list *instructions)
>        for (unsigned i = 0; i < iface_t->length; i++) {
>           const char * field_name = iface_t->fields.structure[i].name;
>           char *iface_field_name =
> -            ralloc_asprintf(mem_ctx, "%s.%s.%s",
> +            ralloc_asprintf(mem_ctx, "%s %s.%s.%s",
> +                            var->data.mode == ir_var_shader_in ? "in" : "out",
>                              iface_t->name, var->name, field_name);
>
>           ir_variable *found_var =
> @@ -218,7 +219,9 @@ flatten_named_interface_blocks_declarations::handle_rvalue(ir_rvalue **rvalue)
>
>     if (var->get_interface_type() != NULL) {
>        char *iface_field_name =
> -         ralloc_asprintf(mem_ctx, "%s.%s.%s", var->get_interface_type()->name,
> +         ralloc_asprintf(mem_ctx, "%s %s.%s.%s",
> +                         var->data.mode == ir_var_shader_in ? "in" : "out",
> +                         var->get_interface_type()->name,
>                           var->name, ir->field);
>        /* Find the variable in the set of flattened interface blocks */
>        ir_variable *found_var =
> --
> 2.1.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev