diff options
author | Henri Verbeet <hverbeet@gmail.com> | 2011-01-19 19:11:05 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2011-01-19 21:47:27 -0700 |
commit | 21148e6a8806736b4487da41b01e2d3c01cbc743 (patch) | |
tree | ab747977253b5026aaaa6867df14a09280fadd02 /src/gallium/drivers/softpipe/sp_tex_sample.c | |
parent | 54fdc351ddbda68bd6ef75021dafcdf8654a4342 (diff) |
softpipe: Bind samplers to views instead of the underlying resource.
Signed-off-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_tex_sample.c')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_tex_sample.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index cbc40d4b44..242c27c7eb 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -550,7 +550,7 @@ compute_lambda_1d(const struct sp_sampler_variant *samp, const float t[QUAD_SIZE], const float p[QUAD_SIZE]) { - const struct pipe_resource *texture = samp->texture; + const struct pipe_resource *texture = samp->view->texture; float dsdx = fabsf(s[QUAD_BOTTOM_RIGHT] - s[QUAD_BOTTOM_LEFT]); float dsdy = fabsf(s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]); float rho = MAX2(dsdx, dsdy) * texture->width0; @@ -565,7 +565,7 @@ compute_lambda_2d(const struct sp_sampler_variant *samp, const float t[QUAD_SIZE], const float p[QUAD_SIZE]) { - const struct pipe_resource *texture = samp->texture; + const struct pipe_resource *texture = samp->view->texture; float dsdx = fabsf(s[QUAD_BOTTOM_RIGHT] - s[QUAD_BOTTOM_LEFT]); float dsdy = fabsf(s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]); float dtdx = fabsf(t[QUAD_BOTTOM_RIGHT] - t[QUAD_BOTTOM_LEFT]); @@ -584,7 +584,7 @@ compute_lambda_3d(const struct sp_sampler_variant *samp, const float t[QUAD_SIZE], const float p[QUAD_SIZE]) { - const struct pipe_resource *texture = samp->texture; + const struct pipe_resource *texture = samp->view->texture; float dsdx = fabsf(s[QUAD_BOTTOM_RIGHT] - s[QUAD_BOTTOM_LEFT]); float dsdy = fabsf(s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]); float dtdx = fabsf(t[QUAD_BOTTOM_RIGHT] - t[QUAD_BOTTOM_LEFT]); @@ -654,7 +654,7 @@ static INLINE const float * get_texel_2d(const struct sp_sampler_variant *samp, union tex_tile_address addr, int x, int y) { - const struct pipe_resource *texture = samp->texture; + const struct pipe_resource *texture = samp->view->texture; unsigned level = addr.bits.level; if (x < 0 || x >= (int) u_minify(texture->width0, level) || @@ -747,7 +747,7 @@ static INLINE const float * get_texel_3d(const struct sp_sampler_variant *samp, union tex_tile_address addr, int x, int y, int z) { - const struct pipe_resource *texture = samp->texture; + const struct pipe_resource *texture = samp->view->texture; unsigned level = addr.bits.level; if (x < 0 || x >= (int) u_minify(texture->width0, level) || @@ -959,7 +959,7 @@ img_filter_1d_nearest(struct tgsi_sampler *tgsi_sampler, float rgba[NUM_CHANNELS][QUAD_SIZE]) { const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); - const struct pipe_resource *texture = samp->texture; + const struct pipe_resource *texture = samp->view->texture; unsigned level0, j; int width; int x[4]; @@ -999,7 +999,7 @@ img_filter_2d_nearest(struct tgsi_sampler *tgsi_sampler, float rgba[NUM_CHANNELS][QUAD_SIZE]) { const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); - const struct pipe_resource *texture = samp->texture; + const struct pipe_resource *texture = samp->view->texture; unsigned level0, j; int width, height; int x[4], y[4]; @@ -1051,7 +1051,7 @@ img_filter_cube_nearest(struct tgsi_sampler *tgsi_sampler, float rgba[NUM_CHANNELS][QUAD_SIZE]) { const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); - const struct pipe_resource *texture = samp->texture; + const struct pipe_resource *texture = samp->view->texture; const unsigned *faces = samp->faces; /* zero when not cube-mapping */ unsigned level0, j; int width, height; @@ -1095,7 +1095,7 @@ img_filter_3d_nearest(struct tgsi_sampler *tgsi_sampler, float rgba[NUM_CHANNELS][QUAD_SIZE]) { const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); - const struct pipe_resource *texture = samp->texture; + const struct pipe_resource *texture = samp->view->texture; unsigned level0, j; int width, height, depth; int x[4], y[4], z[4]; @@ -1137,7 +1137,7 @@ img_filter_1d_linear(struct tgsi_sampler *tgsi_sampler, float rgba[NUM_CHANNELS][QUAD_SIZE]) { const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); - const struct pipe_resource *texture = samp->texture; + const struct pipe_resource *texture = samp->view->texture; unsigned level0, j; int width; int x0[4], x1[4]; @@ -1177,7 +1177,7 @@ img_filter_2d_linear(struct tgsi_sampler *tgsi_sampler, float rgba[NUM_CHANNELS][QUAD_SIZE]) { const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); - const struct pipe_resource *texture = samp->texture; + const struct pipe_resource *texture = samp->view->texture; unsigned level0, j; int width, height; int x0[4], y0[4], x1[4], y1[4]; @@ -1224,7 +1224,7 @@ img_filter_cube_linear(struct tgsi_sampler *tgsi_sampler, float rgba[NUM_CHANNELS][QUAD_SIZE]) { const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); - const struct pipe_resource *texture = samp->texture; + const struct pipe_resource *texture = samp->view->texture; const unsigned *faces = samp->faces; /* zero when not cube-mapping */ unsigned level0, j; int width, height; @@ -1273,7 +1273,7 @@ img_filter_3d_linear(struct tgsi_sampler *tgsi_sampler, float rgba[NUM_CHANNELS][QUAD_SIZE]) { const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); - const struct pipe_resource *texture = samp->texture; + const struct pipe_resource *texture = samp->view->texture; unsigned level0, j; int width, height, depth; int x0[4], x1[4], y0[4], y1[4], z0[4], z1[4]; @@ -1349,7 +1349,7 @@ mip_filter_linear(struct tgsi_sampler *tgsi_sampler, float rgba[NUM_CHANNELS][QUAD_SIZE]) { struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); - const struct pipe_resource *texture = samp->texture; + const struct pipe_resource *texture = samp->view->texture; int level0; float lambda; float lod[QUAD_SIZE]; @@ -1416,7 +1416,7 @@ mip_filter_nearest(struct tgsi_sampler *tgsi_sampler, float rgba[NUM_CHANNELS][QUAD_SIZE]) { struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); - const struct pipe_resource *texture = samp->texture; + const struct pipe_resource *texture = samp->view->texture; float lambda; float lod[QUAD_SIZE]; @@ -1500,7 +1500,7 @@ mip_filter_linear_2d_linear_repeat_POT( float rgba[NUM_CHANNELS][QUAD_SIZE]) { struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); - const struct pipe_resource *texture = samp->texture; + const struct pipe_resource *texture = samp->view->texture; int level0; float lambda; float lod[QUAD_SIZE]; @@ -1990,13 +1990,14 @@ get_img_filter(const union sp_sampler_key key, * Bind the given texture object and texture cache to the sampler variant. */ void -sp_sampler_variant_bind_texture( struct sp_sampler_variant *samp, - struct softpipe_tex_tile_cache *tex_cache, - const struct pipe_resource *texture ) +sp_sampler_variant_bind_view( struct sp_sampler_variant *samp, + struct softpipe_tex_tile_cache *tex_cache, + const struct pipe_sampler_view *view ) { const struct pipe_sampler_state *sampler = samp->sampler; + const struct pipe_resource *texture = view->texture; - samp->texture = texture; + samp->view = view; samp->cache = tex_cache; samp->xpot = util_unsigned_logbase2( texture->width0 ); samp->ypot = util_unsigned_logbase2( texture->height0 ); |