From 42ab3f6fd2a019e63bf66cc59c5afb8cb6a53741 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 26 Mar 2010 17:19:45 -0700 Subject: [PATCH] st/python: updates for recent interface changes Still problems at runtime with vertex elements, etc. Building still disabled. --- src/gallium/state_trackers/python/p_texture.i | 86 +++++++++---------- src/gallium/state_trackers/python/st_device.c | 22 ++--- src/gallium/state_trackers/python/st_sample.c | 5 +- .../python/st_softpipe_winsys.c | 2 +- 4 files changed, 58 insertions(+), 57 deletions(-) diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index 761587dc533..2dd9e5050ea 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -125,10 +125,10 @@ struct st_surface } %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) + void get_tile_raw(struct st_context *ctx, 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_context *pipe = ctx->pipe; struct pipe_transfer *transfer; unsigned stride; @@ -138,7 +138,7 @@ struct st_surface if(!*STRING) return; - transfer = screen->get_tex_transfer(screen, + transfer = pipe->get_tex_transfer(pipe, $self->texture, $self->face, $self->level, @@ -146,16 +146,16 @@ struct st_surface 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); + 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 put_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, const char *STRING, unsigned LENGTH, unsigned stride = 0) + void put_tile_raw(struct st_context *ctx, 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_context *pipe = ctx->pipe; struct pipe_transfer *transfer; if(stride == 0) @@ -164,7 +164,7 @@ struct st_surface 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, + transfer = pipe->get_tex_transfer(pipe, $self->texture, $self->face, $self->level, @@ -174,19 +174,18 @@ struct st_surface 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); + pipe_put_tile_raw(pipe, transfer, 0, 0, w, h, STRING, stride); + pipe->tex_transfer_destroy(pipe, transfer); fail: return; } - void - get_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, float *rgba) + void get_tile_rgba(struct st_context *ctx, unsigned x, unsigned y, unsigned w, unsigned h, float *rgba) { - struct pipe_screen *screen = $self->texture->screen; + struct pipe_context *pipe = ctx->pipe; struct pipe_transfer *transfer; - transfer = screen->get_tex_transfer(screen, + transfer = pipe->get_tex_transfer(pipe, $self->texture, $self->face, $self->level, @@ -194,17 +193,17 @@ struct st_surface PIPE_TRANSFER_READ, x, y, w, h); if(transfer) { - pipe_get_tile_rgba(transfer, 0, 0, w, h, rgba); - screen->tex_transfer_destroy(transfer); + pipe_get_tile_rgba(pipe, transfer, 0, 0, w, h, rgba); + pipe->tex_transfer_destroy(pipe, transfer); } } void - put_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, const float *rgba) + put_tile_rgba(struct st_context *ctx, unsigned x, unsigned y, unsigned w, unsigned h, const float *rgba) { - struct pipe_screen *screen = $self->texture->screen; + struct pipe_context *pipe = ctx->pipe; struct pipe_transfer *transfer; - transfer = screen->get_tex_transfer(screen, + transfer = pipe->get_tex_transfer(pipe, $self->texture, $self->face, $self->level, @@ -212,16 +211,16 @@ struct st_surface PIPE_TRANSFER_WRITE, x, y, w, h); if(transfer) { - pipe_put_tile_rgba(transfer, 0, 0, w, h, rgba); - screen->tex_transfer_destroy(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 - get_tile_rgba8(unsigned x, unsigned y, unsigned w, unsigned h, char **STRING, int *LENGTH) + get_tile_rgba8(struct st_context *ctx, unsigned x, unsigned y, unsigned w, unsigned h, char **STRING, int *LENGTH) { - struct pipe_screen *screen = $self->texture->screen; + struct pipe_context *pipe = ctx->pipe; struct pipe_transfer *transfer; float *rgba; unsigned char *rgba8; @@ -244,7 +243,7 @@ struct st_surface rgba8 = (unsigned char *) *STRING; - transfer = screen->get_tex_transfer(screen, + transfer = pipe->get_tex_transfer(pipe, $self->texture, $self->face, $self->level, @@ -253,24 +252,23 @@ struct st_surface x, y, w, h); if(transfer) { - pipe_get_tile_rgba(transfer, 0, 0, w, h, rgba); + 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]); } - screen->tex_transfer_destroy(transfer); + pipe->tex_transfer_destroy(pipe, transfer); } free(rgba); } - void - get_tile_z(unsigned x, unsigned y, unsigned w, unsigned h, unsigned *z) + void get_tile_z(struct st_context *ctx, unsigned x, unsigned y, unsigned w, unsigned h, unsigned *z) { - struct pipe_screen *screen = $self->texture->screen; + struct pipe_context *pipe = ctx->pipe; struct pipe_transfer *transfer; - transfer = screen->get_tex_transfer(screen, + transfer = pipe->get_tex_transfer(pipe, $self->texture, $self->face, $self->level, @@ -278,17 +276,16 @@ struct st_surface PIPE_TRANSFER_READ, x, y, w, h); if(transfer) { - pipe_get_tile_z(transfer, 0, 0, w, h, z); - screen->tex_transfer_destroy(transfer); + pipe_get_tile_z(pipe, transfer, 0, 0, w, h, z); + pipe->tex_transfer_destroy(pipe, transfer); } } - void - put_tile_z(unsigned x, unsigned y, unsigned w, unsigned h, const unsigned *z) + void put_tile_z(struct st_context *ctx, unsigned x, unsigned y, unsigned w, unsigned h, const unsigned *z) { - struct pipe_screen *screen = $self->texture->screen; + struct pipe_context *pipe = ctx->pipe; struct pipe_transfer *transfer; - transfer = screen->get_tex_transfer(screen, + transfer = pipe->get_tex_transfer(pipe, $self->texture, $self->face, $self->level, @@ -296,20 +293,21 @@ struct st_surface PIPE_TRANSFER_WRITE, x, y, w, h); if(transfer) { - pipe_put_tile_z(transfer, 0, 0, w, h, z); - screen->tex_transfer_destroy(transfer); + pipe_put_tile_z(pipe, transfer, 0, 0, w, h, z); + pipe->tex_transfer_destroy(pipe, 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) + unsigned compare_tile_rgba(struct st_context *ctx, unsigned x, unsigned y, unsigned w, unsigned h, const float *rgba, float tol = 0.0) { - struct pipe_screen *screen = $self->texture->screen; + struct pipe_context *pipe = ctx->pipe; struct pipe_transfer *transfer; float *rgba2; const float *p1; @@ -320,7 +318,7 @@ struct st_surface if(!rgba2) return ~0; - transfer = screen->get_tex_transfer(screen, + transfer = pipe->get_tex_transfer(pipe, $self->texture, $self->face, $self->level, @@ -332,8 +330,8 @@ struct st_surface return ~0; } - pipe_get_tile_rgba(transfer, 0, 0, w, h, rgba2); - screen->tex_transfer_destroy(transfer); + pipe_get_tile_rgba(pipe, transfer, 0, 0, w, h, rgba2); + pipe->tex_transfer_destroy(pipe, transfer); p1 = rgba; p2 = rgba2; diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c index 0d87c705e75..44d65e3fc1e 100644 --- a/src/gallium/state_trackers/python/st_device.c +++ b/src/gallium/state_trackers/python/st_device.c @@ -31,6 +31,7 @@ #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" @@ -228,6 +229,7 @@ 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; @@ -245,21 +247,21 @@ 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); } } diff --git a/src/gallium/state_trackers/python/st_sample.c b/src/gallium/state_trackers/python/st_sample.c index e1808153461..f9622533fbc 100644 --- a/src/gallium/state_trackers/python/st_sample.c +++ b/src/gallium/state_trackers/python/st_sample.c @@ -521,7 +521,7 @@ st_sample_pixel_block(enum pipe_format format, } } - +#if 0 void st_sample_surface(struct st_surface *surface, float *rgba) { @@ -533,7 +533,7 @@ st_sample_surface(struct st_surface *surface, float *rgba) struct pipe_transfer *transfer; void *raw; - transfer = screen->get_tex_transfer(screen, + transfer = pipe->get_tex_transfer(pipe, surface->texture, surface->face, surface->level, @@ -572,3 +572,4 @@ st_sample_surface(struct st_surface *surface, float *rgba) screen->tex_transfer_destroy(transfer); } +#endif diff --git a/src/gallium/state_trackers/python/st_softpipe_winsys.c b/src/gallium/state_trackers/python/st_softpipe_winsys.c index 985374190c3..0a332aaa9f1 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" -- 2.30.2