summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/softpipe/sp_texture.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-02-06 09:24:30 -0700
committerBrian <brian.paul@tungstengraphics.com>2008-02-06 09:35:39 -0700
commit31c98eafb043cbc82e5de206ceecc5888174b5e6 (patch)
treefbce72265efd094a696c2ee99e9c962870a057ca /src/mesa/pipe/softpipe/sp_texture.c
parentf52f5136e6eed23e55098681e5b082cc452136d6 (diff)
gallium: change pipe->texture_create() to operate like the CSO functions
Now, pass in a template object and return a new object.
Diffstat (limited to 'src/mesa/pipe/softpipe/sp_texture.c')
-rw-r--r--src/mesa/pipe/softpipe/sp_texture.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/mesa/pipe/softpipe/sp_texture.c b/src/mesa/pipe/softpipe/sp_texture.c
index 172234843d..fd2cc3dbbb 100644
--- a/src/mesa/pipe/softpipe/sp_texture.c
+++ b/src/mesa/pipe/softpipe/sp_texture.c
@@ -79,31 +79,30 @@ softpipe_texture_layout(struct softpipe_texture * spt)
}
-void
-softpipe_texture_create(struct pipe_context *pipe, struct pipe_texture **pt)
+struct pipe_texture *
+softpipe_texture_create(struct pipe_context *pipe,
+ const struct pipe_texture *templat)
{
- struct softpipe_texture *spt = REALLOC(*pt, sizeof(struct pipe_texture),
- sizeof(struct softpipe_texture));
-
- if (spt) {
- memset(&spt->base + 1, 0,
- sizeof(struct softpipe_texture) - sizeof(struct pipe_texture));
+ struct softpipe_texture *spt = CALLOC_STRUCT(softpipe_texture);
+ if (!spt)
+ return NULL;
- softpipe_texture_layout(spt);
+ spt->base = *templat;
- spt->buffer = pipe->winsys->buffer_create(pipe->winsys, 32,
- PIPE_BUFFER_USAGE_PIXEL,
- spt->buffer_size);
+ softpipe_texture_layout(spt);
- if (!spt->buffer) {
- FREE(spt);
- spt = NULL;
- }
+ spt->buffer = pipe->winsys->buffer_create(pipe->winsys, 32,
+ PIPE_BUFFER_USAGE_PIXEL,
+ spt->buffer_size);
+ if (!spt->buffer) {
+ FREE(spt);
+ return NULL;
}
- *pt = &spt->base;
+ return &spt->base;
}
+
void
softpipe_texture_release(struct pipe_context *pipe, struct pipe_texture **pt)
{