summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_texture.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-04-27 11:32:25 -0600
committerBrian Paul <brianp@vmware.com>2010-04-27 11:32:25 -0600
commit1db3a55b9c59093f7bf4df39579287eeb0cf0a2b (patch)
treebefed1725b8b568106b42a95353dee0a66187e04 /src/gallium/drivers/llvmpipe/lp_texture.c
parent85ab6d2447784c417c705ec3c91be2893a801213 (diff)
llvmpipe: added llvmpipe_resource_size()
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_texture.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 29bdfe36ae..9d10a9f2d3 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -1160,6 +1160,27 @@ llvmpipe_get_texture_tile(struct llvmpipe_resource *lpr,
}
+/**
+ * Return size of resource in bytes
+ */
+unsigned
+llvmpipe_resource_size(const struct pipe_resource *resource)
+{
+ const struct llvmpipe_resource *lpr = llvmpipe_resource_const(resource);
+ unsigned lvl, size = 0;
+
+ for (lvl = 0; lvl <= lpr->base.last_level; lvl++) {
+ if (lpr->linear[lvl].data)
+ size += tex_image_size(lpr, lvl, LP_TEX_LAYOUT_LINEAR);
+
+ if (lpr->tiled[lvl].data)
+ size += tex_image_size(lpr, lvl, LP_TEX_LAYOUT_TILED);
+ }
+
+ return size;
+}
+
+
void
llvmpipe_init_screen_resource_funcs(struct pipe_screen *screen)
{