From 368c804383ec8dcdf5b3869cbe27d3fedb4b3589 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 17 Feb 2021 17:10:28 -0800 Subject: [PATCH] lavapipe: make OPT macro MSVC compatible This macros is ugly, make it uglier but msvc compatible. Reviewed-by: Jesse Natalie Part-of: --- src/gallium/frontends/lavapipe/lvp_pipeline.c | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/gallium/frontends/lavapipe/lvp_pipeline.c b/src/gallium/frontends/lavapipe/lvp_pipeline.c index 86904255039..12a616e1e8f 100644 --- a/src/gallium/frontends/lavapipe/lvp_pipeline.c +++ b/src/gallium/frontends/lavapipe/lvp_pipeline.c @@ -437,13 +437,11 @@ shared_var_info(const struct glsl_type *type, unsigned *size, unsigned *align) *align = comp_size; } -#define OPT(pass, ...) ({ \ - bool this_progress = false; \ - NIR_PASS(this_progress, nir, pass, ##__VA_ARGS__); \ - if (this_progress) \ - progress = true; \ - this_progress; \ - }) +#define OPT(pass, ...) do { \ + bool this_progress = false; \ + NIR_PASS(this_progress, nir, pass, ##__VA_ARGS__); \ + progress |= this_progress; \ + } while(0) static void lvp_shader_compile_to_ir(struct lvp_pipeline *pipeline, @@ -587,11 +585,11 @@ lvp_shader_compile_to_ir(struct lvp_pipeline *pipeline, do { progress = false; - progress |= OPT(nir_lower_flrp, 32|64, true); - progress |= OPT(nir_split_array_vars, nir_var_function_temp); - progress |= OPT(nir_shrink_vec_array_vars, nir_var_function_temp); - progress |= OPT(nir_opt_deref); - progress |= OPT(nir_lower_vars_to_ssa); + OPT(nir_lower_flrp, 32|64, true); + OPT(nir_split_array_vars, nir_var_function_temp); + OPT(nir_shrink_vec_array_vars, nir_var_function_temp); + OPT(nir_opt_deref); + OPT(nir_lower_vars_to_ssa); progress |= nir_copy_prop(nir); progress |= nir_opt_dce(nir);