Mesa (gallium-resources): st/python: begin conversion to pipe_resources, much more to do
Keith Whitwell
keithw at kemper.freedesktop.org
Sun Mar 21 15:41:56 PDT 2010
Module: Mesa
Branch: gallium-resources
Commit: 437ce98daae46be5d532fbb04c7cbf4a503c1623
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=437ce98daae46be5d532fbb04c7cbf4a503c1623
Author: Keith Whitwell <keithw at vmware.com>
Date: Sun Mar 21 22:39:02 2010 +0000
st/python: begin conversion to pipe_resources, much more to do
---
src/gallium/state_trackers/python/st_device.c | 38 +++++++++++-------------
src/gallium/state_trackers/python/st_device.h | 6 ++--
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 c09452f..3a8a72c 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 dcd0dc6..2dca7a1 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 ea27275..52904fa 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);
}
More information about the mesa-commit
mailing list