summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2014-07-01 03:09:44 +0200
committerRoland Scheidegger <[email protected]>2014-07-02 01:55:59 +0200
commitaa1ab8173dfe73692cf65af401e7345ec78bb313 (patch)
tree0d6240f91f011253574677478e547174da46a39f /src
parent90abdc15414f44862a82fe2e53e5419f8182b9ac (diff)
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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c24
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_sampler.c20
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c23
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.h5
4 files changed, 7 insertions, 65 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index cbf465e65d1..d728e85dcb6 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -802,7 +802,6 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
if (!lp_tex->dt) {
/* regular texture - setup array of mipmap level offsets */
- void *mip_ptr;
int j;
unsigned first_level = 0;
unsigned last_level = 0;
@@ -812,22 +811,14 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
last_level = view->u.tex.last_level;
assert(first_level <= last_level);
assert(last_level <= res->last_level);
-
- /*
- * The complexity here should no longer be necessary.
- */
- mip_ptr = llvmpipe_get_texture_image_all(lp_tex, first_level,
- LP_TEX_USAGE_READ);
jit_tex->base = lp_tex->tex_data;
}
else {
- mip_ptr = lp_tex->data;
- jit_tex->base = mip_ptr;
+ jit_tex->base = lp_tex->data;
}
- if ((LP_PERF & PERF_TEX_MEM) || !mip_ptr) {
- /* out of memory - use dummy tile memory */
- /* Note if using PERF_TEX_MEM will also skip tile conversion */
+ if (LP_PERF & PERF_TEX_MEM) {
+ /* use dummy tile memory */
jit_tex->base = lp_dummy_tile;
jit_tex->width = TILE_SIZE/8;
jit_tex->height = TILE_SIZE/8;
@@ -847,14 +838,7 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
if (llvmpipe_resource_is_texture(res)) {
for (j = first_level; j <= last_level; j++) {
- mip_ptr = llvmpipe_get_texture_image_all(lp_tex, j,
- LP_TEX_USAGE_READ);
- jit_tex->mip_offsets[j] = (uint8_t *)mip_ptr - (uint8_t *)jit_tex->base;
- /*
- * could get mip offset directly but need call above to
- * invoke tiled->linear conversion.
- */
- assert(lp_tex->mip_offsets[j] == jit_tex->mip_offsets[j]);
+ jit_tex->mip_offsets[j] = lp_tex->mip_offsets[j];
jit_tex->row_stride[j] = lp_tex->row_stride[j];
jit_tex->img_stride[j] = lp_tex->img_stride[j];
}
diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
index d204378e556..a14a64f9a3d 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.
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index f95b2a2b47e..f5383dc6255 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -834,29 +834,6 @@ llvmpipe_get_texture_image(struct llvmpipe_resource *lpr,
/**
- * Return pointer to start of a texture image (1D, 2D, 3D, CUBE).
- * This is typically used when we're about to sample from a texture.
- */
-void *
-llvmpipe_get_texture_image_all(struct llvmpipe_resource *lpr,
- unsigned level,
- enum lp_texture_usage usage)
-{
- const int slices = lpr->num_slices_faces[level];
- int slice;
- void *map = NULL;
-
- assert(slices > 0);
-
- for (slice = slices - 1; slice >= 0; slice--) {
- map = llvmpipe_get_texture_image(lpr, slice, level, usage);
- }
-
- return map;
-}
-
-
-/**
* Get pointer to a linear image (not the tile!) at tile (x,y).
* \return pointer to start of image/face (not the tile)
*/
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.h b/src/gallium/drivers/llvmpipe/lp_texture.h
index 07319189338..5eb0f5ab07e 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.h
+++ b/src/gallium/drivers/llvmpipe/lp_texture.h
@@ -222,11 +222,6 @@ llvmpipe_get_texture_image(struct llvmpipe_resource *resource,
unsigned face_slice, unsigned level,
enum lp_texture_usage usage);
-void *
-llvmpipe_get_texture_image_all(struct llvmpipe_resource *lpr,
- unsigned level,
- enum lp_texture_usage usage);
-
ubyte *
llvmpipe_get_texture_tile_linear(struct llvmpipe_resource *lpr,
unsigned face_slice, unsigned level,