diff options
author | Kenneth Graunke <[email protected]> | 2017-01-09 21:48:55 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2017-01-10 13:21:31 -0800 |
commit | 1e5b09f42f694687ac3b8abd5e95c391723b65ae (patch) | |
tree | 8afb1399c3cd42954fb2c73e402577cee180f81b /src/compiler/spirv | |
parent | bb04b84114d2780307f9cbd04447216c3f2d1c0c (diff) |
spirv: Tidy some repeated if checks by using a switch statement.
Iago suggested tidying this.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/spirv')
-rw-r--r-- | src/compiler/spirv/vtn_variables.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index 4a6f9788af0..e564fb03cbe 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: |