summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe
diff options
context:
space:
mode:
authorBrian <[email protected]>2008-02-06 09:24:30 -0700
committerBrian <[email protected]>2008-02-06 09:35:39 -0700
commit31c98eafb043cbc82e5de206ceecc5888174b5e6 (patch)
treefbce72265efd094a696c2ee99e9c962870a057ca /src/mesa/pipe
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')
-rw-r--r--src/mesa/pipe/cell/ppu/cell_texture.c31
-rw-r--r--src/mesa/pipe/cell/ppu/cell_texture.h5
-rw-r--r--src/mesa/pipe/i915simple/i915_texture.c17
-rw-r--r--src/mesa/pipe/i915simple/i915_texture.h5
-rw-r--r--src/mesa/pipe/i965simple/brw_tex_layout.c15
-rw-r--r--src/mesa/pipe/i965simple/brw_tex_layout.h4
-rw-r--r--src/mesa/pipe/p_context.h4
-rw-r--r--src/mesa/pipe/softpipe/sp_texture.c33
-rw-r--r--src/mesa/pipe/softpipe/sp_texture.h5
9 files changed, 60 insertions, 59 deletions
diff --git a/src/mesa/pipe/cell/ppu/cell_texture.c b/src/mesa/pipe/cell/ppu/cell_texture.c
index 2cf60229394..df178d9ca24 100644
--- a/src/mesa/pipe/cell/ppu/cell_texture.c
+++ b/src/mesa/pipe/cell/ppu/cell_texture.c
@@ -79,31 +79,30 @@ cell_texture_layout(struct cell_texture * spt)
}
-void
-cell_texture_create(struct pipe_context *pipe, struct pipe_texture **pt)
+struct pipe_texture *
+cell_texture_create(struct pipe_context *pipe, const struct pipe_texture *templat)
{
- struct cell_texture *spt = REALLOC(*pt, sizeof(struct pipe_texture),
- sizeof(struct cell_texture));
+ struct cell_texture *spt = CALLOC_STRUCT(cell_texture);
+ if (!spt)
+ return NULL;
- if (spt) {
- memset(&spt->base + 1, 0,
- sizeof(struct cell_texture) - sizeof(struct pipe_texture));
+ spt->base = *templat;
- cell_texture_layout(spt);
+ cell_texture_layout(spt);
- spt->buffer = pipe->winsys->buffer_create(pipe->winsys, 32,
- PIPE_BUFFER_USAGE_PIXEL,
- spt->buffer_size);
+ spt->buffer = pipe->winsys->buffer_create(pipe->winsys, 32,
+ PIPE_BUFFER_USAGE_PIXEL,
+ spt->buffer_size);
- if (!spt->buffer) {
- FREE(spt);
- spt = NULL;
- }
+ if (!spt->buffer) {
+ FREE(spt);
+ return NULL;
}
- *pt = &spt->base;
+ return &spt->base;
}
+
void
cell_texture_release(struct pipe_context *pipe, struct pipe_texture **pt)
{
diff --git a/src/mesa/pipe/cell/ppu/cell_texture.h b/src/mesa/pipe/cell/ppu/cell_texture.h
index bd434c87762..0264fed88e6 100644
--- a/src/mesa/pipe/cell/ppu/cell_texture.h
+++ b/src/mesa/pipe/cell/ppu/cell_texture.h
@@ -60,8 +60,9 @@ cell_texture(struct pipe_texture *pt)
-extern void
-cell_texture_create(struct pipe_context *pipe, struct pipe_texture **pt);
+extern struct pipe_texture *
+cell_texture_create(struct pipe_context *pipe,
+ const struct pipe_texture *templat);
extern void
cell_texture_release(struct pipe_context *pipe, struct pipe_texture **pt);
diff --git a/src/mesa/pipe/i915simple/i915_texture.c b/src/mesa/pipe/i915simple/i915_texture.c
index 61944fe7d9a..6faeab134ab 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 84a0502e81a..330d111dc78 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);
diff --git a/src/mesa/pipe/i965simple/brw_tex_layout.c b/src/mesa/pipe/i965simple/brw_tex_layout.c
index b8b6b579e22..405fd1f7949 100644
--- a/src/mesa/pipe/i965simple/brw_tex_layout.c
+++ b/src/mesa/pipe/i965simple/brw_tex_layout.c
@@ -299,15 +299,14 @@ static boolean brw_miptree_layout(struct pipe_context *pipe, struct brw_texture
return TRUE;
}
-void
-brw_texture_create(struct pipe_context *pipe, struct pipe_texture **pt)
+
+struct pipe_texture *
+brw_texture_create(struct pipe_context *pipe, const struct pipe_texture *templat)
{
- struct brw_texture *tex = REALLOC(*pt, sizeof(struct pipe_texture),
- sizeof(struct brw_texture));
+ struct brw_texture *tex = CALLOC_STRUCT(brw_texture);
if (tex) {
- memset(&tex->base + 1, 0,
- sizeof(struct brw_texture) - sizeof(struct pipe_texture));
+ tex->base = *templat;
if (brw_miptree_layout(pipe, tex))
tex->buffer = pipe->winsys->buffer_create(pipe->winsys, 64,
@@ -317,11 +316,11 @@ brw_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
diff --git a/src/mesa/pipe/i965simple/brw_tex_layout.h b/src/mesa/pipe/i965simple/brw_tex_layout.h
index 15e275058af..cfd6b1ef3ae 100644
--- a/src/mesa/pipe/i965simple/brw_tex_layout.h
+++ b/src/mesa/pipe/i965simple/brw_tex_layout.h
@@ -6,8 +6,8 @@
struct pipe_context;
struct pipe_texture;
-extern void
-brw_texture_create(struct pipe_context *pipe, struct pipe_texture **pt);
+extern struct pipe_texture *
+brw_texture_create(struct pipe_context *pipe, const struct pipe_texture *templat);
extern void
brw_texture_release(struct pipe_context *pipe, struct pipe_texture **pt);
diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h
index 0dda06c53ba..92a1cd70c42 100644
--- a/src/mesa/pipe/p_context.h
+++ b/src/mesa/pipe/p_context.h
@@ -199,8 +199,8 @@ struct pipe_context {
/*
* Texture functions
*/
- void (*texture_create)(struct pipe_context *pipe,
- struct pipe_texture **pt);
+ struct pipe_texture * (*texture_create)(struct pipe_context *pipe,
+ const struct pipe_texture *templat);
void (*texture_release)(struct pipe_context *pipe,
struct pipe_texture **pt);
diff --git a/src/mesa/pipe/softpipe/sp_texture.c b/src/mesa/pipe/softpipe/sp_texture.c
index 172234843d8..fd2cc3dbbb4 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)
{
diff --git a/src/mesa/pipe/softpipe/sp_texture.h b/src/mesa/pipe/softpipe/sp_texture.h
index c6cf370351d..fa646c0de9f 100644
--- a/src/mesa/pipe/softpipe/sp_texture.h
+++ b/src/mesa/pipe/softpipe/sp_texture.h
@@ -55,8 +55,9 @@ softpipe_texture(struct pipe_texture *pt)
-extern void
-softpipe_texture_create(struct pipe_context *pipe, struct pipe_texture **pt);
+extern struct pipe_texture *
+softpipe_texture_create(struct pipe_context *pipe,
+ const struct pipe_texture *templat);
extern void
softpipe_texture_release(struct pipe_context *pipe, struct pipe_texture **pt);