summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/i915simple
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/i915simple
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/i915simple')
-rw-r--r--src/mesa/pipe/i915simple/i915_texture.c17
-rw-r--r--src/mesa/pipe/i915simple/i915_texture.h5
2 files changed, 12 insertions, 10 deletions
diff --git a/src/mesa/pipe/i915simple/i915_texture.c b/src/mesa/pipe/i915simple/i915_texture.c
index 61944fe7d9..6faeab134a 100644
--- a/src/mesa/pipe/i915simple/i915_texture.c
+++ b/src/mesa/pipe/i915simple/i915_texture.c
@@ -477,17 +477,17 @@ i945_miptree_layout(struct pipe_context *pipe, struct i915_texture * tex)
return TRUE;
}
-void
-i915_texture_create(struct pipe_context *pipe, struct pipe_texture **pt)
+
+struct pipe_texture *
+i915_texture_create(struct pipe_context *pipe,
+ const struct pipe_texture *templat)
{
- struct i915_texture *tex = REALLOC(*pt, sizeof(struct pipe_texture),
- sizeof(struct i915_texture));
+ struct i915_texture *tex = CALLOC_STRUCT(i915_texture);
if (tex) {
struct i915_context *i915 = i915_context(pipe);
- memset(&tex->base + 1, 0,
- sizeof(struct i915_texture) - sizeof(struct pipe_texture));
+ tex->base = *templat;
if (i915->flags.is_i945 ? i945_miptree_layout(pipe, tex) :
i915_miptree_layout(pipe, tex))
@@ -498,13 +498,14 @@ i915_texture_create(struct pipe_context *pipe, struct pipe_texture **pt)
if (!tex->buffer) {
FREE(tex);
- tex = NULL;
+ return NULL;
}
}
- *pt = &tex->base;
+ return &tex->base;
}
+
void
i915_texture_release(struct pipe_context *pipe, struct pipe_texture **pt)
{
diff --git a/src/mesa/pipe/i915simple/i915_texture.h b/src/mesa/pipe/i915simple/i915_texture.h
index 84a0502e81..330d111dc7 100644
--- a/src/mesa/pipe/i915simple/i915_texture.h
+++ b/src/mesa/pipe/i915simple/i915_texture.h
@@ -6,8 +6,9 @@ struct pipe_context;
struct pipe_texture;
-extern void
-i915_texture_create(struct pipe_context *pipe, struct pipe_texture **pt);
+struct pipe_texture *
+i915_texture_create(struct pipe_context *pipe,
+ const struct pipe_texture *templat);
extern void
i915_texture_release(struct pipe_context *pipe, struct pipe_texture **pt);