Mesa (master): spirv: Tidy some repeated if checks by using a switch statement.
Kenneth Graunke
kwg at kemper.freedesktop.org
Tue Jan 10 22:04:12 UTC 2017
Module: Mesa
Branch: master
Commit: 1e5b09f42f694687ac3b8abd5e95c391723b65ae
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1e5b09f42f694687ac3b8abd5e95c391723b65ae
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Mon Jan 9 21:48:55 2017 -0800
spirv: Tidy some repeated if checks by using a switch statement.
Iago suggested tidying this.
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
---
src/compiler/spirv/vtn_variables.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 4a6f978..e564fb0 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -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:
More information about the mesa-commit
mailing list