On Tue, 2015-12-29 at 17:38 +1100, eocallag...@alterapraxis.com wrote: > On 2015-12-29 16:00, Timothy Arceri wrote: > > Tessellation shaders treat varyings as shared memory and > > invocations > > can access each others varyings therefore we can't use the existing > > method to lower them. > > > > This adds a check for these stages as following patches will > > allow explicit locations to be lowered even when the driver and > > existing > > tesselation checks ask for it to be disabled, we do this to enable > > support > > for the component layout qualifier. > > I find this a little hard to read and understand, could you brush it > up > a bit > please if that's ok?
Sure I'll try again :) > > > --- > > src/glsl/lower_packed_varyings.cpp | 62 > > +++++++++++++++++++++----------------- > > 1 file changed, 34 insertions(+), 28 deletions(-) > > > > diff --git a/src/glsl/lower_packed_varyings.cpp > > b/src/glsl/lower_packed_varyings.cpp > > index 2899846..e4e9a35 100644 > > --- a/src/glsl/lower_packed_varyings.cpp > > +++ b/src/glsl/lower_packed_varyings.cpp > > @@ -737,40 +737,46 @@ lower_packed_varyings(void *mem_ctx, unsigned > > locations_used, > > ir_variable_mode mode, unsigned > > gs_input_vertices, > > gl_shader *shader, bool > > disable_varying_packing) > > { > > - exec_list *instructions = shader->ir; > > ir_function *main_func = shader->symbols->get_function("main"); > > exec_list void_parameters; > > ir_function_signature *main_func_sig > > = main_func->matching_signature(NULL, &void_parameters, > > false); > > - exec_list new_instructions, new_variables; > > - lower_packed_varyings_visitor visitor(mem_ctx, locations_used, > > mode, > > - gs_input_vertices, > > - &new_instructions, > > - &new_variables, > > - disable_varying_packing); > > - visitor.run(shader); > > - if (mode == ir_var_shader_out) { > > - if (shader->Stage == MESA_SHADER_GEOMETRY) { > > - /* For geometry shaders, outputs need to be lowered > > before > > each call > > - * to EmitVertex() > > - */ > > - lower_packed_varyings_gs_splicer splicer(mem_ctx, > > &new_instructions); > > - > > - /* Add all the variables in first. */ > > - main_func_sig->body.head->insert_before(&new_variables); > > > > - /* Now update all the EmitVertex instances */ > > - splicer.run(instructions); > > + if (!(shader->Stage == MESA_SHADER_TESS_CTRL || > > + shader->Stage == MESA_SHADER_TESS_EVAL)) { > > + exec_list *instructions = shader->ir; > > + exec_list new_instructions, new_variables; > > + > > + lower_packed_varyings_visitor visitor(mem_ctx, > > locations_used, > > mode, > > + gs_input_vertices, > > + &new_instructions, > > + &new_variables, > > + > > disable_varying_packing); > > + visitor.run(shader); > > + if (mode == ir_var_shader_out) { > > + if (shader->Stage == MESA_SHADER_GEOMETRY) { > > + /* For geometry shaders, outputs need to be lowered > > before > > each > > + * call to EmitVertex() > > + */ > > + lower_packed_varyings_gs_splicer splicer(mem_ctx, > > + > > &new_instructions); > > + > > + /* Add all the variables in first. */ > > + main_func_sig->body.head > > ->insert_before(&new_variables); > > + > > + /* Now update all the EmitVertex instances */ > > + splicer.run(instructions); > > + } else { > > + /* For other shader types, outputs need to be lowered > > at > > the end > > + * of main() > > + */ > > + main_func_sig->body.append_list(&new_variables); > > + main_func_sig->body.append_list(&new_instructions); > > + } > > } else { > > - /* For other shader types, outputs need to be lowered at > > the > > end of > > - * main() > > - */ > > - main_func_sig->body.append_list(&new_variables); > > - main_func_sig->body.append_list(&new_instructions); > > + /* Shader inputs need to be lowered at the beginning of > > main() */ > > + main_func_sig->body.head > > ->insert_before(&new_instructions); > > + main_func_sig->body.head->insert_before(&new_variables); > > } > > - } else { > > - /* Shader inputs need to be lowered at the beginning of > > main() > > */ > > - main_func_sig->body.head->insert_before(&new_instructions); > > - main_func_sig->body.head->insert_before(&new_variables); > > } > > } > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev