diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/pipe/softpipe/sp_quad_fs.c | 1 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_state.h | 29 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_state_sampler.c | 3 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_surface.c | 3 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_texture.c | 2 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_texture.h | 39 |
6 files changed, 45 insertions, 32 deletions
diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c index 7184fcda52..1aba54d12a 100644 --- a/src/mesa/pipe/softpipe/sp_quad_fs.c +++ b/src/mesa/pipe/softpipe/sp_quad_fs.c @@ -49,6 +49,7 @@ #include "sp_state.h" #include "sp_headers.h" #include "sp_quad.h" +#include "sp_texture.h" #include "sp_tex_sample.h" diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h index daf9955ca5..ea9d2e62be 100644 --- a/src/mesa/pipe/softpipe/sp_state.h +++ b/src/mesa/pipe/softpipe/sp_state.h @@ -52,35 +52,6 @@ struct sp_fragment_shader_state { #endif }; -struct softpipe_texture -{ - struct pipe_texture base; - - /* Derived from the above: - */ - unsigned pitch; - unsigned depth_pitch; /* per-image on i945? */ - unsigned total_height; - - unsigned nr_images[PIPE_MAX_TEXTURE_LEVELS]; - - /* Explicitly store the offset of each image for each cube face or - * depth value. Pretty much have to accept that hardware formats - * are going to be so diverse that there is no unified way to - * compute the offsets of depth/cube images within a mipmap level, - * so have to store them as a lookup table: - */ - unsigned *image_offset[PIPE_MAX_TEXTURE_LEVELS]; /**< array [depth] of offsets */ - - /* Includes image offset tables: - */ - unsigned long level_offset[PIPE_MAX_TEXTURE_LEVELS]; - - /* The data is held here: - */ - struct pipe_buffer_handle *buffer; -}; - void * softpipe_create_alpha_test_state(struct pipe_context *, const struct pipe_alpha_test_state *); diff --git a/src/mesa/pipe/softpipe/sp_state_sampler.c b/src/mesa/pipe/softpipe/sp_state_sampler.c index e71b9159e3..173901f04e 100644 --- a/src/mesa/pipe/softpipe/sp_state_sampler.c +++ b/src/mesa/pipe/softpipe/sp_state_sampler.c @@ -32,6 +32,7 @@ #include "pipe/p_util.h" #include "sp_context.h" #include "sp_state.h" +#include "sp_texture.h" #include "sp_tile_cache.h" @@ -73,7 +74,7 @@ softpipe_set_texture_state(struct pipe_context *pipe, struct softpipe_context *softpipe = softpipe_context(pipe); assert(unit < PIPE_MAX_SAMPLERS); - softpipe->texture[unit] = (struct softpipe_texture *)texture; /* ptr, not struct */ + softpipe->texture[unit] = softpipe_texture(texture); /* ptr, not struct */ sp_tile_cache_set_texture(softpipe->tex_cache[unit], texture); diff --git a/src/mesa/pipe/softpipe/sp_surface.c b/src/mesa/pipe/softpipe/sp_surface.c index c61e0842fc..16f0209eee 100644 --- a/src/mesa/pipe/softpipe/sp_surface.c +++ b/src/mesa/pipe/softpipe/sp_surface.c @@ -32,6 +32,7 @@ #include "sp_context.h" #include "sp_state.h" #include "sp_surface.h" +#include "sp_texture.h" #include "sp_tile_cache.h" /** @@ -568,7 +569,7 @@ softpipe_get_tex_surface(struct pipe_context *pipe, struct pipe_texture *pt, unsigned face, unsigned level, unsigned zslice) { - struct softpipe_texture *spt = (struct softpipe_texture *)pt; + struct softpipe_texture *spt = softpipe_texture(pt); struct pipe_surface *ps; unsigned offset; /* in bytes */ diff --git a/src/mesa/pipe/softpipe/sp_texture.c b/src/mesa/pipe/softpipe/sp_texture.c index 53486f9bba..e8cdd67435 100644 --- a/src/mesa/pipe/softpipe/sp_texture.c +++ b/src/mesa/pipe/softpipe/sp_texture.c @@ -412,7 +412,7 @@ softpipe_texture_release(struct pipe_context *pipe, struct pipe_texture **pt) __FUNCTION__, (void *) *pt, (*pt)->refcount - 1); */ if (--(*pt)->refcount <= 0) { - struct softpipe_texture *spt = (struct softpipe_texture *)*pt; + struct softpipe_texture *spt = softpipe_texture(*pt); uint i; /* diff --git a/src/mesa/pipe/softpipe/sp_texture.h b/src/mesa/pipe/softpipe/sp_texture.h index 2aca57bd1d..732064d986 100644 --- a/src/mesa/pipe/softpipe/sp_texture.h +++ b/src/mesa/pipe/softpipe/sp_texture.h @@ -6,6 +6,45 @@ struct pipe_context; struct pipe_texture; +struct softpipe_texture +{ + struct pipe_texture base; + + /* Derived from the above: + */ + unsigned pitch; + unsigned depth_pitch; /* per-image on i945? */ + unsigned total_height; + + unsigned nr_images[PIPE_MAX_TEXTURE_LEVELS]; + + /* Explicitly store the offset of each image for each cube face or + * depth value. Pretty much have to accept that hardware formats + * are going to be so diverse that there is no unified way to + * compute the offsets of depth/cube images within a mipmap level, + * so have to store them as a lookup table: + */ + unsigned *image_offset[PIPE_MAX_TEXTURE_LEVELS]; /**< array [depth] of offsets */ + + /* Includes image offset tables: + */ + unsigned long level_offset[PIPE_MAX_TEXTURE_LEVELS]; + + /* The data is held here: + */ + struct pipe_buffer_handle *buffer; +}; + + +/** cast wrapper */ +static INLINE struct softpipe_texture * +softpipe_texture(struct pipe_texture *pt) +{ + return (struct softpipe_texture *) pt; +} + + + extern void softpipe_texture_create(struct pipe_context *pipe, struct pipe_texture **pt); |