zink: simplify shader variant update loop
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fri, 3 Sep 2021 14:06:22 +0000 (10:06 -0400)
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Thu, 16 Sep 2021 03:52:32 +0000 (23:52 -0400)
a single continue makes this much easier to read

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12842>

src/gallium/drivers/zink/zink_program.c

index bc206c1..c46121f 100644 (file)
@@ -162,11 +162,11 @@ update_shader_modules(struct zink_context *ctx,
    u_foreach_bit(pstage, mask) {
       assert(prog->shaders[pstage]);
       struct zink_shader_module *zm = get_shader_module_for_stage(ctx, screen, prog->shaders[pstage], prog, state);
-      if (prog->modules[pstage] != zm) {
-         if (prog->modules[pstage])
-            variant_hash ^= prog->modules[pstage]->hash;
-         hash_changed = true;
-      }
+      if (prog->modules[pstage] == zm)
+         continue;
+      if (prog->modules[pstage])
+         variant_hash ^= prog->modules[pstage]->hash;
+      hash_changed = true;
       default_variants &= zm->default_variant;
       prog->modules[pstage] = zm;
       variant_hash ^= prog->modules[pstage]->hash;