diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2009-04-10 17:16:08 -0400 |
---|---|---|
committer | Alex Deucher <alexdeucher@gmail.com> | 2009-04-10 17:16:08 -0400 |
commit | 04f335fd16c2a13b9425797acf5c3989cb6def7f (patch) | |
tree | 9e92cecb0b2ac512fac1fc4ef911878849eaeb42 /src/gallium/state_trackers/python/st_sample.c | |
parent | c0419f190c836130932164ac47cfb53de668d423 (diff) | |
parent | 5e361c47abf2ee20140628d327eda9b39351d415 (diff) |
Merge branch 'radeon-rewrite' of git+ssh://agd5f@git.freedesktop.org/git/mesa/mesa into r6xx-rewrite
Diffstat (limited to 'src/gallium/state_trackers/python/st_sample.c')
-rw-r--r-- | src/gallium/state_trackers/python/st_sample.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/gallium/state_trackers/python/st_sample.c b/src/gallium/state_trackers/python/st_sample.c index c2ffe9fce1..53a01891e1 100644 --- a/src/gallium/state_trackers/python/st_sample.c +++ b/src/gallium/state_trackers/python/st_sample.c @@ -34,6 +34,7 @@ #include "util/u_math.h" #include "util/u_memory.h" +#include "st_device.h" #include "st_sample.h" @@ -523,10 +524,13 @@ st_sample_pixel_block(enum pipe_format format, void -st_sample_surface(struct pipe_surface *surface, float *rgba) +st_sample_surface(struct st_surface *surface, float *rgba) { - struct pipe_screen *screen = surface->texture->screen; - uint rgba_stride = surface->width * 4; + struct pipe_texture *texture = surface->texture; + struct pipe_screen *screen = texture->screen; + unsigned width = texture->width[surface->level]; + unsigned height = texture->height[surface->level]; + uint rgba_stride = width * 4; struct pipe_transfer *transfer; void *raw; @@ -535,27 +539,27 @@ st_sample_surface(struct pipe_surface *surface, float *rgba) surface->face, surface->level, surface->zslice, - PIPE_TRANSFER_READ, + PIPE_TRANSFER_WRITE, 0, 0, - surface->width, - surface->height); + width, + height); if (!transfer) return; raw = screen->transfer_map(screen, transfer); if (raw) { - const struct pipe_format_block *block = &transfer->block; + const struct pipe_format_block *block = &texture->block; uint x, y; for (y = 0; y < transfer->nblocksy; ++y) { for (x = 0; x < transfer->nblocksx; ++x) { - st_sample_pixel_block(surface->format, + st_sample_pixel_block(texture->format, block, (uint8_t *) raw + y * transfer->stride + x * block->size, rgba + y * block->height * rgba_stride + x * block->width * 4, rgba_stride, - MIN2(block->width, surface->width - x*block->width), - MIN2(block->height, surface->height - y*block->height)); + MIN2(block->width, width - x*block->width), + MIN2(block->height, height - y*block->height)); } } |