diff options
author | Jakob Bornecrantz <[email protected]> | 2010-04-24 13:36:09 +0100 |
---|---|---|
committer | Jakob Bornecrantz <[email protected]> | 2010-04-26 00:40:17 +0100 |
commit | ea6a52a1f8e7fd72b5506218c31e58088131f1f5 (patch) | |
tree | d0eb24768f229a2ffe6b3cca4eb0ef356369d736 /src/gallium/state_trackers/dri/sw | |
parent | ab12d4f647702f0063c41dd090cef762aa95a0f9 (diff) |
st/dri: Add hooks for framebuffer functions
Diffstat (limited to 'src/gallium/state_trackers/dri/sw')
-rw-r--r-- | src/gallium/state_trackers/dri/sw/drisw.c | 57 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/sw/drisw.h | 11 |
2 files changed, 24 insertions, 44 deletions
diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c index 9edddf01b57..a7f16dc6929 100644 --- a/src/gallium/state_trackers/dri/sw/drisw.c +++ b/src/gallium/state_trackers/dri/sw/drisw.c @@ -70,7 +70,7 @@ put_image(__DRIdrawable *dPriv, void *data, unsigned width, unsigned height) data, dPriv->loaderPrivate); } -void +static void drisw_update_drawable_info(struct dri_drawable *drawable) { __DRIdrawable *dPriv = drawable->dPriv; @@ -147,7 +147,7 @@ drisw_swap_buffers(__DRIdrawable *dPriv) } } -void +static void drisw_flush_frontbuffer(struct dri_drawable *drawable, enum st_attachment_type statt) { @@ -175,9 +175,10 @@ drisw_flush_frontbuffer(struct dri_drawable *drawable, * seems a better seperation and safer for each DRI version to provide its own * function. */ -void +static void drisw_allocate_textures(struct dri_drawable *drawable, - unsigned mask) + const enum st_attachment_type *statts, + unsigned count) { struct dri_screen *screen = dri_screen(drawable->sPriv); struct pipe_resource templ; @@ -206,38 +207,25 @@ drisw_allocate_textures(struct dri_drawable *drawable, for (i = 0; i < ST_ATTACHMENT_COUNT; i++) { enum pipe_format format; - unsigned tex_usage; + unsigned bind; /* the texture already exists or not requested */ - if (drawable->textures[i] || !(mask & (1 << i))) { + if (drawable->textures[statts[i]]) continue; - } - - switch (i) { - case ST_ATTACHMENT_FRONT_LEFT: - case ST_ATTACHMENT_BACK_LEFT: - case ST_ATTACHMENT_FRONT_RIGHT: - case ST_ATTACHMENT_BACK_RIGHT: - format = drawable->stvis.color_format; - tex_usage = PIPE_BIND_DISPLAY_TARGET | - PIPE_BIND_RENDER_TARGET; - break; - case ST_ATTACHMENT_DEPTH_STENCIL: - format = drawable->stvis.depth_stencil_format; - tex_usage = PIPE_BIND_DEPTH_STENCIL; - break; - default: - format = PIPE_FORMAT_NONE; - break; - } - - if (format != PIPE_FORMAT_NONE) { - templ.format = format; - templ.bind = tex_usage; - - drawable->textures[i] = - screen->pipe_screen->resource_create(screen->pipe_screen, &templ); - } + + dri_drawable_get_format(drawable, statts[i], &format, &bind); + + if (statts[i] != ST_ATTACHMENT_DEPTH_STENCIL) + bind |= PIPE_BIND_DISPLAY_TARGET; + + if (format == PIPE_FORMAT_NONE) + continue; + + templ.format = format; + templ.bind = bind; + + drawable->textures[statts[i]] = + screen->pipe_screen->resource_create(screen->pipe_screen, &templ); } drawable->old_w = width; @@ -270,6 +258,9 @@ drisw_init_screen(__DRIscreen * sPriv) screen->api = NULL; /* not needed */ screen->sPriv = sPriv; screen->fd = -1; + screen->allocate_textures = drisw_allocate_textures; + screen->update_drawable_info = drisw_update_drawable_info; + screen->flush_frontbuffer = drisw_flush_frontbuffer; sPriv->private = (void *)screen; sPriv->extensions = drisw_screen_extensions; diff --git a/src/gallium/state_trackers/dri/sw/drisw.h b/src/gallium/state_trackers/dri/sw/drisw.h index c0c874f7326..6c6c891f356 100644 --- a/src/gallium/state_trackers/dri/sw/drisw.h +++ b/src/gallium/state_trackers/dri/sw/drisw.h @@ -38,17 +38,6 @@ const __DRIconfig ** drisw_init_screen(__DRIscreen * sPriv); -void -drisw_update_drawable_info(struct dri_drawable *drawable); - -void -drisw_flush_frontbuffer(struct dri_drawable *drawable, - enum st_attachment_type statt); - -void -drisw_allocate_textures(struct dri_drawable *drawable, - unsigned mask); - void drisw_swap_buffers(__DRIdrawable * dPriv); #endif /* DRISW_H */ |