summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_texture.c
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2010-04-30 15:27:13 +0200
committerRoland Scheidegger <sroland@vmware.com>2010-04-30 15:27:13 +0200
commit7662e3519bef3802024da3050b886068281e02b1 (patch)
treebc5bf675e67febffaf9e4d1fadd139e8c253ae32 /src/gallium/drivers/llvmpipe/lp_texture.c
parent9a966b93c03aecac8eb72e6133aa9a2f2c7673f3 (diff)
parent7c769bef052fc1936d7ab33e291bb4646dc5b0d1 (diff)
Merge commit 'origin/master' into gallium-msaa
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_texture.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 29bdfe36ae..2f41d620c8 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -241,6 +241,13 @@ llvmpipe_resource_destroy(struct pipe_screen *pscreen,
/* display target */
struct sw_winsys *winsys = screen->winsys;
winsys->displaytarget_destroy(winsys, lpr->dt);
+
+ if (lpr->tiled[0].data) {
+ align_free(lpr->tiled[0].data);
+ lpr->tiled[0].data = NULL;
+ }
+
+ FREE(lpr->layout[0]);
}
else if (resource_is_texture(pt)) {
/* regular texture */
@@ -1160,6 +1167,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)
{