diff options
author | Keith Whitwell <keithw@vmware.com> | 2010-03-21 22:39:02 +0000 |
---|---|---|
committer | Keith Whitwell <keithw@vmware.com> | 2010-03-21 22:39:02 +0000 |
commit | 437ce98daae46be5d532fbb04c7cbf4a503c1623 (patch) | |
tree | f74201f964a8328d99c18dbfe493ad5afa9ba372 | |
parent | 1b02e1ee3e5e87774f0c9e5f0e1898b7f8de1b16 (diff) |
st/python: begin conversion to pipe_resources, much more to do
-rw-r--r-- | src/gallium/state_trackers/python/st_device.c | 38 | ||||
-rw-r--r-- | src/gallium/state_trackers/python/st_device.h | 6 | ||||
-rw-r--r-- | src/gallium/state_trackers/python/st_sample.c | 4 |
3 files changed, 22 insertions, 26 deletions
diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c index c09452f777..3a8a72c33e 100644 --- a/src/gallium/state_trackers/python/st_device.c +++ b/src/gallium/state_trackers/python/st_device.c @@ -128,7 +128,7 @@ st_context_destroy(struct st_context *st_ctx) pipe_sampler_view_reference(&st_ctx->fragment_sampler_views[i], NULL); for(i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; ++i) pipe_sampler_view_reference(&st_ctx->vertex_sampler_views[i], NULL); - pipe_texture_reference(&st_ctx->default_texture, NULL); + pipe_resource_reference(&st_ctx->default_texture, NULL); FREE(st_ctx); @@ -229,8 +229,7 @@ st_context_create(struct st_device *st_dev) /* default textures */ { struct pipe_screen *screen = st_dev->screen; - struct pipe_texture templat; - struct pipe_transfer *transfer; + struct pipe_resource templat; struct pipe_sampler_view view_templ; struct pipe_sampler_view *view; unsigned i; @@ -243,26 +242,23 @@ st_context_create(struct st_device *st_dev) templat.depth0 = 1; templat.last_level = 0; - st_ctx->default_texture = screen->texture_create( screen, &templat ); + st_ctx->default_texture = screen->resource_create( screen, &templat ); if(st_ctx->default_texture) { - transfer = screen->get_transfer(screen, - st_ctx->default_texture, - 0, 0, 0, - PIPE_TRANSFER_WRITE, - 0, 0, - st_ctx->default_texture->width0, - st_ctx->default_texture->height0); - if (transfer) { - uint32_t *map; - map = (uint32_t *) screen->transfer_map(screen, transfer); - if(map) { - *map = 0x00000000; - screen->transfer_unmap(screen, transfer); - } - screen->tex_transfer_destroy(transfer); - } + struct pipe_box box; + uint32_t zero = 0; + + u_box_wh( 1, 1, &box ); + + st_ctx->pipe->transfer_inline_write(st_ctx->pipe, + st_ctx->default_texture, + u_subresource(0,0), + PIPE_TRANSFER_WRITE, + &box, + &zero, + sizeof zero, + 0); } - + u_sampler_view_default_template(&view_templ, st_ctx->default_texture, st_ctx->default_texture->format); diff --git a/src/gallium/state_trackers/python/st_device.h b/src/gallium/state_trackers/python/st_device.h index dcd0dc6e27..2dca7a1974 100644 --- a/src/gallium/state_trackers/python/st_device.h +++ b/src/gallium/state_trackers/python/st_device.h @@ -40,7 +40,7 @@ struct st_winsys; struct st_surface { - struct pipe_texture *texture; + struct pipe_resource *texture; unsigned face; unsigned level; unsigned zslice; @@ -59,7 +59,7 @@ struct st_context void *fs; void *gs; - struct pipe_texture *default_texture; + struct pipe_resource *default_texture; struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS]; struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS]; @@ -85,7 +85,7 @@ struct st_device static INLINE struct pipe_surface * st_pipe_surface(struct st_surface *surface, unsigned usage) { - struct pipe_texture *texture = surface->texture; + struct pipe_resource *texture = surface->texture; struct pipe_screen *screen = texture->screen; return screen->get_tex_surface(screen, texture, surface->face, surface->level, surface->zslice, usage); } diff --git a/src/gallium/state_trackers/python/st_sample.c b/src/gallium/state_trackers/python/st_sample.c index ea27275325..52904fa22c 100644 --- a/src/gallium/state_trackers/python/st_sample.c +++ b/src/gallium/state_trackers/python/st_sample.c @@ -525,7 +525,7 @@ st_sample_pixel_block(enum pipe_format format, void st_sample_surface(struct st_surface *surface, float *rgba) { - struct pipe_texture *texture = surface->texture; + struct pipe_resource *texture = surface->texture; struct pipe_screen *screen = texture->screen; unsigned width = u_minify(texture->width0, surface->level); unsigned height = u_minify(texture->height0, surface->level); @@ -570,5 +570,5 @@ st_sample_surface(struct st_surface *surface, float *rgba) screen->transfer_unmap(screen, transfer); } - screen->tex_transfer_destroy(transfer); + screen->transfer_destroy(transfer); } |