diff options
author | Brian Paul <[email protected]> | 2008-03-19 18:10:09 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2008-03-19 18:10:09 -0600 |
commit | 122ed506f4b808503b230bade421018614dbe696 (patch) | |
tree | a5df6a4d6ddc14bbe0945c70e126a95ee961c974 /src/gallium/drivers/softpipe/sp_state_surface.c | |
parent | ba31cf68551e409c7360995a35d836c22d9e0e75 (diff) |
gallium: added fb_width/height fields to softpipe context
These are convenience fields. Otherwise, we have to check cbuf[0] or zsbuf
in various places.
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_state_surface.c')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_state_surface.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gallium/drivers/softpipe/sp_state_surface.c b/src/gallium/drivers/softpipe/sp_state_surface.c index 124b18b7081..2f556844644 100644 --- a/src/gallium/drivers/softpipe/sp_state_surface.c +++ b/src/gallium/drivers/softpipe/sp_state_surface.c @@ -48,6 +48,9 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe, struct softpipe_context *sp = softpipe_context(pipe); uint i; + /* updated below */ + sp->fb_width = sp->fb_height = 0; + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { /* check if changing cbuf */ if (sp->framebuffer.cbufs[i] != fb->cbufs[i]) { @@ -60,6 +63,10 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe, /* update cache */ sp_tile_cache_set_surface(sp->cbuf_cache[i], fb->cbufs[i]); } + if (fb->cbufs[i]) { + sp->fb_width = fb->cbufs[i]->width; + sp->fb_height = fb->cbufs[i]->height; + } } sp->framebuffer.num_cbufs = fb->num_cbufs; @@ -74,6 +81,11 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe, /* update cache */ sp_tile_cache_set_surface(sp->zsbuf_cache, fb->zsbuf); + + if (!sp->fb_width && fb->zsbuf) { + sp->fb_width = fb->zsbuf->width; + sp->fb_height = fb->zsbuf->height; + } } #if 0 |