diff options
author | Brian <brian@i915.localnet.net> | 2007-08-08 16:46:59 -0600 |
---|---|---|
committer | Brian <brian@i915.localnet.net> | 2007-08-08 16:46:59 -0600 |
commit | 5671bba1cb103c00b44905dfa015c3338cb4af56 (patch) | |
tree | 06fbb41b4f8e0ef65c51e4d1d0d348d699e23f01 /src/mesa | |
parent | 8140642f5335eba5a524a7782fa40e6d095b5ada (diff) |
clean-up
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/pipe/softpipe/sp_tex_sample.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/mesa/pipe/softpipe/sp_tex_sample.c b/src/mesa/pipe/softpipe/sp_tex_sample.c index 062d61dea4..dcc9485cf6 100644 --- a/src/mesa/pipe/softpipe/sp_tex_sample.c +++ b/src/mesa/pipe/softpipe/sp_tex_sample.c @@ -495,20 +495,19 @@ sp_get_sample_2d(struct tgsi_sampler *sampler, case PIPE_TEX_FILTER_NEAREST: case PIPE_TEX_FILTER_NEAREST_MIPMAP_NEAREST: { - GLint x, y, cx, cy; - - x = nearest_texcoord(sampler->state->wrap_s, strq[0], - sampler->texture->width0); - y = nearest_texcoord(sampler->state->wrap_t, strq[1], - sampler->texture->height0); - - cx = x / SAMPLER_CACHE_SIZE; - cy = y / SAMPLER_CACHE_SIZE; + GLint x = nearest_texcoord(sampler->state->wrap_s, strq[0], + sampler->texture->level[level0].width); + GLint y = nearest_texcoord(sampler->state->wrap_t, strq[1], + sampler->texture->level[level0].height); + GLint cx = x / SAMPLER_CACHE_SIZE; + GLint cy = y / SAMPLER_CACHE_SIZE; if (cx != sampler->cache_x || cy != sampler->cache_y || level0 != sampler->cache_level) { /* cache miss, replace cache with new tile */ struct pipe_surface *ps = pipe->get_tex_surface(pipe, sampler->texture, 0, level0, 0); + assert(ps->width == sampler->texture->level[level0].width); + assert(ps->height == sampler->texture->level[level0].height); sampler->cache_level = level0; sampler->cache_x = cx; sampler->cache_y = cy; @@ -522,7 +521,7 @@ sp_get_sample_2d(struct tgsi_sampler *sampler, else { /*printf("cache hit (%d, %d)\n", x, y);*/ } - + /* get texel from cache */ cx = x % SAMPLER_CACHE_SIZE; cy = y % SAMPLER_CACHE_SIZE; COPY_4V(rgba, sampler->cache[cy][cx]); |