summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2015-11-22 12:13:46 -0500
committerIlia Mirkin <[email protected]>2015-11-23 11:17:15 -0500
commit6f17f19b17d6150788e713f92f6a05ef410c4060 (patch)
treecde81ae5c2807a4cbd7a261c7da9fd777c12ee9c /src/gallium/drivers/freedreno/a4xx/fd4_texture.c
parentf10bb0ac9ea558efe7b6dccd673eb2b6604119db (diff)
freedreno/a4xx: only compute texture offset once for the view
Signed-off-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/a4xx/fd4_texture.c')
-rw-r--r--src/gallium/drivers/freedreno/a4xx/fd4_texture.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
index 5217c8a1dc5..0eba75577b0 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
@@ -243,6 +243,8 @@ fd4_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
so->texconst2 =
A4XX_TEX_CONST_2_FETCHSIZE(fd4_pipe2fetchsize(cso->format)) |
A4XX_TEX_CONST_2_PITCH(elements * rsc->cpp);
+ so->offset = cso->u.buf.first_element *
+ util_format_get_blocksize(cso->format);
} else {
unsigned miplevels;
@@ -259,6 +261,7 @@ fd4_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
A4XX_TEX_CONST_2_PITCH(
util_format_get_nblocksx(
cso->format, rsc->slices[lvl].pitch) * rsc->cpp);
+ so->offset = fd_resource_offset(rsc, lvl, cso->u.tex.first_layer);
}
switch (cso->target) {