diff options
author | Roland Scheidegger <[email protected]> | 2014-07-01 02:18:56 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2014-07-02 01:55:59 +0200 |
commit | 7e1521f191afe30fcf02a25b68fbf89278f014d3 (patch) | |
tree | b0ec042ddaf88c59cfaebef29ceac3a78f71ebba | |
parent | b4c3246e7b2e5d8c19bdb6f71efa3cc2b948b1ce (diff) |
llvmpipe: get rid of linear_img struct
Just use a tex_data pointer directly - the description was no longer correct
neither.
Reviewed-by: Brian Paul <[email protected]>
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_sampler.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_texture.c | 39 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_texture.h | 9 |
4 files changed, 19 insertions, 33 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 046611aa736..cbf465e65d1 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -818,7 +818,7 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, */ mip_ptr = llvmpipe_get_texture_image_all(lp_tex, first_level, LP_TEX_USAGE_READ); - jit_tex->base = lp_tex->linear_img.data; + jit_tex->base = lp_tex->tex_data; } else { mip_ptr = lp_tex->data; diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c index 0b227ea2ffe..d204378e556 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c +++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c @@ -244,7 +244,7 @@ prepare_shader_sampling( /* 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->linear_img.data; + addr = lp_tex->tex_data; for (j = first_level; j <= last_level; j++) { mip_ptr = llvmpipe_get_texture_image_all(lp_tex, j, diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index d60d10158de..a156449a002 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -301,9 +301,9 @@ llvmpipe_resource_destroy(struct pipe_screen *pscreen, } else if (llvmpipe_resource_is_texture(pt)) { /* free linear image data */ - if (lpr->linear_img.data) { - align_free(lpr->linear_img.data); - lpr->linear_img.data = NULL; + if (lpr->tex_data) { + align_free(lpr->tex_data); + lpr->tex_data = NULL; } } else if (!lpr->userBuffer) { @@ -359,7 +359,7 @@ llvmpipe_resource_map(struct pipe_resource *resource, map = winsys->displaytarget_map(winsys, lpr->dt, dt_usage); /* install this linear image in texture data structure */ - lpr->linear_img.data = map; + lpr->tex_data = map; return map; } @@ -726,16 +726,14 @@ ubyte * llvmpipe_get_texture_image_address(struct llvmpipe_resource *lpr, unsigned face_slice, unsigned level) { - struct llvmpipe_texture_image *img; unsigned offset; - img = &lpr->linear_img; offset = lpr->mip_offsets[level]; if (face_slice > 0) offset += face_slice * tex_image_face_size(lpr, level); - return (ubyte *) img->data + offset; + return (ubyte *) lpr->tex_data + offset; } @@ -759,7 +757,7 @@ alloc_image_data(struct llvmpipe_resource *lpr) assert(lpr->base.last_level == 0); - lpr->linear_img.data = + lpr->tex_data = winsys->displaytarget_map(winsys, lpr->dt, PIPE_TRANSFER_READ_WRITE); } @@ -774,9 +772,9 @@ alloc_image_data(struct llvmpipe_resource *lpr) lpr->mip_offsets[level] = offset; offset += align(buffer_size, alignment); } - lpr->linear_img.data = align_malloc(offset, alignment); - if (lpr->linear_img.data) { - memset(lpr->linear_img.data, 0, offset); + lpr->tex_data = align_malloc(offset, alignment); + if (lpr->tex_data) { + memset(lpr->tex_data, 0, offset); } } } @@ -795,7 +793,6 @@ llvmpipe_get_texture_image(struct llvmpipe_resource *lpr, unsigned face_slice, unsigned level, enum lp_texture_usage usage) { - struct llvmpipe_texture_image *target_img; void *target_data; unsigned target_offset; unsigned *target_off_ptr; @@ -805,17 +802,14 @@ llvmpipe_get_texture_image(struct llvmpipe_resource *lpr, usage == LP_TEX_USAGE_WRITE_ALL); if (lpr->dt) { - assert(lpr->linear_img.data); + assert(lpr->tex_data); } - target_img = &lpr->linear_img; target_off_ptr = lpr->mip_offsets; - target_data = target_img->data; - if (!target_data) { + if (!lpr->tex_data) { /* allocate memory for the target image now */ alloc_image_data(lpr); - target_data = target_img->data; } target_offset = target_off_ptr[level]; @@ -824,8 +818,8 @@ llvmpipe_get_texture_image(struct llvmpipe_resource *lpr, target_offset += face_slice * tex_image_face_size(lpr, level); } - if (target_data) { - target_data = (uint8_t *) target_data + target_offset; + if (lpr->tex_data) { + target_data = (uint8_t *) lpr->tex_data + target_offset; } return target_data; @@ -865,19 +859,18 @@ llvmpipe_get_texture_tile_linear(struct llvmpipe_resource *lpr, enum lp_texture_usage usage, unsigned x, unsigned y) { - struct llvmpipe_texture_image *linear_img = &lpr->linear_img; uint8_t *linear_image; assert(llvmpipe_resource_is_texture(&lpr->base)); assert(x % TILE_SIZE == 0); assert(y % TILE_SIZE == 0); - if (!linear_img->data) { + if (!lpr->tex_data) { /* allocate memory for the linear image now */ /* XXX should probably not do that here? */ alloc_image_data(lpr); } - assert(linear_img->data); + assert(lpr->tex_data); /* compute address of the slice/face of the image that contains the tile */ linear_image = llvmpipe_get_texture_image_address(lpr, face_slice, level); @@ -897,7 +890,7 @@ llvmpipe_resource_size(const struct pipe_resource *resource) if (llvmpipe_resource_is_texture(resource)) { for (lvl = 0; lvl <= lpr->base.last_level; lvl++) { - if (lpr->linear_img.data) + if (lpr->tex_data) size += tex_image_size(lpr, lvl); } } diff --git a/src/gallium/drivers/llvmpipe/lp_texture.h b/src/gallium/drivers/llvmpipe/lp_texture.h index e26d044421f..07319189338 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.h +++ b/src/gallium/drivers/llvmpipe/lp_texture.h @@ -49,13 +49,6 @@ struct llvmpipe_context; struct sw_displaytarget; -/** A 1D/2D/3D image, one mipmap level */ -struct llvmpipe_texture_image -{ - void *data; -}; - - /** * llvmpipe subclass of pipe_resource. A texture, drawing surface, * vertex buffer, const buffer, etc. @@ -85,7 +78,7 @@ struct llvmpipe_resource /** * Malloc'ed data for regular textures, or a mapping to dt above. */ - struct llvmpipe_texture_image linear_img; + void *tex_data; /** * Data for non-texture resources. |