diff options
author | José Fonseca <jfonseca@vmware.com> | 2009-03-30 16:02:21 +0100 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2009-03-30 17:19:10 +0100 |
commit | 28de69d6819eab289a400482d15797b662e4d633 (patch) | |
tree | 7e55515a03d72ae68872bfd373d3607a5ebc0edc /src/gallium/state_trackers/python/st_sample.c | |
parent | 68342f9036d3c94ee50c4cbe5c7b36439eeb6825 (diff) |
python: Set the surface GPU access flags.
Make python surface just a dumb (texture, face, level, zslice) tuple.
Diffstat (limited to 'src/gallium/state_trackers/python/st_sample.c')
-rw-r--r-- | src/gallium/state_trackers/python/st_sample.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/gallium/state_trackers/python/st_sample.c b/src/gallium/state_trackers/python/st_sample.c index c2ffe9fce1..70ca16c23d 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; @@ -537,25 +541,25 @@ st_sample_surface(struct pipe_surface *surface, float *rgba) surface->zslice, PIPE_TRANSFER_READ, 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)); } } |