diff options
author | Axel Davy <axel.davy@ens.fr> | 2016-10-18 23:05:02 +0200 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2016-10-27 11:01:38 +0100 |
commit | 32caa7438a49bcef2e575c03da825beb198403e8 (patch) | |
tree | 31bdef7c5d366ed0ba677d4da46107bfc98b184a /src/gallium/state_trackers | |
parent | 074ede8d4ff6e4e94b5be550ff38628b21940b2d (diff) | |
download | external_mesa3d-32caa7438a49bcef2e575c03da825beb198403e8.zip external_mesa3d-32caa7438a49bcef2e575c03da825beb198403e8.tar.gz external_mesa3d-32caa7438a49bcef2e575c03da825beb198403e8.tar.bz2 |
st/nine: Fix leak with integer and boolean constants
Leak introduced by:
a83dce01284f220b1bf932774730e13fca6cdd20
The patch also moves the part to
release changed.vs_const_i and changed.vs_const_b
before the if (!cb.buffer_size) check,
to avoid reuploading every draw call if
integer or boolean constants are dirty, but the shaders
use no constants.
Signed-off-by: Axel Davy <axel.davy@ens.fr>
CC: "13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 25beccb379731b0e6fc728982190779da47aa6fd)
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/nine/nine_state.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c index f6bf51e..ea72c77 100644 --- a/src/gallium/state_trackers/nine/nine_state.c +++ b/src/gallium/state_trackers/nine/nine_state.c @@ -126,7 +126,6 @@ prepare_vs_constants_userbuf_swvp(struct NineDevice9 *device) cb.user_buffer = state->vs_const_i; state->pipe.cb2_swvp = cb; - state->changed.vs_const_i = 0; } if (state->changed.vs_const_b || state->changed.group & NINE_STATE_SWVP) { @@ -138,7 +137,6 @@ prepare_vs_constants_userbuf_swvp(struct NineDevice9 *device) cb.user_buffer = state->vs_const_b; state->pipe.cb3_swvp = cb; - state->changed.vs_const_b = 0; } if (!device->driver_caps.user_cbufs) { @@ -236,14 +234,30 @@ prepare_vs_constants_userbuf(struct NineDevice9 *device) if (state->changed.vs_const_i || state->changed.group & NINE_STATE_SWVP) { int *idst = (int *)&state->vs_const_f[4 * device->max_vs_const_f]; memcpy(idst, state->vs_const_i, NINE_MAX_CONST_I * sizeof(int[4])); - state->changed.vs_const_i = 0; } if (state->changed.vs_const_b || state->changed.group & NINE_STATE_SWVP) { int *idst = (int *)&state->vs_const_f[4 * device->max_vs_const_f]; uint32_t *bdst = (uint32_t *)&idst[4 * NINE_MAX_CONST_I]; memcpy(bdst, state->vs_const_b, NINE_MAX_CONST_B * sizeof(BOOL)); - state->changed.vs_const_b = 0; + } + + if (device->state.changed.vs_const_i) { + struct nine_range *r = device->state.changed.vs_const_i; + struct nine_range *p = r; + while (p->next) + p = p->next; + nine_range_pool_put_chain(&device->range_pool, r, p); + device->state.changed.vs_const_i = NULL; + } + + if (device->state.changed.vs_const_b) { + struct nine_range *r = device->state.changed.vs_const_b; + struct nine_range *p = r; + while (p->next) + p = p->next; + nine_range_pool_put_chain(&device->range_pool, r, p); + device->state.changed.vs_const_b = NULL; } if (!cb.buffer_size) @@ -290,23 +304,6 @@ prepare_vs_constants_userbuf(struct NineDevice9 *device) device->state.changed.vs_const_f = NULL; } - if (device->state.changed.vs_const_i) { - struct nine_range *r = device->state.changed.vs_const_i; - struct nine_range *p = r; - while (p->next) - p = p->next; - nine_range_pool_put_chain(&device->range_pool, r, p); - device->state.changed.vs_const_i = NULL; - } - - if (device->state.changed.vs_const_b) { - struct nine_range *r = device->state.changed.vs_const_b; - struct nine_range *p = r; - while (p->next) - p = p->next; - nine_range_pool_put_chain(&device->range_pool, r, p); - device->state.changed.vs_const_b = NULL; - } state->changed.group &= ~NINE_STATE_VS_CONST; state->commit |= NINE_STATE_COMMIT_CONST_VS; } |