diff options
author | Chia-I Wu <[email protected]> | 2013-12-26 11:46:25 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2014-01-08 18:11:35 +0800 |
commit | 846f70a6ef8be5297eb6f4cf9cf8dc36ce22b818 (patch) | |
tree | 27d0bb62cfc54415cc43b179b98e00e8e3474bb6 /src/gallium/drivers/ilo/ilo_resource.h | |
parent | 127fbc086ba9365e9304843af09fe730edb1d389 (diff) |
ilo: rename and add an accessor for texture slices
Rename ilo_texture::slice_offsets to ilo_texture::slices and add an accessor,
ilo_texture_get_slice().
Diffstat (limited to 'src/gallium/drivers/ilo/ilo_resource.h')
-rw-r--r-- | src/gallium/drivers/ilo/ilo_resource.h | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/gallium/drivers/ilo/ilo_resource.h b/src/gallium/drivers/ilo/ilo_resource.h index 1f82c9fab68..d23622af9f3 100644 --- a/src/gallium/drivers/ilo/ilo_resource.h +++ b/src/gallium/drivers/ilo/ilo_resource.h @@ -42,6 +42,14 @@ struct ilo_buffer { unsigned bo_flags; }; +/** + * A 3D image slice, cube face, or array layer. + */ +struct ilo_texture_slice { + /* 2D offset to the slice */ + unsigned x, y; +}; + struct ilo_texture { struct pipe_resource base; @@ -73,11 +81,7 @@ struct ilo_texture { /* true if samples are interleaved */ bool interleaved; - /* 2D offsets into a layer/slice/face */ - struct ilo_texture_slice { - unsigned x; - unsigned y; - } *slice_offsets[PIPE_MAX_TEXTURE_LEVELS]; + struct ilo_texture_slice *slices[PIPE_MAX_TEXTURE_LEVELS]; struct ilo_texture *separate_s8; @@ -110,9 +114,20 @@ ilo_buffer_alloc_bo(struct ilo_buffer *buf); bool ilo_texture_alloc_bo(struct ilo_texture *tex); +static inline struct ilo_texture_slice * +ilo_texture_get_slice(const struct ilo_texture *tex, + unsigned level, unsigned slice) +{ + assert(level <= tex->base.last_level); + assert(slice < ((tex->base.target == PIPE_TEXTURE_3D) ? + u_minify(tex->base.depth0, level) : tex->base.array_size)); + + return &tex->slices[level][slice]; +} + unsigned ilo_texture_get_slice_offset(const struct ilo_texture *tex, - int level, int slice, + unsigned level, unsigned slice, unsigned *x_offset, unsigned *y_offset); #endif /* ILO_RESOURCE_H */ |