summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_state_sampler.c
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2014-07-01 03:09:44 +0200
committerRoland Scheidegger <sroland@vmware.com>2014-07-02 01:55:59 +0200
commitaa1ab8173dfe73692cf65af401e7345ec78bb313 (patch)
tree0d6240f91f011253574677478e547174da46a39f /src/gallium/drivers/llvmpipe/lp_state_sampler.c
parent90abdc15414f44862a82fe2e53e5419f8182b9ac (diff)
downloadexternal_mesa3d-aa1ab8173dfe73692cf65af401e7345ec78bb313.zip
external_mesa3d-aa1ab8173dfe73692cf65af401e7345ec78bb313.tar.gz
external_mesa3d-aa1ab8173dfe73692cf65af401e7345ec78bb313.tar.bz2
llvmpipe: get rid of llvmpipe_get_texture_image_all
Once used for invoking swizzled->linear conversion for all needed images. But we now have a single allocation for all images in a resource, thus looping through all slices is rather pointless, conversion doesn't happen neither. Also simplify the sampling setup code to use the mip_offsets array in the resource directly - if the (non display target) resource exists its memory will already be allocated as well. Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_state_sampler.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_sampler.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
index d204378..a14a64f 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
@@ -232,29 +232,16 @@ prepare_shader_sampling(
/* regular texture - setup array of mipmap level offsets */
struct pipe_resource *res = view->texture;
int j;
- void *mip_ptr;
if (llvmpipe_resource_is_texture(res)) {
first_level = view->u.tex.first_level;
last_level = view->u.tex.last_level;
assert(first_level <= last_level);
assert(last_level <= res->last_level);
-
- /* must trigger allocation first before we can get base ptr */
- /* XXX this may fail due to OOM ? */
- mip_ptr = llvmpipe_get_texture_image_all(lp_tex, view->u.tex.first_level,
- LP_TEX_USAGE_READ);
addr = lp_tex->tex_data;
for (j = first_level; j <= last_level; j++) {
- mip_ptr = llvmpipe_get_texture_image_all(lp_tex, j,
- LP_TEX_USAGE_READ);
- mip_offsets[j] = (uint8_t *)mip_ptr - (uint8_t *)addr;
- /*
- * could get mip offset directly but need call above to
- * invoke tiled->linear conversion.
- */
- assert(lp_tex->mip_offsets[j] == mip_offsets[j]);
+ mip_offsets[j] = lp_tex->mip_offsets[j];
row_stride[j] = lp_tex->row_stride[j];
img_stride[j] = lp_tex->img_stride[j];
}
@@ -271,8 +258,7 @@ prepare_shader_sampling(
}
else {
unsigned view_blocksize = util_format_get_blocksize(view->format);
- mip_ptr = lp_tex->data;
- addr = mip_ptr;
+ addr = lp_tex->data;
/* probably don't really need to fill that out */
mip_offsets[0] = 0;
row_stride[0] = 0;
@@ -310,7 +296,7 @@ prepare_shader_sampling(
}
}
}
-
+
/**
* Called during state validation when LP_NEW_SAMPLER_VIEW is set.