[Mesa-dev] [PATCH 1/3] glsl: Silence unused parameter warnings

Timothy Arceri tarceri at itsqueeze.com
Thu Sep 21 02:15:15 UTC 2017


Fix sent:

https://lists.freedesktop.org/archives/mesa-dev/2017-September/170304.html

On 21/09/17 11:09, Timothy Arceri wrote:
> Hi Ian,
> 
> This series causes massive memory use in the glsl_to_tgsi pass for 
> gallium drivers. For example with the following test:
> 
> ./bin/shader_runner_gles3 
> tests/spec/glsl-es-3.00/execution/varying-struct-copy-return-vs.shader_test 
> -auto
> 
> 
> I'm not sure whats going on yet because it crashes my machine so 
> quickly. It seems like it may be getting stuck somewhere in this code:
> 
> ==24131==    by 0xB5E9A6F: 
> glsl_to_tgsi_visitor::emit_asm(ir_instruction*, unsigned int, 
> st_dst_reg, st_dst_reg, st_src_reg, st_src_reg, st_src_reg, st_src_reg) 
> (st_glsl_to_tgsi.cpp:397)
> ==24131==    by 0xB5EC9E6: emit_asm (st_glsl_to_tgsi.cpp:612)
> ==24131==    by 0xB5EC9E6: glsl_to_tgsi_visitor::visit(ir_constant*) 
> (st_glsl_to_tgsi.cpp:3058)
> ==24131==    by 0xB5F51C3: glsl_to_tgsi_visitor::visit(ir_assignment*) 
> (st_glsl_to_tgsi.cpp:2932)
> ==24131==    by 0xB5E45D3: glsl_to_tgsi_visitor::visit(ir_function*) 
> (st_glsl_to_tgsi.cpp:1185)
> ==24131==    by 0xB6BD2D0: visit_exec_list(exec_list*, ir_visitor*) 
> (ir.cpp:1900)
> ==24131==    by 0xB5FE312: get_mesa_program_tgsi (st_glsl_to_tgsi.cpp:6559)
> ==24131==    by 0xB5FE312: st_link_shader (st_glsl_to_tgsi.cpp:6906)
> ==24131==    by 0xB622A0F: _mesa_glsl_link_shader (ir_to_mesa.cpp:3118)
> ==24131==    by 0xB52D7CA: link_program (shaderapi.c:1171)
> ==24131==    by 0xB52D7CA: link_program_error (shaderapi.c:1249)
> ==24131==    by 0x4F0B65A: stub_glLinkProgram (piglit-dispatch-gen.c:33822)
> ==24131==    by 0x407A67: link_and_use_shaders (shader_runner.c:1086)
> ==24131==    by 0x410601: init_test (shader_runner.c:3855)
> 
> 
> Tim
> 
> On 13/09/17 02:41, Ian Romanick wrote:
>> From: Ian Romanick <ian.d.romanick at intel.com>
>>
>> glsl/ast_type.cpp: In function ‘void 
>> merge_bindless_qualifier(YYLTYPE*, _mesa_glsl_parse_state*, const 
>> ast_type_qualifier&, const ast_type_qualifier&)’:
>> glsl/ast_type.cpp:189:35: warning: unused parameter ‘loc’ 
>> [-Wunused-parameter]
>>   merge_bindless_qualifier(YYLTYPE *loc,
>>                                     ^~~
>> glsl/ast_type.cpp:191:52: warning: unused parameter ‘qualifier’ 
>> [-Wunused-parameter]
>>                            const ast_type_qualifier &qualifier,
>>                                                      ^~~~~~~~~
>> glsl/ast_type.cpp:192:52: warning: unused parameter ‘new_qualifier’ 
>> [-Wunused-parameter]
>>                            const ast_type_qualifier &new_qualifier)
>>                                                      ^~~~~~~~~~~~~
>>
>> glsl/ir_constant_expression.cpp: In member function ‘virtual 
>> ir_constant* ir_rvalue::constant_expression_value(void*, hash_table*)’:
>> glsl/ir_constant_expression.cpp:512:44: warning: unused parameter 
>> ‘mem_ctx’ [-Wunused-parameter]
>>   ir_rvalue::constant_expression_value(void *mem_ctx, struct 
>> hash_table *)
>>                                              ^~~~~~~
>> glsl/ir_constant_expression.cpp: In member function ‘virtual 
>> ir_constant* ir_texture::constant_expression_value(void*, hash_table*)’:
>> glsl/ir_constant_expression.cpp:705:45: warning: unused parameter 
>> ‘mem_ctx’ [-Wunused-parameter]
>>   ir_texture::constant_expression_value(void *mem_ctx, struct 
>> hash_table *)
>>                                               ^~~~~~~
>> glsl/ir_constant_expression.cpp: In member function ‘virtual 
>> ir_constant* ir_assignment::constant_expression_value(void*, 
>> hash_table*)’:
>> glsl/ir_constant_expression.cpp:851:48: warning: unused parameter 
>> ‘mem_ctx’ [-Wunused-parameter]
>>   ir_assignment::constant_expression_value(void *mem_ctx, struct 
>> hash_table *)
>>                                                  ^~~~~~~
>> glsl/ir_constant_expression.cpp: In member function ‘virtual 
>> ir_constant* ir_constant::constant_expression_value(void*, hash_table*)’:
>> glsl/ir_constant_expression.cpp:859:46: warning: unused parameter 
>> ‘mem_ctx’ [-Wunused-parameter]
>>   ir_constant::constant_expression_value(void *mem_ctx, struct 
>> hash_table *)
>>                                                ^~~~~~~
>>
>> glsl/linker.cpp: In function ‘void 
>> link_xfb_stride_layout_qualifiers(gl_context*, gl_shader_program*, 
>> gl_linked_shader*, gl_shader**, unsigned int)’:
>> glsl/linker.cpp:1655:60: warning: unused parameter ‘linked_shader’ 
>> [-Wunused-parameter]
>>                                     struct gl_linked_shader 
>> *linked_shader,
>>                                                              
>> ^~~~~~~~~~~~~
>> glsl/linker.cpp: In function ‘void 
>> link_bindless_layout_qualifiers(gl_shader_program*, gl_program*, 
>> gl_shader**, unsigned int)’:
>> glsl/linker.cpp:1693:52: warning: unused parameter ‘gl_prog’ 
>> [-Wunused-parameter]
>>                                   struct gl_program *gl_prog,
>>                                                      ^~~~~~~
>>
>> glsl/lower_distance.cpp: In member function ‘virtual void 
>> {anonymous}::lower_distance_visitor_counter::handle_rvalue(ir_rvalue**)’:
>> glsl/lower_distance.cpp:652:59: warning: unused parameter ‘rv’ 
>> [-Wunused-parameter]
>>   lower_distance_visitor_counter::handle_rvalue(ir_rvalue **rv)
>>                                                             ^~
>>
>> glsl/opt_array_splitting.cpp: In member function ‘virtual 
>> ir_visitor_status 
>> {anonymous}::ir_array_reference_visitor::visit_leave(ir_assignment*)’:
>> glsl/opt_array_splitting.cpp:198:56: warning: unused parameter ‘ir’ 
>> [-Wunused-parameter]
>>   ir_array_reference_visitor::visit_leave(ir_assignment *ir)
>>                                                          ^~
>>
>> glsl/glsl_parser_extras.cpp: In function ‘void 
>> assign_subroutine_indexes(gl_shader*, _mesa_glsl_parse_state*)’:
>> glsl/glsl_parser_extras.cpp:1869:45: warning: unused parameter ‘sh’ 
>> [-Wunused-parameter]
>>   assign_subroutine_indexes(struct gl_shader *sh,
>>                                               ^~
>>
>> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
>> ---
>>   src/compiler/glsl/ast_type.cpp               | 7 ++-----
>>   src/compiler/glsl/glsl_parser_extras.cpp     | 5 ++---
>>   src/compiler/glsl/ir_constant_expression.cpp | 8 ++++----
>>   src/compiler/glsl/linker.cpp                 | 7 ++-----
>>   src/compiler/glsl/lower_distance.cpp         | 2 +-
>>   src/compiler/glsl/opt_array_splitting.cpp    | 2 +-
>>   6 files changed, 12 insertions(+), 19 deletions(-)
>>
>> diff --git a/src/compiler/glsl/ast_type.cpp 
>> b/src/compiler/glsl/ast_type.cpp
>> index ee8697b..e9d60de 100644
>> --- a/src/compiler/glsl/ast_type.cpp
>> +++ b/src/compiler/glsl/ast_type.cpp
>> @@ -186,10 +186,7 @@ validate_point_mode(MAYBE_UNUSED const 
>> ast_type_qualifier &qualifier,
>>   }
>>   static void
>> -merge_bindless_qualifier(YYLTYPE *loc,
>> -                         _mesa_glsl_parse_state *state,
>> -                         const ast_type_qualifier &qualifier,
>> -                         const ast_type_qualifier &new_qualifier)
>> +merge_bindless_qualifier(_mesa_glsl_parse_state *state)
>>   {
>>      if (state->default_uniform_qualifier->flags.q.bindless_sampler) {
>>         state->bindless_sampler_specified = true;
>> @@ -484,7 +481,7 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
>>          q.flags.q.bindless_image ||
>>          q.flags.q.bound_sampler ||
>>          q.flags.q.bound_image)
>> -      merge_bindless_qualifier(loc, state, *this, q);
>> +      merge_bindless_qualifier(state);
>>      return r;
>>   }
>> diff --git a/src/compiler/glsl/glsl_parser_extras.cpp 
>> b/src/compiler/glsl/glsl_parser_extras.cpp
>> index cfb214e..2c42716 100644
>> --- a/src/compiler/glsl/glsl_parser_extras.cpp
>> +++ b/src/compiler/glsl/glsl_parser_extras.cpp
>> @@ -1866,8 +1866,7 @@ set_shader_inout_layout(struct gl_shader *shader,
>>   extern "C" {
>>   static void
>> -assign_subroutine_indexes(struct gl_shader *sh,
>> -              struct _mesa_glsl_parse_state *state)
>> +assign_subroutine_indexes(struct _mesa_glsl_parse_state *state)
>>   {
>>      int j, k;
>>      int index = 0;
>> @@ -2105,7 +2104,7 @@ _mesa_glsl_compile_shader(struct gl_context 
>> *ctx, struct gl_shader *shader,
>>      shader->IsES = state->es_shader;
>>      if (!state->error && !shader->ir->is_empty()) {
>> -      assign_subroutine_indexes(shader, state);
>> +      assign_subroutine_indexes(state);
>>         lower_subroutine(shader->ir, state);
>>         if (!ctx->Cache || force_recompile)
>> diff --git a/src/compiler/glsl/ir_constant_expression.cpp 
>> b/src/compiler/glsl/ir_constant_expression.cpp
>> index 2fc23ba..fe9bd1d 100644
>> --- a/src/compiler/glsl/ir_constant_expression.cpp
>> +++ b/src/compiler/glsl/ir_constant_expression.cpp
>> @@ -509,7 +509,7 @@ constant_referenced(const ir_dereference *deref,
>>   ir_constant *
>> -ir_rvalue::constant_expression_value(void *mem_ctx, struct hash_table *)
>> +ir_rvalue::constant_expression_value(void *, struct hash_table *)
>>   {
>>      assert(this->type->is_error());
>>      return NULL;
>> @@ -702,7 +702,7 @@ ir_expression::constant_expression_value(void 
>> *mem_ctx,
>>   ir_constant *
>> -ir_texture::constant_expression_value(void *mem_ctx, struct 
>> hash_table *)
>> +ir_texture::constant_expression_value(void *, struct hash_table *)
>>   {
>>      /* texture lookups aren't constant expressions */
>>      return NULL;
>> @@ -848,7 +848,7 @@ 
>> ir_dereference_record::constant_expression_value(void *mem_ctx,
>>   ir_constant *
>> -ir_assignment::constant_expression_value(void *mem_ctx, struct 
>> hash_table *)
>> +ir_assignment::constant_expression_value(void *, struct hash_table *)
>>   {
>>      /* FINISHME: Handle CEs involving assignment (return RHS) */
>>      return NULL;
>> @@ -856,7 +856,7 @@ ir_assignment::constant_expression_value(void 
>> *mem_ctx, struct hash_table *)
>>   ir_constant *
>> -ir_constant::constant_expression_value(void *mem_ctx, struct 
>> hash_table *)
>> +ir_constant::constant_expression_value(void *, struct hash_table *)
>>   {
>>      return this;
>>   }
>> diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
>> index 5c3f1d1..141bf43 100644
>> --- a/src/compiler/glsl/linker.cpp
>> +++ b/src/compiler/glsl/linker.cpp
>> @@ -1652,7 +1652,6 @@ validate_xfb_buffer_stride(struct gl_context 
>> *ctx, unsigned idx,
>>   static void
>>   link_xfb_stride_layout_qualifiers(struct gl_context *ctx,
>>                                     struct gl_shader_program *prog,
>> -                                  struct gl_linked_shader 
>> *linked_shader,
>>                                     struct gl_shader **shader_list,
>>                                     unsigned num_shaders)
>>   {
>> @@ -1690,7 +1689,6 @@ link_xfb_stride_layout_qualifiers(struct 
>> gl_context *ctx,
>>    */
>>   static void
>>   link_bindless_layout_qualifiers(struct gl_shader_program *prog,
>> -                                struct gl_program *gl_prog,
>>                                   struct gl_shader **shader_list,
>>                                   unsigned num_shaders)
>>   {
>> @@ -2286,10 +2284,9 @@ link_intrastage_shaders(void *mem_ctx,
>>      link_cs_input_layout_qualifiers(prog, gl_prog, shader_list, 
>> num_shaders);
>>      if (linked->Stage != MESA_SHADER_FRAGMENT)
>> -      link_xfb_stride_layout_qualifiers(ctx, prog, linked, shader_list,
>> -                                        num_shaders);
>> +      link_xfb_stride_layout_qualifiers(ctx, prog, shader_list, 
>> num_shaders);
>> -   link_bindless_layout_qualifiers(prog, gl_prog, shader_list, 
>> num_shaders);
>> +   link_bindless_layout_qualifiers(prog, shader_list, num_shaders);
>>      populate_symbol_table(linked);
>> diff --git a/src/compiler/glsl/lower_distance.cpp 
>> b/src/compiler/glsl/lower_distance.cpp
>> index 4d8d66b..530f79d 100644
>> --- a/src/compiler/glsl/lower_distance.cpp
>> +++ b/src/compiler/glsl/lower_distance.cpp
>> @@ -649,7 +649,7 @@ lower_distance_visitor_counter::visit(ir_variable 
>> *ir)
>>   }
>>   void
>> -lower_distance_visitor_counter::handle_rvalue(ir_rvalue **rv)
>> +lower_distance_visitor_counter::handle_rvalue(ir_rvalue **)
>>   {
>>      return;
>>   }
>> diff --git a/src/compiler/glsl/opt_array_splitting.cpp 
>> b/src/compiler/glsl/opt_array_splitting.cpp
>> index d2e81665..7d928b9 100644
>> --- a/src/compiler/glsl/opt_array_splitting.cpp
>> +++ b/src/compiler/glsl/opt_array_splitting.cpp
>> @@ -195,7 +195,7 @@ 
>> ir_array_reference_visitor::visit_enter(ir_assignment *ir)
>>   }
>>   ir_visitor_status
>> -ir_array_reference_visitor::visit_leave(ir_assignment *ir)
>> +ir_array_reference_visitor::visit_leave(ir_assignment *)
>>   {
>>      in_whole_array_copy = false;
>>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list