summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-09-17 13:19:52 -0600
committerBrian Paul <[email protected]>2011-09-20 20:17:42 -0600
commitf63dbc600fa95601ca8239ed5e3c3e439fe4565f (patch)
tree799d9cdc13c16eeecbfd5ffad868ad8247b518f1
parent1e939f53749781312b1b3b729e2d73493ae6b304 (diff)
gallium/util: observe sampler view's first_level in util_blit_pixels_tex()
This lets us blit from a non-zero source level.
-rw-r--r--src/gallium/auxiliary/util/u_blit.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
index 421726b40e0..87530e94a5a 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -660,8 +660,8 @@ void util_blit_flush( struct blit_state *ctx )
/**
* Copy pixel block from src texture to dst surface.
- *
- * XXX Should support selection of level.
+ * The sampler view's first_level field indicates the source
+ * mipmap level to use.
* XXX need some control over blitting Z and/or stencil.
*/
void
@@ -694,10 +694,14 @@ util_blit_pixels_tex(struct blit_state *ctx,
if(normalized)
{
- s0 /= (float)tex->width0;
- s1 /= (float)tex->width0;
- t0 /= (float)tex->height0;
- t1 /= (float)tex->height0;
+ /* normalize according to the mipmap level's size */
+ int level = src_sampler_view->u.tex.first_level;
+ float w = (float) u_minify(tex->width0, level);
+ float h = (float) u_minify(tex->height0, level);
+ s0 /= w;
+ s1 /= w;
+ t0 /= h;
+ t1 /= h;
}
assert(ctx->pipe->screen->is_format_supported(ctx->pipe->screen, dst->format,