diff options
Diffstat (limited to 'src/gallium/state_trackers/python')
-rw-r--r-- | src/gallium/state_trackers/python/p_context.i | 55 | ||||
-rw-r--r-- | src/gallium/state_trackers/python/p_state.i | 6 | ||||
-rw-r--r-- | src/gallium/state_trackers/python/p_texture.i | 18 | ||||
-rw-r--r-- | src/gallium/state_trackers/python/st_device.c | 3 | ||||
-rw-r--r-- | src/gallium/state_trackers/python/st_device.h | 15 | ||||
-rw-r--r-- | src/gallium/state_trackers/python/st_sample.c | 3 |
6 files changed, 48 insertions, 52 deletions
diff --git a/src/gallium/state_trackers/python/p_context.i b/src/gallium/state_trackers/python/p_context.i index 40c4603fb9..5bdeaa8e4e 100644 --- a/src/gallium/state_trackers/python/p_context.i +++ b/src/gallium/state_trackers/python/p_context.i @@ -132,6 +132,8 @@ struct st_context { enum pipe_format format = PIPE_FORMAT_NONE, unsigned first_level = 0, unsigned last_level = ~0, + unsigned first_layer = 0, + unsigned last_layer = ~0, unsigned swizzle_r = 0, unsigned swizzle_g = 1, unsigned swizzle_b = 2, @@ -146,9 +148,10 @@ struct st_context { } else { templat.format = format; } - templat.last_level = MIN2(last_level, texture->last_level); - templat.first_level = first_level; - templat.last_level = last_level; + templat.u.tex.last_level = MIN2(last_level, texture->last_level); + templat.u.tex.first_level = first_level; + templat.u.tex.first_layer = first_layer; + templat.u.tex.last_layer = last_layer; templat.swizzle_r = swizzle_r; templat.swizzle_g = swizzle_g; templat.swizzle_b = swizzle_b; @@ -412,17 +415,15 @@ error1: */ void resource_copy_region(struct pipe_resource *dst, - struct pipe_subresource subdst, + unsigned dst_level, unsigned dstx, unsigned dsty, unsigned dstz, struct pipe_resource *src, - struct pipe_subresource subsrc, - unsigned srcx, unsigned srcy, unsigned srcz, - unsigned width, unsigned height) + unsigned src_level, + const struct pipe_box *src_box) { $self->pipe->resource_copy_region($self->pipe, - dst, subdst, dstx, dsty, dstz, - src, subsrc, srcx, srcy, srcz, - width, height); + dst, dst_level, dstx, dsty, dstz, + src, src_level, src_box); } @@ -433,7 +434,7 @@ error1: { struct pipe_surface *_dst = NULL; - _dst = st_pipe_surface(dst, PIPE_BIND_RENDER_TARGET); + _dst = st_pipe_surface($self->pipe, dst, PIPE_BIND_RENDER_TARGET); if(!_dst) SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing"); @@ -452,7 +453,7 @@ error1: { struct pipe_surface *_dst = NULL; - _dst = st_pipe_surface(dst, PIPE_BIND_DEPTH_STENCIL); + _dst = st_pipe_surface($self->pipe, dst, PIPE_BIND_DEPTH_STENCIL); if(!_dst) SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing"); @@ -482,9 +483,8 @@ error1: transfer = pipe_get_transfer(pipe, surface->texture, - surface->face, surface->level, - surface->zslice, + surface->layer, PIPE_TRANSFER_READ, x, y, w, h); if(transfer) { @@ -511,9 +511,8 @@ error1: transfer = pipe_get_transfer(pipe, surface->texture, - surface->face, surface->level, - surface->zslice, + surface->layer, PIPE_TRANSFER_WRITE, x, y, w, h); if(!transfer) @@ -535,9 +534,8 @@ error1: struct pipe_transfer *transfer; transfer = pipe_get_transfer(pipe, surface->texture, - surface->face, surface->level, - surface->zslice, + surface->layer, PIPE_TRANSFER_READ, x, y, w, h); if(transfer) { @@ -555,9 +553,8 @@ error1: struct pipe_transfer *transfer; transfer = pipe_get_transfer(pipe, surface->texture, - surface->face, surface->level, - surface->zslice, + surface->layer, PIPE_TRANSFER_WRITE, x, y, w, h); if(transfer) { @@ -597,9 +594,8 @@ error1: transfer = pipe_get_transfer(pipe, surface->texture, - surface->face, surface->level, - surface->zslice, + surface->layer, PIPE_TRANSFER_READ, x, y, w, h); if(transfer) { @@ -624,9 +620,8 @@ error1: struct pipe_transfer *transfer; transfer = pipe_get_transfer(pipe, surface->texture, - surface->face, surface->level, - surface->zslice, + surface->layer, PIPE_TRANSFER_READ, x, y, w, h); if(transfer) { @@ -644,9 +639,8 @@ error1: struct pipe_transfer *transfer; transfer = pipe_get_transfer(pipe, surface->texture, - surface->face, surface->level, - surface->zslice, + surface->layer, PIPE_TRANSFER_WRITE, x, y, w, h); if(transfer) { @@ -681,9 +675,8 @@ error1: transfer = pipe_get_transfer(pipe, surface->texture, - surface->face, surface->level, - surface->zslice, + surface->layer, PIPE_TRANSFER_READ, x, y, w, h); if(!transfer) { @@ -715,16 +708,16 @@ error1: %cstring_input_binary(const char *STRING, unsigned LENGTH); void transfer_inline_write(struct pipe_resource *resource, - struct pipe_subresource *sr, + unsigned level, unsigned usage, const struct pipe_box *box, const char *STRING, unsigned LENGTH, unsigned stride, - unsigned slice_stride) + unsigned layer_stride) { struct pipe_context *pipe = $self->pipe; - pipe->transfer_inline_write(pipe, resource, *sr, usage, box, STRING, stride, slice_stride); + pipe->transfer_inline_write(pipe, resource, level, usage, box, STRING, stride, layer_stride); } %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1)); diff --git a/src/gallium/state_trackers/python/p_state.i b/src/gallium/state_trackers/python/p_state.i index c1e6ea1b43..0537557661 100644 --- a/src/gallium/state_trackers/python/p_state.i +++ b/src/gallium/state_trackers/python/p_state.i @@ -114,7 +114,8 @@ SWIG_exception(SWIG_ValueError, "index out of bounds"); if(surface) { - _surface = st_pipe_surface(surface, PIPE_BIND_RENDER_TARGET); + /* XXX need a context here */ + _surface = st_pipe_surface(NULL, surface, PIPE_BIND_RENDER_TARGET); if(!_surface) SWIG_exception(SWIG_ValueError, "couldn't acquire surface for writing"); } @@ -131,7 +132,8 @@ struct pipe_surface *_surface = NULL; if(surface) { - _surface = st_pipe_surface(surface, PIPE_BIND_DEPTH_STENCIL); + /* XXX need a context here */ + _surface = st_pipe_surface(NULL, surface, PIPE_BIND_DEPTH_STENCIL); if(!_surface) SWIG_exception(SWIG_ValueError, "couldn't acquire surface for writing"); } diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index ae506944c4..1f4b4fd596 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -42,9 +42,8 @@ %ignore pipe_resource::screen; %immutable st_surface::texture; -%immutable st_surface::face; %immutable st_surface::level; -%immutable st_surface::zslice; +%immutable st_surface::layer; %newobject pipe_resource::get_surface; @@ -73,25 +72,23 @@ /** Get a surface which is a "view" into a texture */ struct st_surface * - get_surface(unsigned face=0, unsigned level=0, unsigned zslice=0) + get_surface(unsigned level=0, unsigned layer=0) { struct st_surface *surface; - if(face >= ($self->target == PIPE_TEXTURE_CUBE ? 6U : 1U)) - SWIG_exception(SWIG_ValueError, "face out of bounds"); if(level > $self->last_level) SWIG_exception(SWIG_ValueError, "level out of bounds"); - if(zslice >= u_minify($self->depth0, level)) - SWIG_exception(SWIG_ValueError, "zslice out of bounds"); + if(layer >= ($self->target == PIPE_TEXTURE_3D ? + u_minify($self->depth0, level) : $self->depth0)) + SWIG_exception(SWIG_ValueError, "layer out of bounds"); surface = CALLOC_STRUCT(st_surface); if(!surface) return NULL; pipe_resource_reference(&surface->texture, $self); - surface->face = face; surface->level = level; - surface->zslice = zslice; + surface->layer = layer; return surface; @@ -113,9 +110,8 @@ struct st_surface %immutable; struct pipe_resource *texture; - unsigned face; unsigned level; - unsigned zslice; + unsigned layer; }; diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c index 29813456b5..d0a4295c7a 100644 --- a/src/gallium/state_trackers/python/st_device.c +++ b/src/gallium/state_trackers/python/st_device.c @@ -240,6 +240,7 @@ st_context_create(struct st_device *st_dev) templat.width0 = 1; templat.height0 = 1; templat.depth0 = 1; + templat.array_size = 1; templat.last_level = 0; templat.bind = PIPE_BIND_SAMPLER_VIEW; @@ -252,7 +253,7 @@ st_context_create(struct st_device *st_dev) pipe->transfer_inline_write(pipe, st_ctx->default_texture, - u_subresource(0,0), + 0, PIPE_TRANSFER_WRITE, &box, &zero, diff --git a/src/gallium/state_trackers/python/st_device.h b/src/gallium/state_trackers/python/st_device.h index 2dca7a1974..53e2556cb0 100644 --- a/src/gallium/state_trackers/python/st_device.h +++ b/src/gallium/state_trackers/python/st_device.h @@ -41,9 +41,8 @@ struct st_winsys; struct st_surface { struct pipe_resource *texture; - unsigned face; unsigned level; - unsigned zslice; + unsigned layer; }; @@ -83,11 +82,17 @@ struct st_device static INLINE struct pipe_surface * -st_pipe_surface(struct st_surface *surface, unsigned usage) +st_pipe_surface(struct pipe_context *pipe, struct st_surface *surface, unsigned usage) { struct pipe_resource *texture = surface->texture; - struct pipe_screen *screen = texture->screen; - return screen->get_tex_surface(screen, texture, surface->face, surface->level, surface->zslice, usage); + struct pipe_surface surf_tmpl; + memset(&surf_tmpl, 0, sizeof(surf_tmpl)); + surf_tmpl.format = texture->format; + surf_tmpl.usage = usage; + surf_tmpl.u.tex.level = surface->level; + surf_tmpl.u.tex.first_layer = surface->layer; + surf_tmpl.u.tex.last_layer = surface->layer; + return pipe->create_surface(pipe, texture, &surf_tmpl); } struct st_context * diff --git a/src/gallium/state_trackers/python/st_sample.c b/src/gallium/state_trackers/python/st_sample.c index 25bfbf1ab7..cac9a1a620 100644 --- a/src/gallium/state_trackers/python/st_sample.c +++ b/src/gallium/state_trackers/python/st_sample.c @@ -555,9 +555,8 @@ st_sample_surface(struct pipe_context *pipe, transfer = pipe_get_transfer(pipe, surface->texture, - surface->face, surface->level, - surface->zslice, + surface->layer, PIPE_TRANSFER_WRITE, 0, 0, width, |