freedreno: degrade STATIC_ASSERT to assert

dirty is a variable, and C standard doesn't guarantee that the compiler
can see that it's always passed a constant. So this isn't appropriate to
use for static_assert, which we're about to convert STATIC_ASSERT to
expand to.

If we really want to do this compile-time, we need to make
fd_context_dirty a macro instead. But it seems reaonable to just use a
run-time assert instead here.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16670>
This commit is contained in:
Erik Faye-Lund
2022-05-23 14:36:52 +02:00
committed by Marge Bot
parent 8376fb0f33
commit d8e34243ae
@@ -608,7 +608,7 @@ static inline void
fd_context_dirty(struct fd_context *ctx, enum fd_dirty_3d_state dirty) assert_dt
{
assert(util_is_power_of_two_nonzero(dirty));
STATIC_ASSERT(ffs(dirty) <= ARRAY_SIZE(ctx->gen_dirty_map));
assert(ffs(dirty) <= ARRAY_SIZE(ctx->gen_dirty_map));
ctx->gen_dirty |= ctx->gen_dirty_map[ffs(dirty) - 1];