On Fri, Nov 10, 2017 at 2:32 PM, Ian Romanick <i...@freedesktop.org> wrote: > From: Ian Romanick <ian.d.roman...@intel.com> > > This prevents the next change from breaking the build, and I felt that > it was different enough from the rest of that patch to stand on its own. > > Signed-off-by: Ian Romanick <ian.d.roman...@intel.com> > --- > src/compiler/nir/nir_validate.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c > index 9bf8c70..ca191d2 100644 > --- a/src/compiler/nir/nir_validate.c > +++ b/src/compiler/nir/nir_validate.c > @@ -979,8 +979,9 @@ validate_var_decl(nir_variable *var, bool is_global, > validate_state *state) > > validate_assert(state, is_global == nir_variable_is_global(var)); > > - /* Must have exactly one mode set */ > - validate_assert(state, util_bitcount(var->data.mode) == 1); > + /* Must have exactly one mode set (i.e., is a power of two) */ > + validate_assert(state, (var->data.mode != 0 && > + !(var->data.mode & (var->data.mode - 1))));
We actually have two functions in Mesa for this: util_is_power_of_two and _mesa_is_pow_two. Not sure which one is available to this code, but assuming one is, we should use it. _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev