diff options
Diffstat (limited to 'src/gallium/state_trackers/python')
-rw-r--r-- | src/gallium/state_trackers/python/SConscript | 3 | ||||
-rw-r--r-- | src/gallium/state_trackers/python/gallium.i | 1 | ||||
-rw-r--r-- | src/gallium/state_trackers/python/p_context.i | 320 | ||||
-rw-r--r-- | src/gallium/state_trackers/python/p_texture.i | 228 | ||||
-rw-r--r-- | src/gallium/state_trackers/python/st_device.c | 54 | ||||
-rw-r--r-- | src/gallium/state_trackers/python/st_device.h | 4 | ||||
-rw-r--r-- | src/gallium/state_trackers/python/st_sample.c | 29 | ||||
-rw-r--r-- | src/gallium/state_trackers/python/st_sample.h | 7 | ||||
-rw-r--r-- | src/gallium/state_trackers/python/st_softpipe_winsys.c | 2 |
9 files changed, 368 insertions, 280 deletions
diff --git a/src/gallium/state_trackers/python/SConscript b/src/gallium/state_trackers/python/SConscript index d0d141fd24..781f54bf2b 100644 --- a/src/gallium/state_trackers/python/SConscript +++ b/src/gallium/state_trackers/python/SConscript @@ -3,8 +3,7 @@ import os.path Import('*') -if 'python' in env['statetrackers'] and 0: - # FIXME: Disable python state tracker until transfers are done by contexts +if 'python' in env['statetrackers']: env = env.Clone() diff --git a/src/gallium/state_trackers/python/gallium.i b/src/gallium/state_trackers/python/gallium.i index ffb084e358..632d71ccbe 100644 --- a/src/gallium/state_trackers/python/gallium.i +++ b/src/gallium/state_trackers/python/gallium.i @@ -49,6 +49,7 @@ #include "util/u_format.h" #include "util/u_dump.h" #include "util/u_memory.h" +#include "util/u_sampler.h" #include "cso_cache/cso_context.h" #include "tgsi/tgsi_text.h" #include "tgsi/tgsi_dump.h" diff --git a/src/gallium/state_trackers/python/p_context.i b/src/gallium/state_trackers/python/p_context.i index 5c44462e80..bccaeead01 100644 --- a/src/gallium/state_trackers/python/p_context.i +++ b/src/gallium/state_trackers/python/p_context.i @@ -169,22 +169,39 @@ struct st_context { void set_fragment_sampler_texture(unsigned index, struct pipe_texture *texture) { + struct pipe_sampler_view templ; + if(!texture) texture = $self->default_texture; - pipe_texture_reference(&$self->fragment_sampler_textures[index], texture); - $self->pipe->set_fragment_sampler_textures($self->pipe, - PIPE_MAX_SAMPLERS, - $self->fragment_sampler_textures); + pipe_sampler_view_reference(&$self->fragment_sampler_views[index], NULL); + u_sampler_view_default_template(&templ, + texture, + texture->format); + $self->fragment_sampler_views[index] = $self->pipe->create_sampler_view($self->pipe, + texture, + &templ); + $self->pipe->set_fragment_sampler_views($self->pipe, + PIPE_MAX_SAMPLERS, + $self->fragment_sampler_views); } void set_vertex_sampler_texture(unsigned index, struct pipe_texture *texture) { + struct pipe_sampler_view templ; + if(!texture) texture = $self->default_texture; - pipe_texture_reference(&$self->vertex_sampler_textures[index], texture); - $self->pipe->set_vertex_sampler_textures($self->pipe, - PIPE_MAX_VERTEX_SAMPLERS, - $self->vertex_sampler_textures); + pipe_sampler_view_reference(&$self->vertex_sampler_views[index], NULL); + u_sampler_view_default_template(&templ, + texture, + texture->format); + $self->vertex_sampler_views[index] = $self->pipe->create_sampler_view($self->pipe, + texture, + &templ); + + $self->pipe->set_vertex_sampler_views($self->pipe, + PIPE_MAX_VERTEX_SAMPLERS, + $self->vertex_sampler_views); } void set_vertex_buffer(unsigned index, @@ -263,8 +280,11 @@ struct st_context { struct pipe_context *pipe = $self->pipe; struct pipe_screen *screen = pipe->screen; struct pipe_buffer *vbuf; + struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS]; + struct pipe_vertex_buffer vbuffer; float *map; unsigned size; + unsigned i; size = num_verts * num_attribs * 4 * sizeof(float); @@ -280,9 +300,31 @@ struct st_context { goto error2; memcpy(map, vertices, size); pipe_buffer_unmap(screen, vbuf); - - util_draw_vertex_buffer(pipe, vbuf, 0, prim, num_verts, num_attribs); - + + cso_save_vertex_elements($self->cso); + + /* tell pipe about the vertex attributes */ + for (i = 0; i < num_attribs; i++) { + velements[i].src_offset = i * 4 * sizeof(float); + velements[i].instance_divisor = 0; + velements[i].vertex_buffer_index = 0; + velements[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; + } + cso_set_vertex_elements($self->cso, num_attribs, velements); + + /* tell pipe about the vertex buffer */ + memset(&vbuffer, 0, sizeof(vbuffer)); + vbuffer.buffer = vbuf; + vbuffer.stride = num_attribs * 4 * sizeof(float); /* vertex size */ + vbuffer.buffer_offset = 0; + vbuffer.max_index = num_verts - 1; + pipe->set_vertex_buffers(pipe, 1, &vbuffer); + + /* draw */ + pipe->draw_arrays(pipe, prim, 0, num_verts); + + cso_restore_vertex_elements($self->cso); + error2: pipe_buffer_reference(&vbuf, NULL); error1: @@ -290,6 +332,13 @@ error1: } void + clear(unsigned buffers, const float *rgba, double depth = 0.0f, + unsigned stencil = 0) + { + $self->pipe->clear($self->pipe, buffers, rgba, depth, stencil); + } + + void flush(unsigned flags = 0) { struct pipe_fence_handle *fence = NULL; $self->pipe->flush($self->pipe, flags | PIPE_FLUSH_RENDER_CACHE, &fence); @@ -345,10 +394,253 @@ error1: pipe_surface_reference(&_dst, NULL); } - void clear(unsigned buffers, const float *rgba, double depth = 0.0f, - unsigned stencil = 0) + %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1)); + void + surface_read_raw(struct st_surface *surface, + unsigned x, unsigned y, unsigned w, unsigned h, + char **STRING, int *LENGTH) { - $self->pipe->clear($self->pipe, buffers, rgba, depth, stencil); + struct pipe_texture *texture = surface->texture; + struct pipe_context *pipe = $self->pipe; + struct pipe_transfer *transfer; + unsigned stride; + + stride = util_format_get_stride(texture->format, w); + *LENGTH = util_format_get_nblocksy(texture->format, h) * stride; + *STRING = (char *) malloc(*LENGTH); + if(!*STRING) + return; + + transfer = pipe->get_tex_transfer(pipe, + surface->texture, + surface->face, + surface->level, + surface->zslice, + PIPE_TRANSFER_READ, + x, y, w, h); + if(transfer) { + pipe_get_tile_raw(pipe, transfer, 0, 0, w, h, *STRING, stride); + pipe->tex_transfer_destroy(pipe, transfer); + } + } + + %cstring_input_binary(const char *STRING, unsigned LENGTH); + void + surface_write_raw(struct st_surface *surface, + unsigned x, unsigned y, unsigned w, unsigned h, + const char *STRING, unsigned LENGTH, unsigned stride = 0) + { + struct pipe_texture *texture = surface->texture; + struct pipe_context *pipe = $self->pipe; + struct pipe_transfer *transfer; + + if(stride == 0) + stride = util_format_get_stride(texture->format, w); + + if(LENGTH < util_format_get_nblocksy(texture->format, h) * stride) + SWIG_exception(SWIG_ValueError, "offset must be smaller than buffer size"); + + transfer = pipe->get_tex_transfer(pipe, + surface->texture, + surface->face, + surface->level, + surface->zslice, + PIPE_TRANSFER_WRITE, + x, y, w, h); + if(!transfer) + SWIG_exception(SWIG_MemoryError, "couldn't initiate transfer"); + + pipe_put_tile_raw(pipe, transfer, 0, 0, w, h, STRING, stride); + pipe->tex_transfer_destroy(pipe, transfer); + + fail: + return; + } + + void + surface_read_rgba(struct st_surface *surface, + unsigned x, unsigned y, unsigned w, unsigned h, + float *rgba) + { + struct pipe_context *pipe = $self->pipe; + struct pipe_transfer *transfer; + transfer = pipe->get_tex_transfer(pipe, + surface->texture, + surface->face, + surface->level, + surface->zslice, + PIPE_TRANSFER_READ, + x, y, w, h); + if(transfer) { + pipe_get_tile_rgba(pipe, transfer, 0, 0, w, h, rgba); + pipe->tex_transfer_destroy(pipe, transfer); + } + } + + void + surface_write_rgba(struct st_surface *surface, + unsigned x, unsigned y, unsigned w, unsigned h, + const float *rgba) + { + struct pipe_context *pipe = $self->pipe; + struct pipe_transfer *transfer; + transfer = pipe->get_tex_transfer(pipe, + surface->texture, + surface->face, + surface->level, + surface->zslice, + PIPE_TRANSFER_WRITE, + x, y, w, h); + if(transfer) { + pipe_put_tile_rgba(pipe, transfer, 0, 0, w, h, rgba); + pipe->tex_transfer_destroy(pipe, transfer); + } + } + + %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1)); + void + surface_read_rgba8(struct st_surface *surface, + unsigned x, unsigned y, unsigned w, unsigned h, + char **STRING, int *LENGTH) + { + struct pipe_context *pipe = $self->pipe; + struct pipe_transfer *transfer; + float *rgba; + unsigned char *rgba8; + unsigned i, j, k; + + *LENGTH = 0; + *STRING = NULL; + + if (!surface) + return; + + *LENGTH = h*w*4; + *STRING = (char *) malloc(*LENGTH); + if(!*STRING) + return; + + rgba = malloc(h*w*4*sizeof(float)); + if(!rgba) + return; + + rgba8 = (unsigned char *) *STRING; + + transfer = pipe->get_tex_transfer(pipe, + surface->texture, + surface->face, + surface->level, + surface->zslice, + PIPE_TRANSFER_READ, + x, y, + w, h); + if(transfer) { + pipe_get_tile_rgba(pipe, transfer, 0, 0, w, h, rgba); + for(j = 0; j < h; ++j) { + for(i = 0; i < w; ++i) + for(k = 0; k <4; ++k) + rgba8[j*w*4 + i*4 + k] = float_to_ubyte(rgba[j*w*4 + i*4 + k]); + } + pipe->tex_transfer_destroy(pipe, transfer); + } + + free(rgba); + } + + void + surface_read_z(struct st_surface *surface, + unsigned x, unsigned y, unsigned w, unsigned h, + unsigned *z) + { + struct pipe_context *pipe = $self->pipe; + struct pipe_transfer *transfer; + transfer = pipe->get_tex_transfer(pipe, + surface->texture, + surface->face, + surface->level, + surface->zslice, + PIPE_TRANSFER_READ, + x, y, w, h); + if(transfer) { + pipe_get_tile_z(pipe, transfer, 0, 0, w, h, z); + pipe->tex_transfer_destroy(pipe, transfer); + } + } + + void + surface_write_z(struct st_surface *surface, + unsigned x, unsigned y, unsigned w, unsigned h, + const unsigned *z) + { + struct pipe_context *pipe = $self->pipe; + struct pipe_transfer *transfer; + transfer = pipe->get_tex_transfer(pipe, + surface->texture, + surface->face, + surface->level, + surface->zslice, + PIPE_TRANSFER_WRITE, + x, y, w, h); + if(transfer) { + pipe_put_tile_z(pipe, transfer, 0, 0, w, h, z); + pipe->tex_transfer_destroy(pipe, transfer); + } + } + + void + surface_sample_rgba(struct st_surface *surface, + float *rgba) + { + st_sample_surface($self->pipe, surface, rgba); + } + + unsigned + surface_compare_rgba(struct st_surface *surface, + unsigned x, unsigned y, unsigned w, unsigned h, + const float *rgba, float tol = 0.0) + { + struct pipe_context *pipe = $self->pipe; + struct pipe_transfer *transfer; + float *rgba2; + const float *p1; + const float *p2; + unsigned i, j, n; + + rgba2 = MALLOC(h*w*4*sizeof(float)); + if(!rgba2) + return ~0; + + transfer = pipe->get_tex_transfer(pipe, + surface->texture, + surface->face, + surface->level, + surface->zslice, + PIPE_TRANSFER_READ, + x, y, w, h); + if(!transfer) { + FREE(rgba2); + return ~0; + } + + pipe_get_tile_rgba(pipe, transfer, 0, 0, w, h, rgba2); + pipe->tex_transfer_destroy(pipe, transfer); + + p1 = rgba; + p2 = rgba2; + n = 0; + for(i = h*w; i; --i) { + unsigned differs = 0; + for(j = 4; j; --j) { + float delta = *p2++ - *p1++; + if (delta < -tol || delta > tol) + differs = 1; + } + n += differs; + } + + FREE(rgba2); + + return n; } }; diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index 761587dc53..923a628528 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -124,234 +124,6 @@ struct st_surface FREE($self); } - %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1)); - void get_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, char **STRING, int *LENGTH) - { - struct pipe_texture *texture = $self->texture; - struct pipe_screen *screen = texture->screen; - struct pipe_transfer *transfer; - unsigned stride; - - stride = util_format_get_stride(texture->format, w); - *LENGTH = util_format_get_nblocksy(texture->format, h) * stride; - *STRING = (char *) malloc(*LENGTH); - if(!*STRING) - return; - - transfer = screen->get_tex_transfer(screen, - $self->texture, - $self->face, - $self->level, - $self->zslice, - PIPE_TRANSFER_READ, - x, y, w, h); - if(transfer) { - pipe_get_tile_raw(transfer, 0, 0, w, h, *STRING, stride); - screen->tex_transfer_destroy(transfer); - } - } - - %cstring_input_binary(const char *STRING, unsigned LENGTH); - void put_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, const char *STRING, unsigned LENGTH, unsigned stride = 0) - { - struct pipe_texture *texture = $self->texture; - struct pipe_screen *screen = texture->screen; - struct pipe_transfer *transfer; - - if(stride == 0) - stride = util_format_get_stride(texture->format, w); - - if(LENGTH < util_format_get_nblocksy(texture->format, h) * stride) - SWIG_exception(SWIG_ValueError, "offset must be smaller than buffer size"); - - transfer = screen->get_tex_transfer(screen, - $self->texture, - $self->face, - $self->level, - $self->zslice, - PIPE_TRANSFER_WRITE, - x, y, w, h); - if(!transfer) - SWIG_exception(SWIG_MemoryError, "couldn't initiate transfer"); - - pipe_put_tile_raw(transfer, 0, 0, w, h, STRING, stride); - screen->tex_transfer_destroy(transfer); - - fail: - return; - } - - void - get_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, float *rgba) - { - struct pipe_screen *screen = $self->texture->screen; - struct pipe_transfer *transfer; - transfer = screen->get_tex_transfer(screen, - $self->texture, - $self->face, - $self->level, - $self->zslice, - PIPE_TRANSFER_READ, - x, y, w, h); - if(transfer) { - pipe_get_tile_rgba(transfer, 0, 0, w, h, rgba); - screen->tex_transfer_destroy(transfer); - } - } - - void - put_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, const float *rgba) - { - struct pipe_screen *screen = $self->texture->screen; - struct pipe_transfer *transfer; - transfer = screen->get_tex_transfer(screen, - $self->texture, - $self->face, - $self->level, - $self->zslice, - PIPE_TRANSFER_WRITE, - x, y, w, h); - if(transfer) { - pipe_put_tile_rgba(transfer, 0, 0, w, h, rgba); - screen->tex_transfer_destroy(transfer); - } - } - - %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1)); - void - get_tile_rgba8(unsigned x, unsigned y, unsigned w, unsigned h, char **STRING, int *LENGTH) - { - struct pipe_screen *screen = $self->texture->screen; - struct pipe_transfer *transfer; - float *rgba; - unsigned char *rgba8; - unsigned i, j, k; - - *LENGTH = 0; - *STRING = NULL; - - if (!$self) - return; - - *LENGTH = h*w*4; - *STRING = (char *) malloc(*LENGTH); - if(!*STRING) - return; - - rgba = malloc(h*w*4*sizeof(float)); - if(!rgba) - return; - - rgba8 = (unsigned char *) *STRING; - - transfer = screen->get_tex_transfer(screen, - $self->texture, - $self->face, - $self->level, - $self->zslice, - PIPE_TRANSFER_READ, - x, y, - w, h); - if(transfer) { - pipe_get_tile_rgba(transfer, 0, 0, w, h, rgba); - for(j = 0; j < h; ++j) { - for(i = 0; i < w; ++i) - for(k = 0; k <4; ++k) - rgba8[j*w*4 + i*4 + k] = float_to_ubyte(rgba[j*w*4 + i*4 + k]); - } - screen->tex_transfer_destroy(transfer); - } - - free(rgba); - } - - void - get_tile_z(unsigned x, unsigned y, unsigned w, unsigned h, unsigned *z) - { - struct pipe_screen *screen = $self->texture->screen; - struct pipe_transfer *transfer; - transfer = screen->get_tex_transfer(screen, - $self->texture, - $self->face, - $self->level, - $self->zslice, - PIPE_TRANSFER_READ, - x, y, w, h); - if(transfer) { - pipe_get_tile_z(transfer, 0, 0, w, h, z); - screen->tex_transfer_destroy(transfer); - } - } - - void - put_tile_z(unsigned x, unsigned y, unsigned w, unsigned h, const unsigned *z) - { - struct pipe_screen *screen = $self->texture->screen; - struct pipe_transfer *transfer; - transfer = screen->get_tex_transfer(screen, - $self->texture, - $self->face, - $self->level, - $self->zslice, - PIPE_TRANSFER_WRITE, - x, y, w, h); - if(transfer) { - pipe_put_tile_z(transfer, 0, 0, w, h, z); - screen->tex_transfer_destroy(transfer); - } - } - - void - sample_rgba(float *rgba) { - st_sample_surface($self, rgba); - } - - unsigned - compare_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, const float *rgba, float tol = 0.0) - { - struct pipe_screen *screen = $self->texture->screen; - struct pipe_transfer *transfer; - float *rgba2; - const float *p1; - const float *p2; - unsigned i, j, n; - - rgba2 = MALLOC(h*w*4*sizeof(float)); - if(!rgba2) - return ~0; - - transfer = screen->get_tex_transfer(screen, - $self->texture, - $self->face, - $self->level, - $self->zslice, - PIPE_TRANSFER_READ, - x, y, w, h); - if(!transfer) { - FREE(rgba2); - return ~0; - } - - pipe_get_tile_rgba(transfer, 0, 0, w, h, rgba2); - screen->tex_transfer_destroy(transfer); - - p1 = rgba; - p2 = rgba2; - n = 0; - for(i = h*w; i; --i) { - unsigned differs = 0; - for(j = 4; j; --j) { - float delta = *p2++ - *p1++; - if (delta < -tol || delta > tol) - differs = 1; - } - n += differs; - } - - FREE(rgba2); - - return n; - } }; diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c index 335e8e7f0d..44d65e3fc1 100644 --- a/src/gallium/state_trackers/python/st_device.c +++ b/src/gallium/state_trackers/python/st_device.c @@ -31,8 +31,10 @@ #include "pipe/p_shader_tokens.h" #include "util/u_inlines.h" #include "cso_cache/cso_context.h" +#include "util/u_inlines.h" #include "util/u_math.h" #include "util/u_memory.h" +#include "util/u_sampler.h" #include "util/u_simple_shaders.h" #include "trace/tr_public.h" @@ -124,9 +126,9 @@ st_context_destroy(struct st_context *st_ctx) st_ctx->pipe->destroy(st_ctx->pipe); for(i = 0; i < PIPE_MAX_SAMPLERS; ++i) - pipe_texture_reference(&st_ctx->fragment_sampler_textures[i], NULL); + pipe_sampler_view_reference(&st_ctx->fragment_sampler_views[i], NULL); for(i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; ++i) - pipe_texture_reference(&st_ctx->vertex_sampler_textures[i], NULL); + pipe_sampler_view_reference(&st_ctx->vertex_sampler_views[i], NULL); pipe_texture_reference(&st_ctx->default_texture, NULL); FREE(st_ctx); @@ -227,9 +229,12 @@ st_context_create(struct st_device *st_dev) /* default textures */ { + struct pipe_context *pipe = st_ctx->pipe; struct pipe_screen *screen = st_dev->screen; struct pipe_texture templat; struct pipe_transfer *transfer; + struct pipe_sampler_view view_templ; + struct pipe_sampler_view *view; unsigned i; memset( &templat, 0, sizeof( templat ) ); @@ -242,31 +247,44 @@ st_context_create(struct st_device *st_dev) st_ctx->default_texture = screen->texture_create( screen, &templat ); if(st_ctx->default_texture) { - transfer = screen->get_tex_transfer(screen, - st_ctx->default_texture, - 0, 0, 0, - PIPE_TRANSFER_WRITE, - 0, 0, - st_ctx->default_texture->width0, - st_ctx->default_texture->height0); + transfer = pipe->get_tex_transfer(pipe, + st_ctx->default_texture, + 0, 0, 0, + PIPE_TRANSFER_WRITE, + 0, 0, + st_ctx->default_texture->width0, + st_ctx->default_texture->height0); if (transfer) { uint32_t *map; - map = (uint32_t *) screen->transfer_map(screen, transfer); + map = (uint32_t *) pipe->transfer_map(pipe, transfer); if(map) { *map = 0x00000000; - screen->transfer_unmap(screen, transfer); + pipe->transfer_unmap(pipe, transfer); } - screen->tex_transfer_destroy(transfer); + pipe->tex_transfer_destroy(pipe, transfer); } } - + + u_sampler_view_default_template(&view_templ, + st_ctx->default_texture, + st_ctx->default_texture->format); + view = st_ctx->pipe->create_sampler_view(st_ctx->pipe, + st_ctx->default_texture, + &view_templ); + for (i = 0; i < PIPE_MAX_SAMPLERS; i++) - pipe_texture_reference(&st_ctx->fragment_sampler_textures[i], st_ctx->default_texture); + pipe_sampler_view_reference(&st_ctx->fragment_sampler_views[i], view); for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) - pipe_texture_reference(&st_ctx->vertex_sampler_textures[i], st_ctx->default_texture); - - cso_set_sampler_textures(st_ctx->cso, PIPE_MAX_SAMPLERS, st_ctx->fragment_sampler_textures); - cso_set_vertex_sampler_textures(st_ctx->cso, PIPE_MAX_VERTEX_SAMPLERS, st_ctx->vertex_sampler_textures); + pipe_sampler_view_reference(&st_ctx->vertex_sampler_views[i], view); + + st_ctx->pipe->set_fragment_sampler_views(st_ctx->pipe, + PIPE_MAX_SAMPLERS, + st_ctx->fragment_sampler_views); + st_ctx->pipe->set_vertex_sampler_views(st_ctx->pipe, + PIPE_MAX_VERTEX_SAMPLERS, + st_ctx->vertex_sampler_views); + + pipe_sampler_view_reference(&view, NULL); } /* vertex shader */ diff --git a/src/gallium/state_trackers/python/st_device.h b/src/gallium/state_trackers/python/st_device.h index 6ec7409b11..dcd0dc6e27 100644 --- a/src/gallium/state_trackers/python/st_device.h +++ b/src/gallium/state_trackers/python/st_device.h @@ -60,8 +60,8 @@ struct st_context void *gs; struct pipe_texture *default_texture; - struct pipe_texture *fragment_sampler_textures[PIPE_MAX_SAMPLERS]; - struct pipe_texture *vertex_sampler_textures[PIPE_MAX_VERTEX_SAMPLERS]; + struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS]; + struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS]; unsigned num_vertex_buffers; struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS]; diff --git a/src/gallium/state_trackers/python/st_sample.c b/src/gallium/state_trackers/python/st_sample.c index e180815346..e2c1e06017 100644 --- a/src/gallium/state_trackers/python/st_sample.c +++ b/src/gallium/state_trackers/python/st_sample.c @@ -523,29 +523,30 @@ st_sample_pixel_block(enum pipe_format format, void -st_sample_surface(struct st_surface *surface, float *rgba) +st_sample_surface(struct pipe_context *pipe, + struct st_surface *surface, + float *rgba) { struct pipe_texture *texture = surface->texture; - struct pipe_screen *screen = texture->screen; unsigned width = u_minify(texture->width0, surface->level); unsigned height = u_minify(texture->height0, surface->level); uint rgba_stride = width * 4; struct pipe_transfer *transfer; void *raw; - transfer = screen->get_tex_transfer(screen, - surface->texture, - surface->face, - surface->level, - surface->zslice, - PIPE_TRANSFER_WRITE, - 0, 0, - width, - height); + transfer = pipe->get_tex_transfer(pipe, + surface->texture, + surface->face, + surface->level, + surface->zslice, + PIPE_TRANSFER_WRITE, + 0, 0, + width, + height); if (!transfer) return; - raw = screen->transfer_map(screen, transfer); + raw = pipe->transfer_map(pipe, transfer); if (raw) { enum pipe_format format = texture->format; uint x, y; @@ -567,8 +568,8 @@ st_sample_surface(struct st_surface *surface, float *rgba) } } - screen->transfer_unmap(screen, transfer); + pipe->transfer_unmap(pipe, transfer); } - screen->tex_transfer_destroy(transfer); + pipe->tex_transfer_destroy(pipe, transfer); } diff --git a/src/gallium/state_trackers/python/st_sample.h b/src/gallium/state_trackers/python/st_sample.h index 888114d302..6fb8417add 100644 --- a/src/gallium/state_trackers/python/st_sample.h +++ b/src/gallium/state_trackers/python/st_sample.h @@ -32,6 +32,9 @@ #include "pipe/p_format.h" +struct pipe_context; +struct st_surface; + void st_sample_pixel_block(enum pipe_format format, @@ -40,7 +43,9 @@ st_sample_pixel_block(enum pipe_format format, unsigned w, unsigned h); void -st_sample_surface(struct st_surface *surface, float *rgba); +st_sample_surface(struct pipe_context *pipe, + struct st_surface *surface, + float *rgba); #endif /* ST_SAMPLE_H_ */ diff --git a/src/gallium/state_trackers/python/st_softpipe_winsys.c b/src/gallium/state_trackers/python/st_softpipe_winsys.c index 985374190c..0a332aaa9f 100644 --- a/src/gallium/state_trackers/python/st_softpipe_winsys.c +++ b/src/gallium/state_trackers/python/st_softpipe_winsys.c @@ -30,7 +30,7 @@ #include "softpipe/sp_public.h" #include "llvmpipe/lp_public.h" #include "state_tracker/sw_winsys.h" -#include "null/null_sw_winsys.h" +#include "sw/null/null_sw_winsys.h" #include "st_winsys.h" |