spirv: Tidy some repeated if checks by using a switch statement.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 10 Jan 2017 05:48:55 +0000 (21:48 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 10 Jan 2017 21:21:31 +0000 (13:21 -0800)
Iago suggested tidying this.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/spirv/vtn_variables.c

index 4a6f9788af0bc02b73f1a793a0d9a5d052e466a2..e564fb03cbe459b060d1948d3497b126b86f7bf3 100644 (file)
@@ -1064,17 +1064,18 @@ apply_var_decoration(struct vtn_builder *b, nir_variable *nir_var,
       vtn_get_builtin_location(b, builtin, &nir_var->data.location, &mode);
       nir_var->data.mode = mode;
 
-      if (builtin == SpvBuiltInTessLevelOuter ||
-          builtin == SpvBuiltInTessLevelInner) {
+      switch (builtin) {
+      case SpvBuiltInTessLevelOuter:
+      case SpvBuiltInTessLevelInner:
          nir_var->data.compact = true;
-      }
-
-      if (builtin == SpvBuiltInFragCoord || builtin == SpvBuiltInSamplePosition)
+         break;
+      case SpvBuiltInSamplePosition:
          nir_var->data.origin_upper_left = b->origin_upper_left;
-
-      if (builtin == SpvBuiltInFragCoord)
+         /* fallthrough */
+      case SpvBuiltInFragCoord:
          nir_var->data.pixel_center_integer = b->pixel_center_integer;
-      break;
+         break;
+      }
    }
 
    case SpvDecorationSpecId: