Re: [Mesa-dev] [PATCH] glsl/linker: Link all out vars from a shader objects on a single stage
On 30/08/18 08:16, Andres Gomez wrote: Vadym, should we also include this in the stable queues ? Yes. It should be fine to add this to stable. Thanks. On Mon, 2018-08-27 at 15:20 +0300, Vadym Shovkoplias wrote: From: "vadym.shovkoplias" During intra stage linking some out variables can be dropped because it is not used in a shader with the main function. But these out vars can be referenced on later stages which can lead to further linking errors. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105731 Signed-off-by: Vadym Shovkoplias --- src/compiler/glsl/linker.cpp | 38 1 file changed, 38 insertions(+) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 3ce78fe642..3b0c01c316 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -2187,6 +2187,41 @@ link_cs_input_layout_qualifiers(struct gl_shader_program *prog, } } +/** + * Link all out variables on a single stage which are not + * directly used in a shader with the main function. + */ +static void +link_output_variables(struct gl_linked_shader *linked_shader, + struct gl_shader **shader_list, + unsigned num_shaders) +{ + struct glsl_symbol_table *symbols = linked_shader->symbols; + + for (unsigned i = 0; i < num_shaders; i++) { + + /* Skip shader object with main function */ + if (shader_list[i]->symbols->get_function("main")) + continue; + + foreach_in_list (ir_instruction, ir, shader_list[i]->ir) { + + if (ir->ir_type != ir_type_variable) +continue; + + ir_variable *const var = (ir_variable *) ir; + + if (var->data.mode == ir_var_shader_out && + !symbols->get_variable(var->name)) { +symbols->add_variable(var); +linked_shader->ir->push_head(var); + } + } + } + + return; +} + /** * Combine a group of shaders for a single stage to generate a linked shader @@ -2352,6 +2387,9 @@ link_intrastage_shaders(void *mem_ctx, return NULL; } + if (linked->Stage != MESA_SHADER_FRAGMENT) + link_output_variables(linked, shader_list, num_shaders); + /* Make a pass over all variable declarations to ensure that arrays with * unspecified sizes have a size specified. The size is inferred from the * max_array_access field. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl/linker: Link all out vars from a shader objects on a single stage
Vadym, should we also include this in the stable queues ? On Mon, 2018-08-27 at 15:20 +0300, Vadym Shovkoplias wrote: > From: "vadym.shovkoplias" > > During intra stage linking some out variables can be dropped because > it is not used in a shader with the main function. But these out vars > can be referenced on later stages which can lead to further linking > errors. > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105731 > Signed-off-by: Vadym Shovkoplias > --- > src/compiler/glsl/linker.cpp | 38 > 1 file changed, 38 insertions(+) > > diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp > index 3ce78fe642..3b0c01c316 100644 > --- a/src/compiler/glsl/linker.cpp > +++ b/src/compiler/glsl/linker.cpp > @@ -2187,6 +2187,41 @@ link_cs_input_layout_qualifiers(struct > gl_shader_program *prog, > } > } > > +/** > + * Link all out variables on a single stage which are not > + * directly used in a shader with the main function. > + */ > +static void > +link_output_variables(struct gl_linked_shader *linked_shader, > + struct gl_shader **shader_list, > + unsigned num_shaders) > +{ > + struct glsl_symbol_table *symbols = linked_shader->symbols; > + > + for (unsigned i = 0; i < num_shaders; i++) { > + > + /* Skip shader object with main function */ > + if (shader_list[i]->symbols->get_function("main")) > + continue; > + > + foreach_in_list (ir_instruction, ir, shader_list[i]->ir) { > + > + if (ir->ir_type != ir_type_variable) > +continue; > + > + ir_variable *const var = (ir_variable *) ir; > + > + if (var->data.mode == ir_var_shader_out && > + !symbols->get_variable(var->name)) { > +symbols->add_variable(var); > +linked_shader->ir->push_head(var); > + } > + } > + } > + > + return; > +} > + > > /** > * Combine a group of shaders for a single stage to generate a linked shader > @@ -2352,6 +2387,9 @@ link_intrastage_shaders(void *mem_ctx, >return NULL; > } > > + if (linked->Stage != MESA_SHADER_FRAGMENT) > + link_output_variables(linked, shader_list, num_shaders); > + > /* Make a pass over all variable declarations to ensure that arrays with > * unspecified sizes have a size specified. The size is inferred from the > * max_array_access field. -- Br, Andres ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl/linker: Link all out vars from a shader objects on a single stage
On 28/08/18 17:34, Vadim Shovkoplias wrote: Hi Timothy, Thanks for the review! Space was removed. Can you please push this patch since I haven't got write permissions ? For some reason the space was still there but I removed it and pushed. Thanks for the patch. Regards, Vadym вт, 28 авг. 2018 г. в 10:32, Vadym Shovkoplias mailto:vadim.shovkopl...@gmail.com>>: From: "vadym.shovkoplias" mailto:vadym.shovkopl...@globallogic.com>> During intra stage linking some out variables can be dropped because it is not used in a shader with the main function. But these out vars can be referenced on later stages which can lead to further linking errors. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105731 Signed-off-by: Vadym Shovkoplias mailto:vadym.shovkopl...@globallogic.com>> --- src/compiler/glsl/linker.cpp | 37 1 file changed, 37 insertions(+) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 3ce78fe642..dbd76b7fcc 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -2187,6 +2187,40 @@ link_cs_input_layout_qualifiers(struct gl_shader_program *prog, } } +/** + * Link all out variables on a single stage which are not + * directly used in a shader with the main function. + */ +static void +link_output_variables(struct gl_linked_shader *linked_shader, + struct gl_shader **shader_list, + unsigned num_shaders) +{ + struct glsl_symbol_table *symbols = linked_shader->symbols; + + for (unsigned i = 0; i < num_shaders; i++) { + + /* Skip shader object with main function */ + if (shader_list[i]->symbols->get_function("main")) + continue; + + foreach_in_list (ir_instruction, ir, shader_list[i]->ir) { + if (ir->ir_type != ir_type_variable) + continue; + + ir_variable *const var = (ir_variable *) ir; + + if (var->data.mode == ir_var_shader_out && + !symbols->get_variable(var->name)) { + symbols->add_variable(var); + linked_shader->ir->push_head(var); + } + } + } + + return; +} + /** * Combine a group of shaders for a single stage to generate a linked shader @@ -2352,6 +2386,9 @@ link_intrastage_shaders(void *mem_ctx, return NULL; } + if (linked->Stage != MESA_SHADER_FRAGMENT) + link_output_variables(linked, shader_list, num_shaders); + /* Make a pass over all variable declarations to ensure that arrays with * unspecified sizes have a size specified. The size is inferred from the * max_array_access field. -- 2.18.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl/linker: Link all out vars from a shader objects on a single stage
Hi Timothy, Thanks for the review! Space was removed. Can you please push this patch since I haven't got write permissions ? Regards, Vadym вт, 28 авг. 2018 г. в 10:32, Vadym Shovkoplias : > From: "vadym.shovkoplias" > > During intra stage linking some out variables can be dropped because > it is not used in a shader with the main function. But these out vars > can be referenced on later stages which can lead to further linking > errors. > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105731 > Signed-off-by: Vadym Shovkoplias > --- > src/compiler/glsl/linker.cpp | 37 > 1 file changed, 37 insertions(+) > > diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp > index 3ce78fe642..dbd76b7fcc 100644 > --- a/src/compiler/glsl/linker.cpp > +++ b/src/compiler/glsl/linker.cpp > @@ -2187,6 +2187,40 @@ link_cs_input_layout_qualifiers(struct > gl_shader_program *prog, > } > } > > +/** > + * Link all out variables on a single stage which are not > + * directly used in a shader with the main function. > + */ > +static void > +link_output_variables(struct gl_linked_shader *linked_shader, > + struct gl_shader **shader_list, > + unsigned num_shaders) > +{ > + struct glsl_symbol_table *symbols = linked_shader->symbols; > + > + for (unsigned i = 0; i < num_shaders; i++) { > + > + /* Skip shader object with main function */ > + if (shader_list[i]->symbols->get_function("main")) > + continue; > + > + foreach_in_list (ir_instruction, ir, shader_list[i]->ir) { > + if (ir->ir_type != ir_type_variable) > +continue; > + > + ir_variable *const var = (ir_variable *) ir; > + > + if (var->data.mode == ir_var_shader_out && > + !symbols->get_variable(var->name)) { > +symbols->add_variable(var); > +linked_shader->ir->push_head(var); > + } > + } > + } > + > + return; > +} > + > > /** > * Combine a group of shaders for a single stage to generate a linked > shader > @@ -2352,6 +2386,9 @@ link_intrastage_shaders(void *mem_ctx, >return NULL; > } > > + if (linked->Stage != MESA_SHADER_FRAGMENT) > + link_output_variables(linked, shader_list, num_shaders); > + > /* Make a pass over all variable declarations to ensure that arrays > with > * unspecified sizes have a size specified. The size is inferred from > the > * max_array_access field. > -- > 2.18.0 > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glsl/linker: Link all out vars from a shader objects on a single stage
From: "vadym.shovkoplias" During intra stage linking some out variables can be dropped because it is not used in a shader with the main function. But these out vars can be referenced on later stages which can lead to further linking errors. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105731 Signed-off-by: Vadym Shovkoplias --- src/compiler/glsl/linker.cpp | 37 1 file changed, 37 insertions(+) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 3ce78fe642..dbd76b7fcc 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -2187,6 +2187,40 @@ link_cs_input_layout_qualifiers(struct gl_shader_program *prog, } } +/** + * Link all out variables on a single stage which are not + * directly used in a shader with the main function. + */ +static void +link_output_variables(struct gl_linked_shader *linked_shader, + struct gl_shader **shader_list, + unsigned num_shaders) +{ + struct glsl_symbol_table *symbols = linked_shader->symbols; + + for (unsigned i = 0; i < num_shaders; i++) { + + /* Skip shader object with main function */ + if (shader_list[i]->symbols->get_function("main")) + continue; + + foreach_in_list (ir_instruction, ir, shader_list[i]->ir) { + if (ir->ir_type != ir_type_variable) +continue; + + ir_variable *const var = (ir_variable *) ir; + + if (var->data.mode == ir_var_shader_out && + !symbols->get_variable(var->name)) { +symbols->add_variable(var); +linked_shader->ir->push_head(var); + } + } + } + + return; +} + /** * Combine a group of shaders for a single stage to generate a linked shader @@ -2352,6 +2386,9 @@ link_intrastage_shaders(void *mem_ctx, return NULL; } + if (linked->Stage != MESA_SHADER_FRAGMENT) + link_output_variables(linked, shader_list, num_shaders); + /* Make a pass over all variable declarations to ensure that arrays with * unspecified sizes have a size specified. The size is inferred from the * max_array_access field. -- 2.18.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl/linker: Link all out vars from a shader objects on a single stage
On 27/08/18 22:20, Vadym Shovkoplias wrote: From: "vadym.shovkoplias" During intra stage linking some out variables can be dropped because it is not used in a shader with the main function. But these out vars can be referenced on later stages which can lead to further linking errors. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105731 Signed-off-by: Vadym Shovkoplias --- src/compiler/glsl/linker.cpp | 38 1 file changed, 38 insertions(+) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 3ce78fe642..3b0c01c316 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -2187,6 +2187,41 @@ link_cs_input_layout_qualifiers(struct gl_shader_program *prog, } } +/** + * Link all out variables on a single stage which are not + * directly used in a shader with the main function. + */ +static void +link_output_variables(struct gl_linked_shader *linked_shader, + struct gl_shader **shader_list, + unsigned num_shaders) +{ + struct glsl_symbol_table *symbols = linked_shader->symbols; + + for (unsigned i = 0; i < num_shaders; i++) { + + /* Skip shader object with main function */ + if (shader_list[i]->symbols->get_function("main")) + continue; + + foreach_in_list (ir_instruction, ir, shader_list[i]->ir) { ^-- Please remove this space Otherwise: Reviewed-by: Timothy Arceri + + if (ir->ir_type != ir_type_variable) +continue; + + ir_variable *const var = (ir_variable *) ir; + + if (var->data.mode == ir_var_shader_out && + !symbols->get_variable(var->name)) { +symbols->add_variable(var); +linked_shader->ir->push_head(var); + } + } + } + + return; +} + /** * Combine a group of shaders for a single stage to generate a linked shader @@ -2352,6 +2387,9 @@ link_intrastage_shaders(void *mem_ctx, return NULL; } + if (linked->Stage != MESA_SHADER_FRAGMENT) + link_output_variables(linked, shader_list, num_shaders); + /* Make a pass over all variable declarations to ensure that arrays with * unspecified sizes have a size specified. The size is inferred from the * max_array_access field. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glsl/linker: Link all out vars from a shader objects on a single stage
From: "vadym.shovkoplias" During intra stage linking some out variables can be dropped because it is not used in a shader with the main function. But these out vars can be referenced on later stages which can lead to further linking errors. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105731 Signed-off-by: Vadym Shovkoplias --- src/compiler/glsl/linker.cpp | 38 1 file changed, 38 insertions(+) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 3ce78fe642..3b0c01c316 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -2187,6 +2187,41 @@ link_cs_input_layout_qualifiers(struct gl_shader_program *prog, } } +/** + * Link all out variables on a single stage which are not + * directly used in a shader with the main function. + */ +static void +link_output_variables(struct gl_linked_shader *linked_shader, + struct gl_shader **shader_list, + unsigned num_shaders) +{ + struct glsl_symbol_table *symbols = linked_shader->symbols; + + for (unsigned i = 0; i < num_shaders; i++) { + + /* Skip shader object with main function */ + if (shader_list[i]->symbols->get_function("main")) + continue; + + foreach_in_list (ir_instruction, ir, shader_list[i]->ir) { + + if (ir->ir_type != ir_type_variable) +continue; + + ir_variable *const var = (ir_variable *) ir; + + if (var->data.mode == ir_var_shader_out && + !symbols->get_variable(var->name)) { +symbols->add_variable(var); +linked_shader->ir->push_head(var); + } + } + } + + return; +} + /** * Combine a group of shaders for a single stage to generate a linked shader @@ -2352,6 +2387,9 @@ link_intrastage_shaders(void *mem_ctx, return NULL; } + if (linked->Stage != MESA_SHADER_FRAGMENT) + link_output_variables(linked, shader_list, num_shaders); + /* Make a pass over all variable declarations to ensure that arrays with * unspecified sizes have a size specified. The size is inferred from the * max_array_access field. -- 2.18.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev