anv: Mark max_push_range UNUSED and simplify the code
authorJason Ekstrand <jason@jlekstrand.net>
Tue, 11 Feb 2020 13:52:17 +0000 (07:52 -0600)
committerMarge Bot <eric+marge@anholt.net>
Sat, 7 Mar 2020 04:51:28 +0000 (04:51 +0000)
The compiler should be smart enough to figure out that it's unused on
Gen11 and earlier and delete the code which calculates.  Us adding an
`if (GEN_GEN >= 12)` check is unnecessary and just dirties the code.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3777>

src/intel/vulkan/genX_cmd_buffer.c

index 22d4f79d28dc24ed422c3751648814efe909c19d..122bc9aa91c777c21642bcd9d46eed5011c22ef9 100644 (file)
@@ -3092,7 +3092,7 @@ cmd_buffer_flush_push_constants(struct anv_cmd_buffer *cmd_buffer,
    anv_foreach_stage(stage, dirty_stages) {
       unsigned buffer_count = 0;
       flushed |= mesa_to_vk_shader_stage(stage);
-      uint32_t max_push_range = 0;
+      UNUSED uint32_t max_push_range = 0;
 
       if (anv_pipeline_has_stage(pipeline, stage)) {
          const struct anv_pipeline_bind_map *bind_map =
@@ -3102,8 +3102,7 @@ cmd_buffer_flush_push_constants(struct anv_cmd_buffer *cmd_buffer,
             const struct anv_push_range *range = &bind_map->push_ranges[i];
             if (range->length > 0) {
                buffer_count++;
-               if (GEN_GEN >= 12 && range->length > max_push_range)
-                  max_push_range = range->length;
+               max_push_range = MAX2(max_push_range, range->length);
             }
          }
       }