From 5acee6602319588dedc3317274058bdbd9f6450b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 18 Apr 2010 08:43:42 -0600 Subject: [PATCH] nvfx: move declarations before code --- src/gallium/drivers/nvfx/nvfx_vbo.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/nvfx/nvfx_vbo.c b/src/gallium/drivers/nvfx/nvfx_vbo.c index 0ebeadc870d..b8e94885f04 100644 --- a/src/gallium/drivers/nvfx/nvfx_vbo.c +++ b/src/gallium/drivers/nvfx/nvfx_vbo.c @@ -122,11 +122,12 @@ nvfx_vbo_static_attrib(struct nvfx_context *nvfx, struct pipe_transfer *transfer; struct nouveau_channel* chan = nvfx->screen->base.channel; void *map; + float *v; map = pipe_buffer_map(&nvfx->pipe, vb->buffer, PIPE_TRANSFER_READ, &transfer); map = (uint8_t *) map + vb->buffer_offset + ve->src_offset; - float *v = map; + v = map; switch (ncomp) { case 4: @@ -173,11 +174,11 @@ nvfx_draw_arrays(struct pipe_context *pipe, } while (count) { - unsigned vc, nr; + unsigned vc, nr, avail; nvfx_state_emit(nvfx); - unsigned avail = AVAIL_RING(chan); + avail = AVAIL_RING(chan); avail -= 16 + (avail >> 10); /* for the BEGIN_RING_NIs, conservatively assuming one every 1024, plus 16 for safety */ vc = nouveau_vbuf_split(avail, 6, 256, @@ -229,11 +230,11 @@ nvfx_draw_elements_u08(struct nvfx_context *nvfx, void *ib, while (count) { uint8_t *elts = (uint8_t *)ib + start; - unsigned vc, push, restart = 0; + unsigned vc, push, restart = 0, avail; nvfx_state_emit(nvfx); - unsigned avail = AVAIL_RING(chan); + avail = AVAIL_RING(chan); avail -= 16 + (avail >> 10); /* for the BEGIN_RING_NIs, conservatively assuming one every 1024, plus 16 for safety */ vc = nouveau_vbuf_split(avail, 6, 2, @@ -282,11 +283,11 @@ nvfx_draw_elements_u16(struct nvfx_context *nvfx, void *ib, while (count) { uint16_t *elts = (uint16_t *)ib + start; - unsigned vc, push, restart = 0; + unsigned vc, push, restart = 0, avail; nvfx_state_emit(nvfx); - unsigned avail = AVAIL_RING(chan); + avail = AVAIL_RING(chan); avail -= 16 + (avail >> 10); /* for the BEGIN_RING_NIs, conservatively assuming one every 1024, plus 16 for safety */ vc = nouveau_vbuf_split(avail, 6, 2, @@ -335,11 +336,11 @@ nvfx_draw_elements_u32(struct nvfx_context *nvfx, void *ib, while (count) { uint32_t *elts = (uint32_t *)ib + start; - unsigned vc, push, restart = 0; + unsigned vc, push, restart = 0, avail; nvfx_state_emit(nvfx); - unsigned avail = AVAIL_RING(chan); + avail = AVAIL_RING(chan); avail -= 16 + (avail >> 10); /* for the BEGIN_RING_NIs, conservatively assuming one every 1024, plus 16 for safety */ vc = nouveau_vbuf_split(avail, 5, 1, @@ -413,11 +414,11 @@ nvfx_draw_elements_vbo(struct pipe_context *pipe, unsigned restart = 0; while (count) { - unsigned nr, vc; + unsigned nr, vc, avail; nvfx_state_emit(nvfx); - unsigned avail = AVAIL_RING(chan); + avail = AVAIL_RING(chan); avail -= 16 + (avail >> 10); /* for the BEGIN_RING_NIs, conservatively assuming one every 1024, plus 16 for safety */ vc = nouveau_vbuf_split(avail, 6, 256, -- 2.30.2