[gtk/gtk-4-2: 33/91] ngl: Fix a rare assertion violation
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-4-2: 33/91] ngl: Fix a rare assertion violation
- Date: Tue, 4 May 2021 02:05:41 +0000 (UTC)
commit d116ba348fcdccc177689cd2c4e55986213b9317
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Apr 12 22:51:01 2021 -0400
ngl: Fix a rare assertion violation
When we clean up the uniform allocations after a frame,
it can happen that our space requirements actually increase,
due to padding that depends on the order of allocations.
Instead of asserting that it doesn't happen, just make
it work by growing our allocation.
Fixes: #3853
gsk/ngl/gskngluniformstate.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/gsk/ngl/gskngluniformstate.c b/gsk/ngl/gskngluniformstate.c
index 44270e8fa5..9a70088779 100644
--- a/gsk/ngl/gskngluniformstate.c
+++ b/gsk/ngl/gskngluniformstate.c
@@ -215,7 +215,17 @@ gsk_ngl_uniform_state_end_frame (GskNglUniformState *state)
state->values_pos = allocator;
- g_assert (allocator <= state->values_len);
+ /* It can happen that our space requirements grow due to
+ * difference in order increasing padding. As a pragmatic
+ * solution to this, just increase the allocation to cover
+ * the predefined mappins.
+ */
+ if (allocator > state->values_len)
+ {
+ while (allocator > state->values_len)
+ state->values_len *= 2;
+ state->values_buf = g_realloc (state->values_buf, state->values_len);
+ }
memset (state->apply_hash, 0, sizeof state->apply_hash);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]