diff options
author | Rob Clark <[email protected]> | 2014-12-12 17:20:50 -0500 |
---|---|---|
committer | Rob Clark <[email protected]> | 2014-12-13 15:09:37 -0500 |
commit | 7474de2235beee9240be702ab99b93989fa7c7c1 (patch) | |
tree | 8893d371f3d74405edf037c129f9b8f2c5234146 /src/gallium/drivers/freedreno/freedreno_resource.h | |
parent | 23caba862a001f82ef352307a79bebf7ef910959 (diff) |
freedreno: helper to calc layer/level offset
Rather than duplicating this everywhere. Especially as on a4xx the
layout of layers and levels differs based on texture type.
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_resource.h')
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_resource.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.h b/src/gallium/drivers/freedreno/freedreno_resource.h index 7e10d7a6416..1073eb7547e 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.h +++ b/src/gallium/drivers/freedreno/freedreno_resource.h @@ -67,6 +67,14 @@ fd_resource_slice(struct fd_resource *rsc, unsigned level) return &rsc->slices[level]; } +/* get offset for specified mipmap level and texture/array layer */ +static INLINE uint32_t +fd_resource_offset(struct fd_resource *rsc, unsigned level, unsigned layer) +{ + struct fd_resource_slice *slice = fd_resource_slice(rsc, level); + return slice->offset + (slice->size0 * layer); +} + void fd_resource_screen_init(struct pipe_screen *pscreen); void fd_resource_context_init(struct pipe_context *pctx); |