From d7c336dc49f980cd129ebc159e11cd3ed9500e68 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 18 Apr 2010 08:38:03 -0600 Subject: [PATCH] nvfx: move declarations before code to silence warnings --- src/gallium/drivers/nvfx/nv04_surface_2d.c | 8 +++++--- src/gallium/drivers/nvfx/nvfx_fragtex.c | 7 +++++-- src/gallium/drivers/nvfx/nvfx_screen.c | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/nvfx/nv04_surface_2d.c b/src/gallium/drivers/nvfx/nv04_surface_2d.c index a1507bbb3ca..4ed574227d6 100644 --- a/src/gallium/drivers/nvfx/nv04_surface_2d.c +++ b/src/gallium/drivers/nvfx/nv04_surface_2d.c @@ -497,6 +497,9 @@ struct nv04_surface* nv04_surface_wrap_for_render(struct pipe_screen *pscreen, struct nv04_surface_2d* eng2d, struct nv04_surface* ns) { + struct pipe_resource templ; + struct pipe_resource* temp_tex; + struct nv04_surface* temp_ns; int temp_flags; temp_flags = (ns->base.usage | @@ -506,7 +509,6 @@ nv04_surface_wrap_for_render(struct pipe_screen *pscreen, ns->base.usage = (PIPE_BIND_BLIT_SOURCE | PIPE_BIND_BLIT_DESTINATION); - struct pipe_resource templ; memset(&templ, 0, sizeof(templ)); templ.format = ns->base.texture->format; templ.target = PIPE_TEXTURE_2D; @@ -520,8 +522,8 @@ nv04_surface_wrap_for_render(struct pipe_screen *pscreen, templ.bind = ns->base.texture->bind | PIPE_BIND_RENDER_TARGET; - struct pipe_resource* temp_tex = pscreen->resource_create(pscreen, &templ); - struct nv04_surface* temp_ns = (struct nv04_surface*)pscreen->get_tex_surface(pscreen, temp_tex, 0, 0, 0, temp_flags); + temp_tex = pscreen->resource_create(pscreen, &templ); + temp_ns = (struct nv04_surface*)pscreen->get_tex_surface(pscreen, temp_tex, 0, 0, 0, temp_flags); temp_ns->backing = ns; if(ns->base.usage & PIPE_BIND_BLIT_SOURCE) diff --git a/src/gallium/drivers/nvfx/nvfx_fragtex.c b/src/gallium/drivers/nvfx/nvfx_fragtex.c index f5f6b0c0cbd..0b4a434fecc 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragtex.c +++ b/src/gallium/drivers/nvfx/nvfx_fragtex.c @@ -40,11 +40,14 @@ nvfx_fragtex_relocate(struct nvfx_context *nvfx) samplers = nvfx->hw_samplers; while (samplers) { + struct nvfx_miptree* mt; + struct nouveau_bo *bo; + unit = ffs(samplers) - 1; samplers &= ~(1 << unit); - struct nvfx_miptree* mt = (struct nvfx_miptree*)nvfx->fragment_sampler_views[unit]->texture; - struct nouveau_bo *bo = mt->base.bo; + mt = (struct nvfx_miptree*)nvfx->fragment_sampler_views[unit]->texture; + bo = mt->base.bo; MARK_RING(chan, 3, 3); OUT_RELOC(chan, bo, RING_3D(NV34TCL_TX_OFFSET(unit), 2), tex_flags | NOUVEAU_BO_DUMMY, 0, 0); diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c index 04b456d4087..9f03ab1833b 100644 --- a/src/gallium/drivers/nvfx/nvfx_screen.c +++ b/src/gallium/drivers/nvfx/nvfx_screen.c @@ -316,6 +316,7 @@ nvfx_screen_get_vertex_buffer_flags(struct nvfx_screen* screen) struct pipe_screen * nvfx_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) { + static const unsigned query_sizes[] = {(4096 - 4 * 32) / 32, 3 * 1024 / 32, 2 * 1024 / 32, 1024 / 32}; struct nvfx_screen *screen = CALLOC_STRUCT(nvfx_screen); struct nouveau_channel *chan; struct pipe_screen *pscreen; @@ -401,7 +402,6 @@ nvfx_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) } /* Query objects */ - unsigned query_sizes[] = {(4096 - 4 * 32) / 32, 3 * 1024 / 32, 2 * 1024 / 32, 1024 / 32}; for(i = 0; i < sizeof(query_sizes) / sizeof(query_sizes[0]); ++i) { ret = nouveau_notifier_alloc(chan, 0xbeef0302, query_sizes[i], &screen->query); -- 2.30.2